|
| 1 | +{ |
| 2 | + // Configuration for JavaScript files |
| 3 | + "extends": [ |
| 4 | + "airbnb-base", |
| 5 | + "next/core-web-vitals", // Needed to avoid warning in next.js build: 'The Next.js plugin was not detected in your ESLint configuration' |
| 6 | + "plugin:prettier/recommended" |
| 7 | + ], |
| 8 | + "rules": { |
| 9 | + "prettier/prettier": [ |
| 10 | + "warn", |
| 11 | + { |
| 12 | + "singleQuote": true, |
| 13 | + "endOfLine": "auto" |
| 14 | + } |
| 15 | + ] |
| 16 | + }, |
| 17 | + "overrides": [ |
| 18 | + // Configuration for TypeScript files |
| 19 | + { |
| 20 | + "files": ["**/*.ts", "**/*.tsx"], |
| 21 | + "plugins": [ |
| 22 | + "@typescript-eslint", |
| 23 | + "unused-imports", |
| 24 | + "tailwindcss", |
| 25 | + "simple-import-sort" |
| 26 | + ], |
| 27 | + "extends": [ |
| 28 | + "plugin:tailwindcss/recommended", |
| 29 | + "airbnb-typescript", |
| 30 | + "next/core-web-vitals", |
| 31 | + "plugin:prettier/recommended" |
| 32 | + ], |
| 33 | + "parserOptions": { |
| 34 | + "project": "./tsconfig.json" |
| 35 | + }, |
| 36 | + "rules": { |
| 37 | + "prettier/prettier": [ |
| 38 | + "warn", |
| 39 | + { |
| 40 | + "singleQuote": true, |
| 41 | + "endOfLine": "auto" |
| 42 | + } |
| 43 | + ], |
| 44 | + "react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable |
| 45 | + "jsx-a11y/anchor-is-valid": "off", // Next.js use his own internal link system |
| 46 | + "react/require-default-props": "off", // Allow non-defined react props as undefined |
| 47 | + "react/jsx-props-no-spreading": "off", // _app.tsx uses spread operator and also, react-hook-form |
| 48 | + "react-hooks/exhaustive-deps": "off", // Incorrectly report needed dependency with Next.js router |
| 49 | + "@next/next/no-img-element": "off", // We currently not using next/image because it isn't supported with SSG mode |
| 50 | + "@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier |
| 51 | + "@typescript-eslint/consistent-type-imports": "error", // Ensure `import type` is used when it's necessary |
| 52 | + "import/prefer-default-export": "off", // Named export is easier to refactor automatically |
| 53 | + "no-empty-pattern": "off", |
| 54 | + "tailwindcss/classnames-order": [ |
| 55 | + "warn", |
| 56 | + { |
| 57 | + "officialSorting": true |
| 58 | + } |
| 59 | + ], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss` |
| 60 | + "simple-import-sort/imports": "error", // Import configuration for `eslint-plugin-simple-import-sort` |
| 61 | + "simple-import-sort/exports": "error", // Export configuration for `eslint-plugin-simple-import-sort` |
| 62 | + "@typescript-eslint/no-unused-vars": "off", |
| 63 | + "unused-imports/no-unused-imports": "error", |
| 64 | + "unused-imports/no-unused-vars": [ |
| 65 | + "error", |
| 66 | + { "argsIgnorePattern": "^_" } |
| 67 | + ] |
| 68 | + } |
| 69 | + }, |
| 70 | + // Configuration for testing |
| 71 | + { |
| 72 | + "files": ["**/*.test.ts", "**/*.test.tsx"], |
| 73 | + "plugins": ["jest", "jest-formatting", "testing-library", "jest-dom"], |
| 74 | + "extends": [ |
| 75 | + "plugin:jest/recommended", |
| 76 | + "plugin:jest-formatting/recommended", |
| 77 | + "plugin:testing-library/react", |
| 78 | + "plugin:jest-dom/recommended" |
| 79 | + ] |
| 80 | + } |
| 81 | + ] |
| 82 | +} |
0 commit comments