Socket
Socket
Sign inDemoInstall

@rushstack/eslint-patch

Package Overview
Dependencies
0
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.1 to 1.6.0

eslint-bulk-suppressions.js

3

lib/_patch-base.d.ts
declare const isModuleResolutionError: (ex: unknown) => boolean;
declare let eslintFolder: string | undefined;
declare const eslintMajorVersion: number;

@@ -10,3 +11,3 @@ declare let ConfigArrayFactory: any;

};
export { ConfigArrayFactory, ModuleResolver, Naming, eslintMajorVersion as ESLINT_MAJOR_VERSION, isModuleResolutionError };
export { eslintFolder, ConfigArrayFactory, ModuleResolver, Naming, eslintMajorVersion as ESLINT_MAJOR_VERSION, isModuleResolutionError };
//# sourceMappingURL=_patch-base.d.ts.map

@@ -5,3 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.isModuleResolutionError = exports.ESLINT_MAJOR_VERSION = exports.Naming = exports.ModuleResolver = exports.ConfigArrayFactory = void 0;
exports.isModuleResolutionError = exports.ESLINT_MAJOR_VERSION = exports.Naming = exports.ModuleResolver = exports.ConfigArrayFactory = exports.eslintFolder = void 0;
// This is a workaround for https://github.com/eslint/eslint/issues/3458

@@ -32,2 +32,3 @@ //

let eslintFolder = undefined;
exports.eslintFolder = eslintFolder;
// Probe for the ESLint >=8.0.0 layout:

@@ -68,3 +69,3 @@ for (let currentModule = module;;) {

if (currentModule.filename.startsWith(eslintCandidateFolder + path.sep)) {
eslintFolder = eslintCandidateFolder;
exports.eslintFolder = eslintFolder = eslintCandidateFolder;
break;

@@ -121,3 +122,3 @@ }

if (path.join(eslintCandidateFolder, 'lib/cli-engine/cli-engine.js') == currentModule.filename) {
eslintFolder = eslintCandidateFolder;
exports.eslintFolder = eslintFolder = eslintCandidateFolder;
break;

@@ -147,3 +148,3 @@ }

if (/[\\/]eslint[\\/]lib[\\/]cli-engine[\\/]config-array-factory\.js$/i.test(currentModule.filename)) {
eslintFolder = path.join(path.dirname(currentModule.filename), '../..');
exports.eslintFolder = eslintFolder = path.join(path.dirname(currentModule.filename), '../..');
configArrayFactoryPath = `${eslintFolder}/lib/cli-engine/config-array-factory`;

@@ -150,0 +151,0 @@ moduleResolverPath = `${eslintFolder}/lib/shared/relative-module-resolver`;

{
"name": "@rushstack/eslint-patch",
"version": "1.5.1",
"version": "1.6.0",
"description": "A patch that improves how ESLint loads plugins when working in a monorepo with a reusable toolchain",

@@ -26,3 +26,5 @@ "main": "lib/usage.js",

"@rushstack/heft-node-rig": "2.3.2",
"@types/node": "18.17.15"
"@types/node": "18.17.15",
"typescript": "~5.0.4",
"@typescript-eslint/types": "~5.59.2"
},

@@ -29,0 +31,0 @@ "scripts": {

@@ -5,2 +5,3 @@ # @rushstack/eslint-patch

# modern-module-resolution

@@ -81,5 +82,78 @@ ## What it does

# eslint-bulk-suppressions
## Links
A tool that allows bulk suppression of ESLint warnings/errors in a large, old codebase when introducing new ESLint rules.
## What it does
This tool is designed to address the issue of introducing new ESLint rules to a large, old codebase, which often
results in hundreds to tens of thousands of retroactive issues being reported by ESLint. This can clutter the
ESLint output, making it difficult to read and potentially causing developers to overlook new ESLint issues. It
also makes it impractical to use merge request pipelines that block ESLint warnings/errors.
The tool provides a mechanism for recording all retroactively introduced ESLint warnings/errors in a
"bulk suppressions" file, hiding them from the ESLint output. This allows developers to still get most of the
benefits of ESLint, as any new code written will be annotated by ESLint and can be fixed in bite-sized portions.
It also allows the use of merge request pipelines to block newly written error-prone code without blocking legacy
code that has been battle-tested.
## Why it's a patch
The bulk suppressions feature is implemented as a monkey-patch, inspired by the modern-module-resolution
implementation. We prefer it as a patch because it allows users to opt-in to using the tool at their own discretion.
Similar to modern-module-resolution, the use case is much more pronounced in large codebases where ESLint
warnings/errors can appear at magnitudes of thousands rather than tens. Besides reducing bundle size, this also
allows us to gauge interest in this tool.
This approach inevitably results in forwards compatibility issues with versions of ESLint. The patch has
some logic to determine which version of ESLint you're using and uses the corresponding patch file.
## How to use it
To use the tool, you need to add a `require()` call to the top of the **.eslintrc.js** file for each project
that you want to use the tool with, for example:
**.eslintrc.js**
```js
require("@rushstack/eslint-patch/eslint-bulk-suppressions");
module.exports = {
rules: {
rule1: 'error',
rule2: 'warning'
},
parserOptions: { tsconfigRootDir: __dirname }
};
```
We also highly recommend globally installing the companion CLI tool to your local system with
```bash
npm i -g @rushstack/eslint-bulk
```
The **eslint-bulk** package is a set of command line tools to use with the ESLint bulk suppressions patch.
eslint-bulk commands must be run in the same current working directory containing your package's pertaining
.eslintrc.js or .eslintrc.cjs file.
## eslint-bulk suppress
Use this command to automatically generate bulk suppressions for the given files and given rules.
Supply the paths as the main argument. The paths argument is a glob pattern that follows the same
rules as the "files" argument in the "eslint" command.
```bash
eslint-bulk suppress --rule NAME1 [--rule NAME2...] PATH1 [PATH2...]
eslint-bulk suppress --all PATH1 [PATH2...]
```
## eslint-bulk prune
Use this command to automatically delete all unused suppression entries in all .eslint-bulk-suppressions.json
files under the current working directory.
```bash
eslint-bulk prune
```
# Links
- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/eslint/eslint-patch/CHANGELOG.md) - Find

@@ -86,0 +160,0 @@ out what's new in the latest version

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc