Skip to content

nazrhyn/eslint-rules

Repository files navigation

ESLint Rules

These are the ESLint rules I prefer. They're split into files to make it easy to use different sets of rules depending on what components the project has and what versions it expects.

Versions

These rules are configured to be used with the following versions.

Name Version Description
ESLint 7.16.x Includes rules and expects the recommended configuration from this version.
Node.js ^14.15.0 Node.js 14 LTS started at version 14.15.0.
V8 8.4.x Node.js 14 LTS uses V8 8.4.
ECMAScript 11 (2020) ESLint supports the nullish coalescing operator from v7.2.0 and the optional chaining operator from v7.5.0.

Files

File Description
.eslintrc.js The root file which includes other modular files.
.eslintrc-base.js Includes all rules that don't relate to ES6+ language features.
.eslintrc-es6plus.js Includes all rules that relate to ES6+ language features.
.eslintrc-node.js Includes rules from eslint-plugin-node removed from ESLint core in v7.0.0.
.eslintrc-jsdoc.js Includes rules from eslint-plugin-jsdoc replacing the require-jsdoc and valid-jsdoc rules deprecated in ESLint core in v5.10.0.
test/.eslintrc.js Rules for test files, including Jest-specific rules.

ECMAScript Modules

For now, ESLint does not support ES Modules. If your project uses ES Modules, these files will need to be renamed from *.js to *.cjs so that they still operate in CommonJS style within an ES Modules project. However, parserOptions.sourceType will still need to be set to 'module' so that the linter allows import and export statements.