Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rushstack/eslint-patch

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/eslint-patch - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

12

CHANGELOG.json

@@ -5,2 +5,14 @@ {

{
"version": "1.0.6",
"tag": "@rushstack/eslint-patch_v1.0.6",
"date": "Fri, 30 Oct 2020 00:10:14 GMT",
"comments": {
"patch": [
{
"comment": "Update the \"modern-module-resolution\" patch to support ESLint 7.8.0 and newer"
}
]
}
},
{
"version": "1.0.5",

@@ -7,0 +19,0 @@ "tag": "@rushstack/eslint-patch_v1.0.5",

9

CHANGELOG.md
# Change Log - @rushstack/eslint-patch
This log was last generated on Wed, 30 Sep 2020 18:39:17 GMT and should not be manually modified.
This log was last generated on Fri, 30 Oct 2020 00:10:14 GMT and should not be manually modified.
## 1.0.6
Fri, 30 Oct 2020 00:10:14 GMT
### Patches
- Update the "modern-module-resolution" patch to support ESLint 7.8.0 and newer
## 1.0.5

@@ -6,0 +13,0 @@ Wed, 30 Sep 2020 18:39:17 GMT

7

lib/modern-module-resolution.d.ts

@@ -1,6 +0,6 @@

/// <reference types="node" />
declare const path: any;
declare const fs: any;
declare let currentModule: NodeModule;
declare const eslintFolder: any;
declare let configArrayFactoryPath: string | undefined;
declare let moduleResolverPath: string | undefined;
declare let eslintFolder: string | undefined;
declare const eslintPackageJson: any;

@@ -11,4 +11,3 @@ declare const eslintPackageObject: any;

declare const eslintMajorVersion: number;
declare const configArrayFactoryPath: any;
declare const ConfigArrayFactory: any;
//# sourceMappingURL=modern-module-resolution.d.ts.map

@@ -12,11 +12,55 @@ "use strict";

const fs = require('fs');
let currentModule = module;
while (!/[\\/]eslint[\\/]lib[\\/]cli-engine[\\/]config-array-factory\.js/i.test(currentModule.filename)) {
// Module path for config-array-factory.js
// Example: ".../@eslint/eslintrc/lib/config-array-factory"
let configArrayFactoryPath = undefined;
// Module path for relative-module-resolver.js
// Example: ".../@eslint/eslintrc/lib/shared/relative-module-resolver"
let moduleResolverPath = undefined;
// Folder path where ESLint's package.json can be found
// Example: ".../node_modules/eslint"
let eslintFolder = undefined;
// Probe for the ESLint >=7.8.0 layout:
for (let currentModule = module;;) {
if (!configArrayFactoryPath) {
// For ESLint >=7.8.0, config-array-factory.js is at this path:
// .../@eslint/eslintrc/lib/config-array-factory.js
if (/[\\/]@eslint[\\/]eslintrc[\\/]lib[\\/]config-array-factory\.js$/i.test(currentModule.filename)) {
const eslintrcFolder = path.join(path.dirname(currentModule.filename), '..');
configArrayFactoryPath = path.join(eslintrcFolder, 'lib/config-array-factory');
moduleResolverPath = path.join(eslintrcFolder, 'lib/shared/relative-module-resolver');
}
}
else {
// Next look for a file in ESLint's folder
// .../eslint/lib/cli-engine/cli-engine.js
if (/[\\/]eslint[\\/]lib[\\/]cli-engine[\\/]cli-engine\.js$/i.test(currentModule.filename)) {
eslintFolder = path.join(path.dirname(currentModule.filename), '../..');
break;
}
}
if (!currentModule.parent) {
// This was tested with ESLint 6.1.0; other versions may not work
throw new Error('Failed to patch ESLint because the calling module was not recognized');
break;
}
currentModule = currentModule.parent;
}
const eslintFolder = path.join(path.dirname(currentModule.filename), '../..');
if (!eslintFolder) {
// Probe for the <7.8.0 layout:
for (let currentModule = module;;) {
// For ESLint <7.8.0, config-array-factory.js was at this path:
// .../eslint/lib/cli-engine/config-array-factory.js
if (/[\\/]eslint[\\/]lib[\\/]cli-engine[\\/]config-array-factory\.js$/i.test(currentModule.filename)) {
eslintFolder = path.join(path.dirname(currentModule.filename), '../..');
configArrayFactoryPath = path.join(eslintFolder, 'lib/cli-engine/config-array-factory');
moduleResolverPath = path.join(eslintFolder, 'lib/shared/relative-module-resolver');
break;
}
if (!currentModule.parent) {
// This was tested with ESLint 6.1.0 .. 7.12.1.
throw new Error('Failed to patch ESLint because the calling module was not recognized.\n' +
'If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:\n' +
'https://github.com/microsoft/rushstack/issues');
}
currentModule = currentModule.parent;
}
}
// Detect the ESLint package version

@@ -32,11 +76,10 @@ const eslintPackageJson = fs.readFileSync(path.join(eslintFolder, 'package.json')).toString();

if (!(eslintMajorVersion >= 6 && eslintMajorVersion <= 7)) {
throw new Error('The patch-eslint.js script has only been tested with ESLint version 6.x or 7.x. (Your version: ' +
eslintPackageVersion +
')');
throw new Error('The patch-eslint.js script has only been tested with ESLint version 6.x or 7.x.' +
` (Your version: ${eslintPackageVersion})\n` +
'Consider reporting a GitHub issue:\n' +
'https://github.com/microsoft/rushstack/issues');
}
const configArrayFactoryPath = path.join(eslintFolder, 'lib/cli-engine/config-array-factory');
const ConfigArrayFactory = require(configArrayFactoryPath).ConfigArrayFactory;
if (!ConfigArrayFactory.__patched) {
ConfigArrayFactory.__patched = true;
const moduleResolverPath = path.join(eslintFolder, 'lib/shared/relative-module-resolver');
const ModuleResolver = require(moduleResolverPath);

@@ -43,0 +86,0 @@ const originalLoadPlugin = ConfigArrayFactory.prototype._loadPlugin;

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

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

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc