70 lines
1.9 KiB
JavaScript
70 lines
1.9 KiB
JavaScript
import js from '@eslint/js';
|
|
import reactPlugin from 'eslint-plugin-react';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
import importPlugin from 'eslint-plugin-import';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
export default [
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
files: ['**/*.ts', '**/*.tsx'],
|
|
ignores: ['node_modules/**', '.next/**', 'out/**', 'dist/**'],
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
project: './tsconfig.json',
|
|
},
|
|
globals: {
|
|
React: true,
|
|
JSX: true,
|
|
},
|
|
},
|
|
plugins: {
|
|
react: reactPlugin,
|
|
'react-hooks': reactHooks,
|
|
'jsx-a11y': jsxA11y,
|
|
import: importPlugin,
|
|
},
|
|
settings: {
|
|
react: { version: 'detect' },
|
|
'import/resolver': {
|
|
typescript: {
|
|
alwaysTryTypes: true,
|
|
project: './tsconfig.json',
|
|
},
|
|
node: {
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
},
|
|
},
|
|
},
|
|
rules: {
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react/jsx-uses-react': 'off',
|
|
'react/jsx-uses-vars': 'warn',
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
'import/order': [
|
|
'error',
|
|
{
|
|
groups: [['builtin', 'external'], ['internal'], ['parent', 'sibling', 'index']],
|
|
pathGroups: [
|
|
{
|
|
pattern: '@/**',
|
|
group: 'internal',
|
|
position: 'after',
|
|
},
|
|
],
|
|
alphabetize: { order: 'asc', caseInsensitive: true },
|
|
'newlines-between': 'always',
|
|
},
|
|
],
|
|
'import/no-duplicates': 'error',
|
|
'import/newline-after-import': ['error', { count: 1 }],
|
|
'no-unused-vars': 'warn',
|
|
},
|
|
},
|
|
];
|