diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..01c91ca --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Use spaces instead of tabs +[*] +indent_style = space + +# Insert new line at the end of files +[*] +insert_final_newline = true diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..29ad4bc --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,3 @@ +# .git-blame-ignore-revs +# Ignore changes in git blame for specific revisions +4f8e868bd796996bc91e1b6139a77427ac97a30e # Add prettier plugin for tailwind css sort classes diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..09d929c --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,54 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# ESLint is a tool for identifying and reporting on patterns +# found in ECMAScript/JavaScript code. +# More details at https://github.com/eslint/eslint +# and https://eslint.org + +name: Eslint and Prettier + +on: + push: + branches: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + +jobs: + eslint: + name: Run eslint scanning + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install ESLint + run: | + npm install eslint@8.55.0 + npm install @microsoft/eslint-formatter-sarif@2.1.7 + + - name: Run ESLint + run: npx eslint . + --config .eslintrc.cjs + --ext .js,.jsx,.ts,.tsx + --format @microsoft/eslint-formatter-sarif + --output-file eslint-results.sarif + continue-on-error: true + + - name: Upload analysis results to GitHub + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: eslint-results.sarif + wait-for-processing: true + + - name: Run Prettier + run: npx prettier src/ + --check + --config .prettierrc.cjs + continue-on-error: false diff --git a/.prettierrc.js b/.prettierrc.cjs similarity index 76% rename from .prettierrc.js rename to .prettierrc.cjs index 2165cc2..56061f9 100644 --- a/.prettierrc.js +++ b/.prettierrc.cjs @@ -1,11 +1,10 @@ // prettier.config.js, .prettierrc.js, prettier.config.mjs, or .prettierrc.mjs /** @type {import("prettier").Config} */ -const config = { +module.exports = { + plugins: ['prettier-plugin-tailwindcss'], trailingComma: 'es5', tabWidth: 4, semi: false, singleQuote: true, } - -export default config diff --git a/package-lock.json b/package-lock.json index f06d4fd..83e203f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.32", "prettier": "3.1.1", + "prettier-plugin-tailwindcss": "^0.5.9", "tailwindcss": "^3.3.6", "typescript": "^5.2.2", "vite": "^5.0.8" @@ -8820,6 +8821,75 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-plugin-tailwindcss": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.9.tgz", + "integrity": "sha512-9x3t1s2Cjbut2QiP+O0mDqV3gLXTe2CgRlQDgucopVkUdw26sQi53p/q4qvGxMLBDfk/dcTV57Aa/zYwz9l8Ew==", + "dev": true, + "engines": { + "node": ">=14.21.3" + }, + "peerDependencies": { + "@ianvs/prettier-plugin-sort-imports": "*", + "@prettier/plugin-pug": "*", + "@shopify/prettier-plugin-liquid": "*", + "@trivago/prettier-plugin-sort-imports": "*", + "prettier": "^3.0", + "prettier-plugin-astro": "*", + "prettier-plugin-css-order": "*", + "prettier-plugin-import-sort": "*", + "prettier-plugin-jsdoc": "*", + "prettier-plugin-marko": "*", + "prettier-plugin-organize-attributes": "*", + "prettier-plugin-organize-imports": "*", + "prettier-plugin-style-order": "*", + "prettier-plugin-svelte": "*" + }, + "peerDependenciesMeta": { + "@ianvs/prettier-plugin-sort-imports": { + "optional": true + }, + "@prettier/plugin-pug": { + "optional": true + }, + "@shopify/prettier-plugin-liquid": { + "optional": true + }, + "@trivago/prettier-plugin-sort-imports": { + "optional": true + }, + "prettier-plugin-astro": { + "optional": true + }, + "prettier-plugin-css-order": { + "optional": true + }, + "prettier-plugin-import-sort": { + "optional": true + }, + "prettier-plugin-jsdoc": { + "optional": true + }, + "prettier-plugin-marko": { + "optional": true + }, + "prettier-plugin-organize-attributes": { + "optional": true + }, + "prettier-plugin-organize-imports": { + "optional": true + }, + "prettier-plugin-style-order": { + "optional": true + }, + "prettier-plugin-svelte": { + "optional": true + }, + "prettier-plugin-twig-melody": { + "optional": true + } + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -17117,6 +17187,13 @@ "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", "dev": true }, + "prettier-plugin-tailwindcss": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.9.tgz", + "integrity": "sha512-9x3t1s2Cjbut2QiP+O0mDqV3gLXTe2CgRlQDgucopVkUdw26sQi53p/q4qvGxMLBDfk/dcTV57Aa/zYwz9l8Ew==", + "dev": true, + "requires": {} + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", diff --git a/package.json b/package.json index 0d698fc..15d43b6 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0; prettier --check \"src/**/*.{ts,tsx}\"", + "lint:fix": "eslint . --ext ts,tsx --fix; prettier --write \"src/**/*.{ts,tsx}\"", "preview": "vite preview" }, "dependencies": { @@ -40,6 +41,7 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.32", "prettier": "3.1.1", + "prettier-plugin-tailwindcss": "^0.5.9", "tailwindcss": "^3.3.6", "typescript": "^5.2.2", "vite": "^5.0.8" diff --git a/src/App.tsx b/src/App.tsx index 30c0256..44d96a5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,7 +5,7 @@ import { Footer } from '@/components/Footer/Footer.tsx' function App() { return ( -
+
diff --git a/src/components/Auth/Auth.tsx b/src/components/Auth/Auth.tsx index 7ece879..3d290dc 100644 --- a/src/components/Auth/Auth.tsx +++ b/src/components/Auth/Auth.tsx @@ -82,7 +82,7 @@ export default function Auth({ view }: AuthProps) { />
diff --git a/src/components/Auth/LogoutButton.tsx b/src/components/Auth/LogoutButton.tsx index d5d1176..c029948 100644 --- a/src/components/Auth/LogoutButton.tsx +++ b/src/components/Auth/LogoutButton.tsx @@ -5,7 +5,7 @@ export default function LogoutButton() { if (error) throw error } return ( - + ) diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 59ba33b..060fa4e 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -1,6 +1,6 @@ export const Footer = () => { return ( -