Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 3.12 KB

README.md

File metadata and controls

53 lines (37 loc) · 3.12 KB

@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 instanceof are not allowed. This forces developers to choose more robust patterns. This configuration disallows usage of console or test.only so 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 calls console.log to distinguish between debug logs and intentional logs.
  • Fast: Slow rules are avoided if possible. For example, it is recommended to use the fast noUnusedLocals check in TypeScript instead of the no-unused-vars rules.
  • 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:

Suggestions

This configuration is meant to be used with:

Read more frontend tooling suggestions in this blog post.