Linter
β How it works
Section titled ββ How it worksβThe project uses ESLint for linting the code. It uses ESlint βflat configβ, and is based on the Antfu ESLint config.
π‘ Why we use Antfu ESLint config
Section titled βπ‘ Why we use Antfu ESLint configβAntfu rules are solid, supported by a strong community (and an excellent developer), and provides really good default for the technology we use.
This simplifies our configuration, removes a lot of headache, and prevents losing time over small linting details.
π How to use
Section titled βπ How to useβThe linting is done automatically when you run pnpm lint. You can also run pnpm lint:fix to fix the linting errors automatically.
π§ How to customize rules
Section titled βπ§ How to customize rulesβFlat config allows us to centralize all the rules in a single file, and to override them for specific files or directories.
For example, here is how we disable some rules for the API module:
export default antfu( // Previous global rules... // Only override rules for the API module { files: ['apps/api/**/*.ts', 'apps/api/**/*.json'], rules: { 'ts/consistent-type-imports': 'off', 'node/prefer-global/process': ['error', 'always'], }, })Check out the Antfu ESLint config for more details on the rules and how to override them.