conf: 调整eslint, 允许数据层使用hooks
parent
e31a20e92d
commit
28e2b9f6a6
@ -1,22 +1,15 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
env: { browser: true, es2020: true },
|
env: { browser: true, es2020: true },
|
||||||
extends: [
|
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:react/jsx-runtime', 'plugin:react-hooks/recommended'],
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:react/recommended',
|
|
||||||
'plugin:react/jsx-runtime',
|
|
||||||
'plugin:react-hooks/recommended',
|
|
||||||
],
|
|
||||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
||||||
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
|
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
|
||||||
settings: { react: { version: '18.2' } },
|
settings: { react: { version: '18.2' } },
|
||||||
plugins: ['react-refresh'],
|
plugins: ['react-refresh'],
|
||||||
rules: {
|
rules: {
|
||||||
'react-refresh/only-export-components': [
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
||||||
'warn',
|
|
||||||
{ allowConstantExport: true },
|
|
||||||
],
|
|
||||||
'no-unused-vars': ['warn', { args: 'after-used', vars: 'all' }],
|
'no-unused-vars': ['warn', { args: 'after-used', vars: 'all' }],
|
||||||
"react/prop-types": "off",
|
'react/prop-types': 'off',
|
||||||
|
'react-hooks/rules-of-hooks': 'warn',
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
Loading…
Reference in New Issue