Special Statement
: This project comes from@antfu/eslint-config
. The two are almost the same, with only some differences to meet personal needs. In order to seek convenience and prevent some conflicts between the upstream branch and my own changes after forking, I chose to copy instead of fork.
Differences from @antfu/eslint-config:
- With semi:
semi: true
. - Always arrow parens:
arrowParens: true
. - Explicitly use
1tbs
as brace style:braceStyle: '1tbs'
. - Disabled antfu's top level function rule:
'antfu/top-level-function': 'off'
. - Always curly:
'antfu/curly': 'off'
'curly': ['error', 'all']
- This eslint-config will enable
ts/consistent-type-imports
rule. But it will cause compile issue in nest projects. So I disabled it in this config in nest framework. - Support
'**/*.?([cm])js
and'**/*.?([cm])jsx
files in react projects. - Perfectionist plugin for imports sorting:
[
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'style',
'side-effect',
'side-effect-style',
'object',
'builtin-type',
'external-type',
'internal-type',
'parent-type',
'sibling-type',
'index-type',
'unknown',
];
Requires ESLint v9.5.0+
We provided a CLI tool to help you set up your project, or migrate from the legacy config to the new flat config with one command.
pnpm dlx @dhzh/eslint-config@latest
If you prefer to set up manually:
pnpm i -D eslint @dhzh/eslint-config
And create eslint.config.mjs
in your project root:
// eslint.config.mjs
import dhzh from '@dhzh/eslint-config';
export default dhzh();
MIT License © 2022-PRESENT Easton Zheng