@nkzw/eslint-config v3.0.1
@nkzw/eslint-config
Opinionated ESLint config with sensible defaults.
Installation & Usage
With ESLint v9+:
npm install @nkzw/eslint-configIn 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.
Philosophy & Principles
Use this configuration if these principles resonate with you:
- Error, Never Warn: People tend to ignore warnings. There is little value in only warning about potentially problematic code patterns. Either it's an issue or not. Errors force the developer to address the problem either by fixing it or explicitly disabling the role in that location.
- Strict, consistent code style: If there are multiple ways of doing something, or there is a new language construct or best practice, this configuration will suggest the most strict and consistent solution.
- Prevent Bugs: Problematic patterns such as
instanceofare not allowed. This forces developers to choose more robust patterns. This configuration disallows usage ofconsoleortest.onlyso that you don't end up with unintended logging in production or CI failures. If you want to log to the console in your production app, use another function that callsconsole.logto distinguish between debug logs and intentional logs. - Fast: Slow rules are avoided if possible. For example, it is recommended to use the fast
noUnusedLocalscheck in TypeScript instead of theno-unused-varsrules. - Don't get in the way: Rules that get in the way or are too subjective are disabled. Rules with autofixers are preferred over rules without them.
Included Plugins & Rules
This configuration consists of the most useful and least annoying rules from the following eslint plugins:
typescript-eslinteslint-import-resolver-typescripteslint-plugin-unicorneslint-plugin-import-xeslint-plugin-reacteslint-plugin-react-hookseslint-plugin-perfectionisteslint-plugin-no-instanceofeslint-plugin-no-only-tests
Suggestions
This configuration is meant to be used with:
- TypeScript and the
noUnusedLocalssetting. - Prettier and the
@ianvs/prettier-plugin-sort-imports.
Read about more frontend tooling suggestions in this blog post.
10 months ago
6 months ago
7 months ago
6 months ago
6 months ago
8 months ago
10 months ago
5 months ago
5 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago