From 6c562cba8428b2e90846ad6af6bfad6d1e2814ec Mon Sep 17 00:00:00 2001 From: Eddie Jaoude Date: Sat, 11 Sep 2021 01:32:47 +0100 Subject: [PATCH] feat: lint + prettier --- .eslintrc.yml | 10 +++++++--- .github/workflows/build.yml | 2 +- .github/workflows/deploy.yml | 10 +++++----- .gitpod.yml | 2 +- .prettierrc.json | 5 +++++ kubernetes/ingress.yml | 2 +- package-lock.json | 25 ++++++++++++++++++++++--- package.json | 3 ++- src/App.js | 19 ++++++++++--------- src/Components/Footer.js | 8 ++++---- src/Components/Links.js | 24 +++++++++++++++--------- src/Components/Profile.js | 18 +++++++++++++----- src/Components/Socials.js | 26 +++++++++++++------------- src/index.js | 16 ++++++++-------- src/reportWebVitals.js | 18 +++++++++--------- 15 files changed, 116 insertions(+), 72 deletions(-) create mode 100644 .prettierrc.json diff --git a/.eslintrc.yml b/.eslintrc.yml index 1d6b95c29d4..c3866eb6a91 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -2,8 +2,8 @@ env: browser: true es2021: true extends: - - "plugin:react/recommended" - - "plugin:json/recommended" + - 'plugin:react/recommended' + - 'plugin:json/recommended' - standard parserOptions: ecmaFeatures: @@ -12,4 +12,8 @@ parserOptions: sourceType: module plugins: - react -rules: {} +rules: + { + 'space-before-function-paren': ['error', 'never'], + 'comma-dangle': ['error', 'always-multiline'], + } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04f07716889..d3efe1f75fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: - node-version: "16" + node-version: '16' - name: install dependencies run: npm ci - name: run linter diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6da3613b6f4..446c23cf750 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: - node-version: "16" + node-version: '16' - name: install dependencies run: npm ci - name: run build @@ -48,7 +48,7 @@ jobs: push: true secrets: | 'GH_TOKEN=${{ secrets.GITHUB_TOKEN }}' - build-args: "github_token=${{ secrets.GITHUB_TOKEN }}" + build-args: 'github_token=${{ secrets.GITHUB_TOKEN }}' tags: | ghcr.io/eddiehubcommunity/linktree:v${{ steps.package-version.outputs.current-version}} ghcr.io/eddiehubcommunity/linktree:latest @@ -67,7 +67,7 @@ jobs: kubeconfig: ${{ secrets.KUBE_CONFIG }} - uses: Azure/k8s-deploy@v1.4 with: - namespace: "default" + namespace: 'default' manifests: kubernetes/deployment.yml - images: "ghcr.io/eddiehubcommunity/linktree:v${{ steps.package-version.outputs.current-version}}" - kubectl-version: "latest" + images: 'ghcr.io/eddiehubcommunity/linktree:v${{ steps.package-version.outputs.current-version}}' + kubectl-version: 'latest' diff --git a/.gitpod.yml b/.gitpod.yml index b0934d17a1d..0d257bd0e97 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,7 +1,7 @@ # List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/ tasks: - name: npm - init: npm install + init: npm install command: npm run start # List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/ diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000000..e63fa606570 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,5 @@ +{ + "trailingComma": "all", + "semi": false, + "singleQuote": true +} diff --git a/kubernetes/ingress.yml b/kubernetes/ingress.yml index 19255a33547..b6ae089a456 100644 --- a/kubernetes/ingress.yml +++ b/kubernetes/ingress.yml @@ -6,7 +6,7 @@ metadata: nginx.ingress.kubernetes.io/rewrite-target: / spec: rules: - - host: "linkfree.eddiehub.org" + - host: 'linkfree.eddiehub.org' http: paths: - path: / diff --git a/package-lock.json b/package-lock.json index b0f41354e4c..50948bca43f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "members", - "version": "0.3.0", + "version": "0.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.3.0", + "version": "0.3.1", "dependencies": { "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^11.2.7", @@ -28,7 +28,8 @@ "eslint-plugin-json": "^3.1.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-react": "^7.25.1" + "eslint-plugin-react": "^7.25.1", + "prettier": "2.4.0" } }, "node_modules/@babel/code-frame": { @@ -16381,6 +16382,18 @@ "node": ">=0.10.0" } }, + "node_modules/prettier": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.0.tgz", + "integrity": "sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", @@ -35013,6 +35026,12 @@ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" }, + "prettier": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.0.tgz", + "integrity": "sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ==", + "dev": true + }, "pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/package.json b/package.json index 68a3fbd3181..ce992b4824c 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "eslint-plugin-json": "^3.1.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-react": "^7.25.1" + "eslint-plugin-react": "^7.25.1", + "prettier": "2.4.0" } } diff --git a/src/App.js b/src/App.js index 8d4947fc3b5..fdd6d57954a 100644 --- a/src/App.js +++ b/src/App.js @@ -1,12 +1,13 @@ -import "primereact/resources/themes/saga-blue/theme.css"; -import "primereact/resources/primereact.min.css"; -import "primeicons/primeicons.css"; -import "primeflex/primeflex.css"; +import 'primereact/resources/themes/saga-blue/theme.css' +import 'primereact/resources/primereact.min.css' +import 'primeicons/primeicons.css' +import 'primeflex/primeflex.css' -import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; +import React from 'react' +import { BrowserRouter as Router, Switch, Route } from 'react-router-dom' -import Footer from "./Components/Footer"; -import Socials from "./Components/Socials"; +import Footer from './Components/Footer' +import Socials from './Components/Socials' function App() { return ( @@ -20,7 +21,7 @@ function App() {