Конфиг eslint
.eslintrc.js
Необходимые библиотеки:
npm i -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-config-airbnb eslint-config-prettier eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-next
Конфиг файл:
module.exports = {
env: {
browser: true,
es2021: true,
},
settings: {
react: {
version: 'detect',
},
},
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'next/core-web-vitals',
'plugin:react/recommended',
'airbnb',
'prettier',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: [
'react',
'prettier',
'@typescript-eslint',
'@next/eslint-plugin-next',
],
rules: {
'no-restricted-syntax': 'off',
'react/function-component-definition': 'off',
'react/jsx-pascal-case': 'off',
'react/display-name': 'off',
'no-throw-literal': 'off',
'no-return-assign': 'off',
'react/no-this-in-sfc': 'off',
'no-nested-ternary': 'off',
'react/jsx-no-useless-fragment': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'react/no-unstable-nested-components': 'off',
'react/button-has-type': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-filename-extension': 'off',
'react/prop-types': 'off',
'react/jsx-props-no-spreading': 'off',
'import/prefer-default-export': 'off',
'no-return-await': 'off',
'import/no-unresolved': 'off',
'import/extensions': 'off',
'no-undef': 'off',
'no-param-reassign': 'off',
'class-methods-use-this': 'off',
'array-callback-return': 'warn',
'no-restricted-globals': 'warn',
'no-shadow': 'off',
'no-underscore-dangle': 'off',
'no-unused-vars': 'off',
'no-console': 'off',
'func-names': 'off',
'no-process-exit': 'off',
'object-shorthand': 'off',
'no-useless-constructor': 'warn',
'no-empty-function': 'warn',
'react/forbid-prop-types': 'off',
'import/no-extraneous-dependencies': 'off',
'prefer-promise-reject-errors': 'warn',
'react/require-default-props': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'consistent-return': 'off',
'react/no-array-index-key': 'off',
'no-useless-escape': 'off',
'dot-notation': 'off',
'spaced-comment': 'off',
'import/no-named-as-default': 'off',
'react/no-unescaped-entities': 'off',
'react-hooks/exhaustive-deps': 'off',
'jsx-a11y/label-has-associated-control': 'off',
'no-use-before-define': 'off',
'no-plusplus': 'off',
'react/jsx-no-bind': 'warn',
'react/no-danger': 'off',
'import/order': 'off',
'no-unused-expressions': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-var-requires': 0,
'lines-between-class-members': 'off',
'no-unsafe-optional-chaining': 'warn',
'import/no-unused-modules': 'off',
'import/no-mutable-exports': 'off',
},
};