Skip to content

Latest commit

 

History

History
75 lines (55 loc) · 2.18 KB

README.md

File metadata and controls

75 lines (55 loc) · 2.18 KB

@dhzh/eslint-config

npm

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:

  1. With semi: semi: true.
  2. Always arrow parens: arrowParens: true.
  3. Explicitly use 1tbs as brace style: braceStyle: '1tbs'.
  4. Disabled antfu's top level function rule: 'antfu/top-level-function': 'off'.
  5. Always curly:
  • 'antfu/curly': 'off'
  • 'curly': ['error', 'all']
  1. 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.
  2. Support '**/*.?([cm])js and '**/*.?([cm])jsx files in react projects.
  3. 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',
];

Usage

Requires ESLint v9.5.0+

Starter Wizard

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

Manual Install

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();

License

MIT License © 2022-PRESENT Easton Zheng