Package detail

@rushstack/eslint-config

microsoft279.8kMIT4.3.0

A TypeScript ESLint ruleset designed for large teams and projects

eslint, eslint-config, monorepo, rush

readme

@rushstack/eslint-config

A TypeScript ESLint ruleset designed for large teams and projects.

Philosophy

When you work in a small repo, you spend most of your time writing code. You know what each file does. You want lint rules that keep things concise and won't slow you down. That's the situation for the 99% of open source projects that shape popular coding conventions.

But as your organization scales up, things may change. People come and go. Projects frequently get handed off between teams. Every day, you find yourself working with files that you've never seen before, created by strangers whom you may never meet. It's annoying to constantly come across inconsistent styles. It can be frustrating to decipher expressions that seem to require a TypeScript Ph.D. -- especially for newcomers and junior contributors. When refactoring in bulk, you may edit lots of files without reading them very carefully. In short, the linting needs reflect different priorities:

Small scale: We can assume developers are familiar with the project. We want code to be easy to write.

Large scale: Developers are generally unfamiliar with projects. Code must be easy to read. If not, there's a risk of fragmentation, duplication of efforts, and costly rewrites. (Enabling people to churn out lots of code really fast is still a goal of course; just not the #1 priority.)

Welcome to the world of Rush Stack! The @rushstack/eslint-config package was specifically designed around the the requirements of large teams and projects.

Implementation

  • Monorepo friendly: The @rushstack/eslint-config package has direct dependencies on all the ESLint plugins that it needs. This avoids encumbering each consuming project with the obligation to satisfy a peer dependencies. It also ensures that the installed plugin versions were tested for compatibility together.

  • Battle tested: The @rushstack/eslint-config rules have been vetted on large production monorepos, across a broad set of projects, teams, and requirements. These rules embody a way of working that scales. Quite a lot of discussion and evolution went into them.

  • Designed for Prettier: The @rushstack/eslint-config ruleset is designed to be used together with the Prettier code formatter. This separation of workflows avoids hassling developers with lint "errors" for frivolous issues like spaces and commas. Instead, those issues get fixed automatically whenever you save or commit a file. Prettier also avoids frivolous debates: its defaults have already been debated at length and adopted by a sizeable community. No need to reinvent the wheel!

  • Explicit: The ruleset does not import any "recommended" templates from other ESLint packages. This avoids worrying about precedence issues due to import order. It also eliminates confusion caused by files overriding/undoing settings from another file. Each rule is configured once, in one easy-to-read file.

  • Minimal configuration: To use this ruleset, your .eslintrc.js will need to choose one "profile" and possibly one or two "mixins" that cover special cases. Beyond that, our goal is to reduce monorepo maintenance by providing a small set of .eslintrc.js recipes that can be reused across many different projects. (This sometimes means that rules will be included which have no effect for a particular project, however in practice the installation/execution cost for unused rules turns out to be negligible.)

Getting started in 3 steps

Applying the ruleset to your project is quick and easy. You install the package, then create an .eslintrc.js file and select an appropriate project profile. Optionally you can also add some "mixins" to enable additional rules. Let's walk through those three steps in more detail.

1. Install the package

To install the package, do this:

$ cd your-project-folder
$ npm install --save-dev eslint
$ npm install --save-dev typescript
$ npm install --save-dev @rushstack/eslint-config

2. Choose one profile

The ruleset currently supports three different "profile" strings, which select lint rules applicable for your project:

  • @rushstack/eslint-config/profile/node - This profile enables lint rules intended for a general Node.js project, typically a web service. It enables security rules that assume the service could receive malicious inputs from an untrusted user.

  • @rushstack/eslint-config/profile/node-trusted-tool - This profile enables lint rules intended for a Node.js project whose inputs will always come from a developer or other trusted source. Most build system tasks are like this, since they operate exclusively on files prepared by a developer. This profile disables certain security rules that would otherwise prohibit APIs that could cause a denial-of-service by consuming too many resources, or which might interact with the filesystem in unsafe ways. Such activities are safe and commonplace for a trusted tool. DO NOT use this profile for a library project that might also be loaded by a Node.js service.

  • @rushstack/eslint-config/profile/web-app - This profile enables lint rules intended for a web application, for example security rules that are relevant to web browser APIs such as DOM. Also use this profile if you are creating a library that can be consumed by both Node.js and web applications.

After choosing a profile, create an .eslintrc.js config file that provides the NodeJS __dirname context for TypeScript. Add your profile string in the extends field, as shown below:

.eslintrc.js

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
  extends: [ "@rushstack/eslint-config/profile/node" ],  // <---- put your profile string here
  parserOptions: { tsconfigRootDir: __dirname }
};

The @rushstack/eslint-config ruleset is intended to be used with the Prettier code formatter. For general instructions on setting that up, please refer to the Prettier docs. For Rush-specific settings, see the article Rush: Enabling Prettier.

3. Add any relevant mixins

Optionally, you can add some "mixins" to your extends array to opt-in to some extra behaviors.

Important: Your .eslintrc.js "extends" field must load mixins after the profile entry.

@rushstack/eslint-config/mixins/friendly-locals

Requires explicit type declarations for local variables.

For the first 5 years of Rush, our lint rules required explicit types for most declarations such as function parameters, function return values, and exported variables. Although more verbose, declaring types (instead of relying on type inference) encourages engineers to create interfaces that inspire discussions about data structure design. It also makes source files easier to understand for code reviewers who may be unfamiliar with a particular project. Once developers get used to the extra work of declaring types, it turns out to be a surprisingly popular practice.

However in 2020, to make adoption easier for existing projects, this rule was relaxed. Explicit type declarations are now optional for local variables (although still required in other contexts). See GitHub #2206 for background.

If you are onboarding a large existing code base, this new default will make adoption easier:

Example source file without mixins/friendly-locals:

export class MyDataService {
  . . .
  public queryResult(provider: IProvider): IResult {
    // Type inference is concise, but what are "item", "index", and "data"?
    const item = provider.getItem(provider.title);
    const index = item.fetchIndex();
    const data = index.get(provider.state);
    return data.results.filter(x => x.title === provider.title);
  }
}

On the other hand, if your priority is make source files more friendly for other people to read, you can enable the "@rushstack/eslint-config/mixins/friendly-locals" mixin. This restores the requirement that local variables should have explicit type declarations.

Example source file with mixins/friendly-locals:

export class MyDataService {
  . . .
  public queryResult(provider: IProvider): IResult {
    // This is more work for the person writing the code... but definitely easier to understand
    // for a code reviewer if they are unfamiliar with your project
    const item: ISalesReport = provider.getItem(provider.title);
    const index: Map<string, IGeographicData> = item.fetchIndex();
    const data: IGeographicData | undefined = index.get(provider.state);
    return data.results.filter(x => x.title === provider.title);
  }
}

Add the mixin to your "extends" field like this:

.eslintrc.js

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
  extends: [
    "@rushstack/eslint-config/profile/node",
    "@rushstack/eslint-config/mixins/friendly-locals" // <----
  ],
  parserOptions: { tsconfigRootDir: __dirname }
};

@rushstack/eslint-config/mixins/packlets

Packlets provide a lightweight alternative to NPM packages for organizing source files within a single project. This system is described in the @rushstack/eslint-plugin-packlets documentation.

To use packlets, add the mixin to your "extends" field like this:

.eslintrc.js

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
  extends: [
    "@rushstack/eslint-config/profile/node",
    "@rushstack/eslint-config/mixins/packlets" // <----
  ],
  parserOptions: { tsconfigRootDir: __dirname }
};

@rushstack/eslint-config/mixins/tsdoc

If your project is using API Extractor or another tool that uses the TSDoc standard for doc comments, it's recommended to use the "@rushstack/eslint-config/mixins/tsdoc" mixin. It will enable eslint-plugin-tsdoc validation for TypeScript doc comments.

Add the mixin to your "extends" field like this:

.eslintrc.js

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
  extends: [
    "@rushstack/eslint-config/profile/node",
    "@rushstack/eslint-config/mixins/tsdoc" // <----
  ],
  parserOptions: { tsconfigRootDir: __dirname }
};

@rushstack/eslint-config/mixins/react

For projects using the React library, the "@rushstack/eslint-config/mixins/react" mixin enables some recommended additional rules. These rules are selected via a mixin because they require you to:

  • Add "jsx": "react" to your tsconfig.json
  • Configure your settings.react.version as shown below. This determines which React APIs will be considered to be deprecated. (If you omit this, the React version will be detected automatically by loading the entire React library into the linter's process, which is costly.)

Add the mixin to your "extends" field like this:

.eslintrc.js

// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
  extends: [
    "@rushstack/eslint-config/profile/web-app",
    "@rushstack/eslint-config/mixins/react" // <----
  ],
  parserOptions: { tsconfigRootDir: __dirname },

  settings: {
    react: {
      "version": "16.9" // <----
    }
  }
};

Links

@rushstack/eslint-config is part of the Rush Stack family of projects.

changelog

Change Log - @rushstack/eslint-config

This log was last generated on Tue, 11 Mar 2025 02:12:33 GMT and should not be manually modified.

4.3.0

Tue, 11 Mar 2025 02:12:33 GMT

Minor changes

  • Bump the @typescript-eslint/* packages to add support for TypeScript 5.8.

4.2.0

Sat, 01 Mar 2025 07:23:16 GMT

Minor changes

  • Bump the @typescript-eslint/* dependencies to ~8.24.0 to support newer versions of TypeScript.

4.1.1

Tue, 07 Jan 2025 16:11:06 GMT

Version update only

4.1.0

Sat, 23 Nov 2024 01:18:55 GMT

Minor changes

  • Update TSDoc dependencies.

4.0.2

Thu, 19 Sep 2024 00:11:08 GMT

Patches

  • Fix ESLint broken links

4.0.1

Wed, 14 Aug 2024 22:37:32 GMT

Version update only

4.0.0

Tue, 13 Aug 2024 18:17:05 GMT

Breaking changes

  • [BREAKING CHANGE] Bump "@typescript-eslint/eslint-plugin" to "~8.1.0" and "@typescript-eslint/eslint-parser" to "~8.1.0". Due to these changes, node@>=17.0.0 and eslint@^8.57.0 are now required due to breaking changes in the newer rules set.

3.7.1

Sat, 27 Jul 2024 00:10:27 GMT

Patches

  • Include CHANGELOG.md in published releases again

3.7.0

Wed, 29 May 2024 00:10:52 GMT

Minor changes

  • Bump the eslint-plugin-tsdoc plugin.

3.6.10

Fri, 17 May 2024 00:10:40 GMT

Version update only

3.6.9

Wed, 10 Apr 2024 21:59:39 GMT

Version update only

3.6.8

Fri, 29 Mar 2024 05:46:41 GMT

Version update only

3.6.7

Thu, 28 Mar 2024 18:11:12 GMT

Version update only

3.6.6

Wed, 27 Mar 2024 19:47:21 GMT

Version update only

3.6.5

Wed, 20 Mar 2024 02:09:14 GMT

Version update only

3.6.4

Sat, 17 Feb 2024 06:24:35 GMT

Version update only

3.6.3

Wed, 07 Feb 2024 01:11:18 GMT

Version update only

3.6.2

Thu, 25 Jan 2024 23:03:57 GMT

Version update only

3.6.1

Wed, 24 Jan 2024 07:38:34 GMT

Version update only

3.6.0

Tue, 16 Jan 2024 18:30:10 GMT

Minor changes

  • Add support for TypeScript 5.3 with @typescript-eslint 6.19.x

3.5.1

Fri, 15 Dec 2023 01:10:06 GMT

Version update only

3.5.0

Wed, 22 Nov 2023 01:45:18 GMT

Minor changes

  • Added eslint-bulk-suppressions to @rushstack/eslint-config dependencies, allowing it to be used in all projects that use rushstack's eslint-config

3.4.1

Sun, 01 Oct 2023 02:56:30 GMT

Version update only

3.4.0

Tue, 26 Sep 2023 09:30:33 GMT

Minor changes

  • Add an optional patch which can be used to allow ESLint to extend configurations from packages that do not have the "eslint-config-" prefix

3.3.4

Fri, 15 Sep 2023 00:36:58 GMT

Version update only

3.3.3

Tue, 08 Aug 2023 07:10:39 GMT

Version update only

3.3.2

Thu, 15 Jun 2023 00:21:01 GMT

Version update only

3.3.1

Wed, 07 Jun 2023 22:45:16 GMT

Version update only

3.3.0

Mon, 22 May 2023 06:34:32 GMT

Minor changes

  • Upgrade the @typescript-eslint/* dependencies to ~5.59.2

3.2.0

Fri, 10 Feb 2023 01:18:50 GMT

Minor changes

  • Replace the @typescript-eslint/no-parameter-properties rule with the replacement rule (@typescript-eslint/parameter-properties).

3.1.1

Mon, 10 Oct 2022 15:23:44 GMT

Version update only

3.1.0

Thu, 29 Sep 2022 07:13:06 GMT

Minor changes

  • Upgraded @typescript-eslint dependencies to 5.30.x to enable support for TypeScript 4.8

3.0.1

Thu, 15 Sep 2022 00:18:51 GMT

Version update only

3.0.0

Wed, 03 Aug 2022 18:40:35 GMT

Breaking changes

  • Upgrade TypeScript dependency to 4.7. This package now requires a peerDependency on TypeScript >=4.7

2.6.2

Tue, 28 Jun 2022 00:23:32 GMT

Version update only

2.6.1

Fri, 17 Jun 2022 00:16:18 GMT

Version update only

2.6.0

Sat, 23 Apr 2022 02:13:06 GMT

Minor changes

  • Add support for TypeScript 4.6

2.5.4

Fri, 15 Apr 2022 00:12:36 GMT

Version update only

2.5.3

Sat, 09 Apr 2022 02:24:26 GMT

Patches

  • Rename the "master" branch to "main".

2.5.2

Tue, 15 Mar 2022 19:15:53 GMT

Patches

  • Fix the path in the package.json "directory" field.

2.5.1

Mon, 27 Dec 2021 16:10:40 GMT

Patches

  • Re-enable eslint-plugin-promise rules which now support ESLint v8

2.5.0

Mon, 06 Dec 2021 16:08:32 GMT

Minor changes

2.4.5

Fri, 05 Nov 2021 15:09:18 GMT

Version update only

2.4.4

Wed, 27 Oct 2021 00:08:15 GMT

Patches

  • Update the package.json repository field to include the directory property.

2.4.3

Wed, 13 Oct 2021 15:09:54 GMT

Version update only

2.4.2

Thu, 07 Oct 2021 07:13:35 GMT

Patches

  • Update typescript-eslint to add support for TypeScript 4.4.

2.4.1

Thu, 23 Sep 2021 00:10:40 GMT

Version update only

2.4.0

Mon, 12 Jul 2021 23:08:26 GMT

Minor changes

  • Upgrade @typescript-eslint/* packages to 4.28.0 (GitHub #2389)

2.3.4

Mon, 12 Apr 2021 15:10:28 GMT

Version update only

2.3.3

Tue, 06 Apr 2021 15:14:22 GMT

Patches

  • Switch to range version specifier for Typescript experimental utils

2.3.2

Thu, 10 Dec 2020 23:25:49 GMT

Patches

  • Upgrade to TSDoc 0.12.24

2.3.1

Wed, 11 Nov 2020 01:08:58 GMT

Version update only

2.3.0

Fri, 30 Oct 2020 06:38:38 GMT

Minor changes

  • Exclude *.d.ts from linting
  • Set "root"=true to prevent unintended loading of other ESLint config files found in parent folders (which may be outside the Git working directory)

2.2.3

Fri, 30 Oct 2020 00:10:14 GMT

Patches

  • Update the "modern-module-resolution" patch to support ESLint 7.8.0 and newer

2.2.2

Wed, 28 Oct 2020 01:18:03 GMT

Version update only

2.2.1

Tue, 06 Oct 2020 00:24:06 GMT

Version update only

2.2.0

Mon, 05 Oct 2020 22:36:57 GMT

Minor changes

  • Add a mixin to support @rushstack/eslint-plugin-packlets

2.1.3

Wed, 30 Sep 2020 18:39:17 GMT

Version update only

2.1.2

Wed, 30 Sep 2020 06:53:53 GMT

Patches

  • Update README.md

2.1.1

Tue, 22 Sep 2020 05:45:56 GMT

Patches

  • Fix some missing files that were incorrectly excluded due to .npmignore

2.1.0

Tue, 22 Sep 2020 01:45:31 GMT

Minor changes

  • Relax the "typedef" rule so that type inference is now allowed for local variables, while still requiring explicit type declarations in other scopes

2.0.0

Tue, 22 Sep 2020 00:08:53 GMT

Breaking changes

  • (BREAKING CHANGE) The "@rushstack/eslint-config" entry point has been separated into 3 choices: "@rushstack/eslint-config/profile/node", "@rushstack/eslint-config/profile/node-trusted-tool", or "@rushstack/eslint-config/profile/web-app". See the documentation for details.

1.4.2

Sat, 19 Sep 2020 04:37:26 GMT

Version update only

1.4.1

Sat, 19 Sep 2020 03:33:06 GMT

Patches

  • Add a dependency on the new @rushstack/eslint-plugin-security

1.4.0

Fri, 18 Sep 2020 22:57:24 GMT

Minor changes

  • Remove the @typescript-eslint/array-type rule
  • Add *.spec.ts file extension for tests, since this is also a commonly used convention

Patches

  • Relax @typescript-eslint/no-use-before-define slightly

1.3.0

Thu, 27 Aug 2020 11:27:06 GMT

Minor changes

  • Enable the "@rushstack/hoist-jest-mock" lint rule to catch a common mistake when using Jest with Heft

Patches

  • Add an override to relax some lint rules for *.test.ts files, making unit tests easier to write

1.2.1

Mon, 24 Aug 2020 07:35:20 GMT

Version update only

1.2.0

Sat, 22 Aug 2020 05:55:42 GMT

Minor changes

  • Replace the "@rushstack/no-null" rule with a more flexible rule "@rushstack/no-new-null" (GitHub #2017)

1.1.0

Mon, 17 Aug 2020 04:53:23 GMT

Minor changes

  • Reclassify many lint rules to report ESLint warnings rather than errors

1.0.4

Wed, 12 Aug 2020 00:10:06 GMT

Version update only

1.0.3

Sat, 25 Jul 2020 01:38:03 GMT

Patches

  • Update README.md to add the missing file extension for .eslintrc.js

1.0.2

Thu, 25 Jun 2020 06:43:34 GMT

Patches

  • Enable variableDeclarationIgnoreFunction for the "@typescript-eslint/typedef" rule

1.0.1

Wed, 24 Jun 2020 09:50:48 GMT

Patches

  • Fix an issue with the published file set

1.0.0

Wed, 24 Jun 2020 09:04:28 GMT

Breaking changes

  • Upgrade to ESLint 7. Breaking change: patch-eslint6.js has been renamed to patch-eslint-resolver.js

0.5.8

Wed, 27 May 2020 05:15:10 GMT

Patches

  • Relax "max-lines" lint rule to 2,000 lines instead of 1,000 lines

0.5.7

Wed, 08 Apr 2020 04:07:33 GMT

Patches

  • Improve the error message text for the "ban-types" rule

0.5.6

Sat, 28 Mar 2020 00:37:16 GMT

Patches

  • Upgrade to eslint-plugin-tsdoc version 0.2.4

0.5.5

Wed, 18 Mar 2020 15:07:47 GMT

Version update only

0.5.4

Tue, 21 Jan 2020 21:56:13 GMT

Patches

  • Upgrade eslint-plugin-tsdoc to enable comments in tsdoc.json and more efficient loading

0.5.3

Sun, 19 Jan 2020 02:26:53 GMT

Version update only

0.5.2

Fri, 17 Jan 2020 01:08:23 GMT

Version update only

0.5.1

Thu, 09 Jan 2020 06:44:13 GMT

Version update only

0.5.0

Wed, 08 Jan 2020 00:11:31 GMT

Minor changes

  • Replace "no-restricted-syntax" rule with an equivalent rule "@rushstack/no-null"

0.4.2

Mon, 11 Nov 2019 16:07:56 GMT

Patches

  • Add eslint-plugin-tsdoc; update plugin versions

0.4.1

Tue, 22 Oct 2019 06:24:44 GMT

Patches

  • Update documentation

0.4.0

Tue, 15 Oct 2019 01:22:16 GMT

Minor changes

  • Rename @microsoft/eslint-config-scalable-ts to @rushstack/eslint-config

Patches

  • Upgraded ESLint plugin dependencies

0.3.1

Sun, 29 Sep 2019 23:56:29 GMT

Patches

  • Update repository URL

0.3.0

Wed, 04 Sep 2019 01:43:31 GMT

Minor changes

  • Fix an issue where the @typescript-eslint/array-type rule required a syntax that broke compatibility with TypeScript versions prior to 3.4

0.2.3

Tue, 03 Sep 2019 23:13:45 GMT

Patches

  • Upgrade to @typescript-eslint/eslint-plugin 2.1.0

0.2.2

Tue, 27 Aug 2019 01:48:45 GMT

Patches

  • Remove unused plugin reference

0.2.1

Tue, 27 Aug 2019 01:24:54 GMT

Patches

  • Replace "eslint-plugin-no-null" with a more lenient implementation that allows equality comparisons with "null"

0.2.0

Wed, 21 Aug 2019 21:56:59 GMT

Minor changes

  • Enable react/no-deprecated, react/no-unescaped-entities, and react/self-closing-comp

0.1.2

Fri, 16 Aug 2019 21:58:15 GMT

Patches

  • Relax peer dependency to allow usage with ESLint 5

0.1.1

Fri, 16 Aug 2019 01:15:03 GMT

Patches

  • Fix an issue where @typescript-eslint/no-unused-vars didn't work properly with React source files
  • Relax @typescript-eslint/camelcase to allow "_checkBox1_onChanged"

0.1.0

Thu, 15 Aug 2019 02:56:10 GMT

Minor changes

  • Initial release