55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
import js from '@eslint/js';
|
|
import reactPlugin from 'eslint-plugin-react';
|
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
import globals from 'globals';
|
|
import babelParser from '@babel/eslint-parser';
|
|
|
|
export default [
|
|
js.configs.recommended,
|
|
{
|
|
files: ['**/*.{js,jsx}'],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node,
|
|
},
|
|
parser: babelParser,
|
|
parserOptions: {
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
requireConfigFile: false,
|
|
babelOptions: {
|
|
presets: ['@babel/preset-react']
|
|
}
|
|
},
|
|
},
|
|
plugins: {
|
|
react: reactPlugin,
|
|
'react-hooks': reactHooksPlugin,
|
|
},
|
|
rules: {
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react/prop-types': 'off',
|
|
'no-unused-vars': ['error', {
|
|
varsIgnorePattern: 'React',
|
|
ignoreRestSiblings: true,
|
|
args: 'after-used',
|
|
argsIgnorePattern: '^_'
|
|
}],
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
'react/jsx-uses-react': 'error',
|
|
'react/jsx-uses-vars': 'error',
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
},
|
|
},
|
|
]; |