Opinionated ESLint config with sensible defaults.
With ESLint v9+:
npm install @nkzw/eslint-config
In your eslint.config.js
:
import nkzw from '@nkzw/eslint-config';
export default nkzw;
Or, if you have custom ESLint rules or configuration:
import nkzw from '@nkzw/eslint-config';
export default [
...nkzw,
{
// Custom configuration.
},
];
Then run pnpm eslint .
or npm eslint .
.
Note: You can use @nkzw/eslint-config 1.x with ESLint versions 8 and below.
Use this configuration if these principles resonate with you:
- Error, Never Warn: Warnings are noise and get ignored. Either it's an issue, or it isn't. This config forces developers to fix problems or explicitly disable the rule with a comment.
- Strict, Consistent Code Style: When multiple approaches exist, this configuration enforces the strictest, most consistent code style, preferring modern language features and best practices.
- Prevent Bugs: Problematic patterns such as
instanceof
are not allowed, forcing developers to choose more robust patterns. Debug-only code such asconsole.log
ortest.only
are disallowed to avoid accidental CI failures or unintended logging in production. - Fast: Slow rules are avoided. For example, TypeScript's
noUnusedLocals
check is preferred overno-unused-vars
. - Don't get in the way: Subjective or overly opinionated rules (e.g. style preferences) are disabled. Autofixable rules are preferred to reduce friction and save time.
This configuration consists of the most useful and least annoying rules from the following eslint plugins:
typescript-eslint
eslint-import-resolver-typescript
eslint-plugin-unicorn
eslint-plugin-import-x
eslint-plugin-react
eslint-plugin-react-hooks
eslint-plugin-perfectionist
eslint-plugin-no-instanceof
eslint-plugin-no-only-tests
This configuration is meant to be used with:
- TypeScript and the
noUnusedLocals
setting. - Prettier and the
@ianvs/prettier-plugin-sort-imports
.
Read about more frontend tooling suggestions in this blog post.