|
| 1 | +module.exports = { |
| 2 | + root: true, |
| 3 | + env: { |
| 4 | + node: true, |
| 5 | + es6: true, |
| 6 | + }, |
| 7 | + parserOptions: {ecmaVersion: 8}, // to enable features such as async/await |
| 8 | + ignorePatterns: ['node_modules/*', '.next/*', '.out/*', '!.prettierrc.js'], // We don't want to lint generated files nor node_modules, but we want to lint .prettierrc.js (ignored by default by eslint) |
| 9 | + extends: ['eslint:recommended'], |
| 10 | + overrides: [ |
| 11 | + // This configuration will apply only to TypeScript files |
| 12 | + { |
| 13 | + files: ['**/*.ts', '**/*.tsx'], |
| 14 | + parser: '@typescript-eslint/parser', |
| 15 | + settings: {react: {version: 'detect'}}, |
| 16 | + env: { |
| 17 | + browser: true, |
| 18 | + node: true, |
| 19 | + es6: true, |
| 20 | + }, |
| 21 | + extends: [ |
| 22 | + 'eslint:recommended', |
| 23 | + 'plugin:@typescript-eslint/recommended', // TypeScript rules |
| 24 | + 'plugin:react/recommended', // React rules |
| 25 | + 'plugin:react-hooks/recommended', // React hooks rules |
| 26 | + 'plugin:jsx-a11y/recommended', // Accessibility rules |
| 27 | + ], |
| 28 | + rules: { |
| 29 | + 'react/prop-types': 'off', // We will use TypeScript's types for component props instead |
| 30 | + 'react/react-in-jsx-scope': 'off', // No need to import React when using Next.js |
| 31 | + 'jsx-a11y/anchor-is-valid': 'off', // This rule is not compatible with Next.js's <Link /> components |
| 32 | + '@typescript-eslint/no-unused-vars': ['error'], // Why would you want unused vars? |
| 33 | + '@typescript-eslint/explicit-function-return-type': [ |
| 34 | + // I suggest this setting for requiring return types on functions only where usefull |
| 35 | + 'warn', |
| 36 | + { |
| 37 | + allowExpressions: true, |
| 38 | + allowConciseArrowFunctionExpressionsStartingWithVoid: true, |
| 39 | + }, |
| 40 | + ], |
| 41 | + }, |
| 42 | + }, |
| 43 | + ], |
| 44 | +} |
0 commit comments