diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..7bc9fbb --- /dev/null +++ b/.eslintignore @@ -0,0 +1,14 @@ +node_modules/ +.next/ +out/ +build/ +dist/ +public/ +coverage/ +*.min.js +next-env.d.ts +.vercel/ +.design-handoff/ +bun.lock +package-lock.json +messages/ \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf706b8..5a76020 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: bun install - name: Cache Next.js build cache - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: .next/cache key: ${{ runner.os }}-nextjs-${{ hashFiles('bun.lock') }} diff --git a/.prettierrc b/.prettierrc index 0965e7e..c57e8e1 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,11 @@ { - "semi": false, - "singleQuote": true, + "semi": true, "trailingComma": "all", - "printWidth": 100 + "singleQuote": true, + "printWidth": 100, + "tabWidth": 2, + "useTabs": false, + "bracketSpacing": true, + "arrowParens": "always", + "endOfLine": "lf" } diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..ad84f89 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "bradlc.vscode-tailwindcss" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 0967ef4..23f8059 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1 +1,14 @@ -{} +{ + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact" + ], + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..cae3269 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,38 @@ +import coreWebVitals from 'eslint-config-next/core-web-vitals' +import nextTypescript from 'eslint-config-next/typescript' + +const eslintConfig = [ + ...coreWebVitals, + ...nextTypescript, + { + rules: { + 'eqeqeq': ['error', 'always', { null: 'ignore' }], + 'curly': ['warn', 'all'], + 'prefer-const': 'warn', + 'no-var': 'error', + 'no-console': ['warn', { allow: ['warn', 'error'] }], + 'no-debugger': 'error', + 'no-duplicate-imports': 'warn', + 'no-unused-expressions': 'warn', + 'no-throw-literal': 'warn', + 'no-return-await': 'warn', + 'require-await': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' } + ], + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/consistent-type-imports': [ + 'warn', + { prefer: 'type-imports', fixStyle: 'inline-type-imports' } + ], + '@typescript-eslint/no-non-null-assertion': 'warn', + '@typescript-eslint/array-type': ['warn', { default: 'array-simple' }], + '@typescript-eslint/prefer-optional-chain': 'warn', + 'react-hooks/rules-of-hooks': 'error', + 'react-hooks/exhaustive-deps': 'warn', + } + } +] + +export default eslintConfig diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index d358a53..0000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,6 +0,0 @@ -import coreWebVitals from 'eslint-config-next/core-web-vitals' -import nextTypescript from 'eslint-config-next/typescript' - -const eslintConfig = [{ ignores: ['.design-handoff/**'] }, ...coreWebVitals, ...nextTypescript] - -export default eslintConfig diff --git a/package.json b/package.json index a6e700b..9467e6c 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "start": "next start", "typecheck": "tsc --noEmit", "lint": "eslint .", + "lint:fix": "eslint . --fix", "format": "prettier --write .", "format:check": "prettier --check .", "test": "vitest run", @@ -29,6 +30,7 @@ }, "lint-staged": { "*.{ts,tsx}": [ + "eslint --fix", "bash -c \"tsc --noEmit\"" ] }, @@ -57,6 +59,9 @@ "@vitest/ui": "^4.1.9", "eslint": "^9.39.4", "eslint-config-next": "^16.2.9", + "eslint-import-resolver-typescript": "^3.10.0", + "eslint-plugin-import": "^2.32.0", + "eslint-plugin-jsx-a11y": "^6.10.2", "husky": "^9.1.7", "jsdom": "^24.0.0", "lint-staged": "^15.5.2",