49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
import js from '@eslint/js'
|
|
import globals from 'globals'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
|
|
export default [
|
|
{ ignores: ['dist/', 'api/', 'vendor/', 'node_modules/'] },
|
|
{
|
|
files: ['src/**/*.{js,jsx}'],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
globals: globals.browser,
|
|
parserOptions: {
|
|
ecmaFeatures: { jsx: true },
|
|
sourceType: 'module'
|
|
}
|
|
},
|
|
plugins: {
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
'prefer-const': 'warn',
|
|
'no-var': 'error',
|
|
'eqeqeq': 'error',
|
|
'curly': ['error', 'multi-line'],
|
|
'no-duplicate-imports': 'error',
|
|
'no-template-curly-in-string': 'warn',
|
|
'no-else-return': 'warn',
|
|
'no-lonely-if': 'warn',
|
|
'prefer-template': 'warn',
|
|
'no-nested-ternary': 'error',
|
|
'no-unneeded-ternary': 'warn'
|
|
}
|
|
},
|
|
{
|
|
files: ['src/context/*.{js,jsx}', 'src/admin/context/*.{js,jsx}'],
|
|
rules: {
|
|
'react-refresh/only-export-components': 'off'
|
|
}
|
|
}
|
|
]
|