Modular ESLint Configuration
Each module defines rules that are meant to be reasonable defaults and best practices, but you can easily extend or override any of the rules to suit your needs.
Modular TSLint configuration for TypeScript projects
npm install eslint eslint-config-modular --save-dev
Shareable configs are designed to work with the
extends feature of
.eslintrc files. You can learn more about
Shareable Configs on the official ESLint website.
To use ESLint Modular in your project, create an
.eslintrc.yml file with the following contents:
extends: # These modules would be good for a Node.js project written in ES5 - modular/best-practices - modular/style - modular/node - modular/es5 rules: # You can override or extend any rules here
eslint-config-modular includes the following modules. Mix-and-match them as applicable to your project.
This module contains rules that prevent accidental bugs, insecure code, and bad coding practices. You can use this module directly, or use any/all of its sub-modules.
The rules in this module prevent syntax that is likely to lead to accidental bugs or runtime errors. Examples include not reassigning native objects, and using
=== instead of
== for comparisons. Most of the rules in this file will raise an error if violated, but some less-severe ones will only raise warnings.
This module configures ESLint to recognize browser globals, such as
navigator, etc. It also contains rules that are specific to projects that are intended to run in web browsers, such as avoiding the
alert() statement and requiring the
use strict directive within a function.
This module configures ESLint to parse EcmaScript 5 code. It also disables ES6-specific rules, such as using
let instead of
This module configures ESLint to parse EcmaScript 6 (and newer) code. It also contains ES6-specific rules, such as not assigning to constants, calling
super() in constructors, and using
let instead of
This module configures ESLint to recognize Node.js globals, such as
Buffer, etc. It also contains rules that are specific to Node.js projects, such as avoding
new require() syntax and disallowing concatenation with
This module contains code-styling and consistency rules. You can use this module directly, or use any/all of its sub-modules.
This module configures ESLint to recognize globals that are defined by common test frameworks, such as
beforeEach, etc. It also disables rules that tend to cause problems with certain test frameworks.
Note: We recommend that you create a separate
.eslintrc.ymlfile in your test folder. That way, it can use different modules and rules than the rest of your codebase.
Big Thanks To
Thanks to these awesome companies for their support of Open Source developers ❤