86 lines
2.0 KiB
JavaScript
86 lines
2.0 KiB
JavaScript
import js from '@eslint/js';
|
|
import pluginReact from 'eslint-plugin-react';
|
|
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
|
|
import pluginImport from 'eslint-plugin-import';
|
|
import pluginJest from 'eslint-plugin-jest';
|
|
|
|
import { afterEach, beforeEach, describe } from 'node:test';
|
|
|
|
export default [
|
|
{ ignores: ['dist', 'coverage'] },
|
|
js.configs.recommended,
|
|
{
|
|
files: ['**/*.jsx', '**/*.js'],
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
globals: {
|
|
JSX: 'readonly',
|
|
document: true,
|
|
Document: true,
|
|
localStorage: true,
|
|
window: true,
|
|
console: true,
|
|
},
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
ecmaFeatures: { jsx: true },
|
|
sourceType: 'module',
|
|
},
|
|
},
|
|
plugins: {
|
|
react: pluginReact,
|
|
'react-hooks': pluginReactHooks,
|
|
'jsx-a11y': pluginJsxA11y,
|
|
import: pluginImport,
|
|
jest: pluginJest,
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
'import/resolver': {
|
|
node: {
|
|
extensions: ['.js', '.jsx'],
|
|
},
|
|
},
|
|
},
|
|
rules: {
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react/prop-types': 'off',
|
|
|
|
'react-hooks/rules-of-hooks': 'warn',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
|
|
'jsx-a11y/anchor-is-valid': 'warn',
|
|
|
|
'import/order': ['warn', {
|
|
groups: ['builtin', 'external', 'internal'],
|
|
'newlines-between': 'always',
|
|
}],
|
|
|
|
'jest/no-disabled-tests': 'warn',
|
|
'jest/no-identical-title': 'error',
|
|
|
|
'no-unused-vars': 'off',
|
|
|
|
},
|
|
},
|
|
{
|
|
files: ['jest.setup.js', '**/*.test.js', '**/*.test.jsx'],
|
|
languageOptions: {
|
|
globals: {
|
|
test: true,
|
|
expect: true,
|
|
jest: true,
|
|
global: true,
|
|
describe: true,
|
|
it: true,
|
|
beforeEach: true,
|
|
afterEach: true,
|
|
},
|
|
},
|
|
},
|
|
];
|