eslint-config
eslint-config copied to clipboard
Opinionated ESLint config with sensible defaults.
@nkzw/eslint-config
Opinionated ESLint config with sensible defaults.
Installation & Usage
npm install @nkzw/eslint-config
In your .eslintrc.js or .eslintrc.cjs:
module.exports = {
extends: ['@nkzw'],
};
Then run pnpm eslint . or npm eslint ..
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-importeslint-plugin-sort-keys-fixeslint-plugin-typescript-sort-keyseslint-plugin-reacteslint-plugin-react-hookseslint-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.