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

eslint

Package Overview
Dependencies
Maintainers
4
Versions
373
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint - npm Package Compare versions

Comparing version 8.40.0 to 8.41.0

4

lib/cli-engine/cli-engine.js

@@ -311,5 +311,7 @@ /**

{
ruleId: null,
fatal: false,
severity: 1,
message
message,
nodeType: null
}

@@ -316,0 +318,0 @@ ],

@@ -22,3 +22,3 @@ /**

{ ESLint } = require("./eslint"),
{ FlatESLint } = require("./eslint/flat-eslint"),
{ FlatESLint, shouldUseFlatConfig } = require("./eslint/flat-eslint"),
createCLIOptions = require("./options"),

@@ -28,3 +28,2 @@ log = require("./shared/logging"),

const { Legacy: { naming } } = require("@eslint/eslintrc");
const { findFlatConfigFile } = require("./eslint/flat-eslint");
const { ModuleImporter } = require("@humanwhocodes/module-importer");

@@ -280,27 +279,2 @@

/**
* Returns whether flat config should be used.
* @param {boolean} [allowFlatConfig] Whether or not to allow flat config.
* @returns {Promise<boolean>} Where flat config should be used.
*/
async function shouldUseFlatConfig(allowFlatConfig) {
if (!allowFlatConfig) {
return false;
}
switch (process.env.ESLINT_USE_FLAT_CONFIG) {
case "true":
return true;
case "false":
return false;
default:
/*
* If neither explicitly enabled nor disabled, then use the presence
* of a flat config file to determine enablement.
*/
return !!(await findFlatConfigFile(process.cwd()));
}
}
//------------------------------------------------------------------------------

@@ -335,3 +309,3 @@ // Public Interface

const usingFlatConfig = await shouldUseFlatConfig(allowFlatConfig);
const usingFlatConfig = allowFlatConfig && await shouldUseFlatConfig();

@@ -338,0 +312,0 @@ debug("Using flat config?", usingFlatConfig);

@@ -51,3 +51,3 @@ /**

ignores: [
"**/node_modules/*",
"**/node_modules/",
".git/"

@@ -54,0 +54,0 @@ ]

@@ -594,10 +594,6 @@ /**

let message;
const isHidden = filePath.split(path.sep)
.find(segment => /^\./u.test(segment));
const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules");
if (isHidden) {
message = "File ignored by default. Use a negated ignore pattern (like \"--ignore-pattern '!<relative/path/to/filename>'\") to override.";
} else if (isInNodeModules) {
message = "File ignored by default. Use \"--ignore-pattern '!node_modules/*'\" to override.";
if (isInNodeModules) {
message = "File ignored by default because it is located under the node_modules directory. Use ignore pattern \"!**/node_modules/\" to override.";
} else {

@@ -611,5 +607,7 @@ message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.";

{
ruleId: null,
fatal: false,
severity: 1,
message
message,
nodeType: null
}

@@ -763,2 +761,5 @@ ],

}
if (!isArrayOfNonEmptyString(ignorePatterns) && ignorePatterns !== null) {
errors.push("'ignorePatterns' must be an array of non-empty strings or null.");
}
if (typeof overrideConfig !== "object") {

@@ -765,0 +766,0 @@ errors.push("'overrideConfig' must be an object or null.");

@@ -58,2 +58,3 @@ /**

/** @typedef {import("../shared/types").LintMessage} LintMessage */
/** @typedef {import("../shared/types").LintResult} LintResult */
/** @typedef {import("../shared/types").ParserOptions} ParserOptions */

@@ -80,3 +81,3 @@ /** @typedef {import("../shared/types").Plugin} Plugin */

* @property {boolean} [ignore] False disables all ignore patterns except for the default ones.
* @property {string[]} [ignorePatterns] Ignore file patterns to use in addition to config ignores.
* @property {string[]} [ignorePatterns] Ignore file patterns to use in addition to config ignores. These patterns are relative to `cwd`.
* @property {ConfigData} [overrideConfig] Override config object, overrides all configs used with this instance

@@ -266,3 +267,3 @@ * @property {boolean|string} [overrideConfigFile] Searches for default config file when falsy;

* @param {string} cwd The current working directory to search from.
* @returns {Promise<string|null>} The filename if found or `null` if not.
* @returns {Promise<string|undefined>} The filename if found or `undefined` if not.
*/

@@ -332,3 +333,3 @@ function findFlatConfigFile(cwd) {

* @param {import("./eslint").ESLintOptions} options The ESLint instance options.
* @returns {{configFilePath:string,basePath:string,error:boolean}} Location information for
* @returns {{configFilePath:string|undefined,basePath:string,error:Error|null}} Location information for
* the config file.

@@ -341,3 +342,3 @@ */

let basePath = cwd;
let error = false;
let error = null;

@@ -354,3 +355,3 @@ if (typeof configFile === "string") {

} else {
error = true;
error = new Error("Could not find config file.");
}

@@ -394,3 +395,3 @@

if (error) {
throw new Error("Could not find config file.");
throw error;
}

@@ -414,35 +415,29 @@

let allIgnorePatterns = [];
// append command line ignore patterns
if (ignorePatterns && ignorePatterns.length > 0) {
// append command line ignore patterns
if (ignorePatterns) {
if (typeof ignorePatterns === "string") {
allIgnorePatterns.push(ignorePatterns);
let relativeIgnorePatterns;
/*
* If the config file basePath is different than the cwd, then
* the ignore patterns won't work correctly. Here, we adjust the
* ignore pattern to include the correct relative path. Patterns
* passed as `ignorePatterns` are relative to the cwd, whereas
* the config file basePath can be an ancestor of the cwd.
*/
if (basePath === cwd) {
relativeIgnorePatterns = ignorePatterns;
} else {
allIgnorePatterns.push(...ignorePatterns);
}
}
/*
* If the config file basePath is different than the cwd, then
* the ignore patterns won't work correctly. Here, we adjust the
* ignore pattern to include the correct relative path. Patterns
* loaded from ignore files are always relative to the cwd, whereas
* the config file basePath can be an ancestor of the cwd.
*/
if (basePath !== cwd && allIgnorePatterns.length) {
const relativeIgnorePath = path.relative(basePath, cwd);
const relativeIgnorePath = path.relative(basePath, cwd);
relativeIgnorePatterns = ignorePatterns.map(pattern => {
const negated = pattern.startsWith("!");
const basePattern = negated ? pattern.slice(1) : pattern;
allIgnorePatterns = allIgnorePatterns.map(pattern => {
const negated = pattern.startsWith("!");
const basePattern = negated ? pattern.slice(1) : pattern;
return (negated ? "!" : "") +
return (negated ? "!" : "") +
path.posix.join(relativeIgnorePath, basePattern);
});
}
});
}
if (allIgnorePatterns.length) {
/*

@@ -453,3 +448,3 @@ * Ignore patterns are added to the end of the config array

configs.push({
ignores: allIgnorePatterns
ignores: relativeIgnorePatterns
});

@@ -1224,2 +1219,22 @@ }

/**
* Returns whether flat config should be used.
* @returns {Promise<boolean>} Whether flat config should be used.
*/
async function shouldUseFlatConfig() {
switch (process.env.ESLINT_USE_FLAT_CONFIG) {
case "true":
return true;
case "false":
return false;
default:
/*
* If neither explicitly enabled nor disabled, then use the presence
* of a flat config file to determine enablement.
*/
return !!(await findFlatConfigFile(process.cwd()));
}
}
//------------------------------------------------------------------------------

@@ -1231,3 +1246,3 @@ // Public Interface

FlatESLint,
findFlatConfigFile
shouldUseFlatConfig
};

@@ -8,2 +8,12 @@ /**

//------------------------------------------------------------------------------
// Typedefs
//------------------------------------------------------------------------------
/** @typedef {import("../shared/types").LintMessage} LintMessage */
//------------------------------------------------------------------------------
// Module Definition
//------------------------------------------------------------------------------
const escapeRegExp = require("escape-string-regexp");

@@ -200,3 +210,3 @@

* (this function always reports unused disable directives).
* @returns {{problems: Problem[], unusedDisableDirectives: Problem[]}} An object with a list
* @returns {{problems: LintMessage[], unusedDisableDirectives: LintMessage[]}} An object with a list
* of problems (including suppressed ones) and unused eslint-disable directives

@@ -203,0 +213,0 @@ */

@@ -23,2 +23,8 @@ /**

//------------------------------------------------------------------------------
// Typedefs
//------------------------------------------------------------------------------
/** @typedef {import("../shared/types").LintMessage} LintMessage */
//------------------------------------------------------------------------------
// Public Interface

@@ -65,3 +71,3 @@ //------------------------------------------------------------------------------

* @param {Object} location Start line and column of comments for potential error message.
* @returns {({success: true, config: Object}|{success: false, error: Problem})} Result map object
* @returns {({success: true, config: Object}|{success: false, error: LintMessage})} Result map object
*/

@@ -114,3 +120,4 @@ parseJsonConfig(string, location) {

line: location.start.line,
column: location.start.column + 1
column: location.start.column + 1,
nodeType: null
}

@@ -117,0 +124,0 @@ };

@@ -20,2 +20,4 @@ /**

/** @typedef {import("../shared/types").LintMessage} LintMessage */
/**

@@ -33,19 +35,2 @@ * An error message description

/**
* Information about the report
* @typedef {Object} ReportInfo
* @property {string} ruleId The rule ID
* @property {(0|1|2)} severity Severity of the error
* @property {(string|undefined)} message The message
* @property {(string|undefined)} [messageId] The message ID
* @property {number} line The line number
* @property {number} column The column number
* @property {(number|undefined)} [endLine] The ending line number
* @property {(number|undefined)} [endColumn] The ending column number
* @property {(string|null)} nodeType Type of node
* @property {string} source Source text
* @property {({text: string, range: (number[]|null)}|null)} [fix] The fix object
* @property {Array<{text: string, range: (number[]|null)}|null>} [suggestions] Suggestion info
*/
//------------------------------------------------------------------------------

@@ -244,3 +229,3 @@ // Module Definition

* @param {Array<{text: string, range: (number[]|null)}>} options.suggestions The array of suggestions objects
* @returns {function(...args): ReportInfo} Function that returns information about the report
* @returns {LintMessage} Information about the report
*/

@@ -320,3 +305,3 @@ function createProblem(options) {

* @param {SourceCode} sourceCode The `SourceCode` instance for the text being linted
* @returns {function(...args): ReportInfo} Function that returns information about the report
* @returns {function(...args): LintMessage} Function that returns information about the report
*/

@@ -323,0 +308,0 @@

@@ -12,3 +12,3 @@ /**

const GraphemeSplitter = require("grapheme-splitter");
const Graphemer = require("graphemer").default;

@@ -22,3 +22,3 @@ //------------------------------------------------------------------------------

/** @type {GraphemeSplitter | undefined} */
/** @type {Graphemer | undefined} */
let splitter;

@@ -53,3 +53,3 @@

if (!splitter) {
splitter = new GraphemeSplitter();
splitter = new Graphemer();
}

@@ -56,0 +56,0 @@

@@ -99,6 +99,8 @@ /**

* @property {number} [endLine] The 1-based line number of the end location.
* @property {boolean} fatal If `true` then this is a fatal error.
* @property {boolean} [fatal] If `true` then this is a fatal error.
* @property {{range:[number,number], text:string}} [fix] Information for autofix.
* @property {number|undefined} line The 1-based line number.
* @property {string} message The error message.
* @property {string} [messageId] The ID of the message in the rule's meta.
* @property {(string|null)} nodeType Type of node
* @property {string|null} ruleId The ID of the rule which makes this message.

@@ -114,6 +116,8 @@ * @property {0|1|2} severity The severity of this message.

* @property {number} [endLine] The 1-based line number of the end location.
* @property {boolean} fatal If `true` then this is a fatal error.
* @property {boolean} [fatal] If `true` then this is a fatal error.
* @property {{range:[number,number], text:string}} [fix] Information for autofix.
* @property {number|undefined} line The 1-based line number.
* @property {string} message The error message.
* @property {string} [messageId] The ID of the message in the rule's meta.
* @property {(string|null)} nodeType Type of node
* @property {string|null} ruleId The ID of the rule which makes this message.

@@ -120,0 +124,0 @@ * @property {0|1|2} severity The severity of this message.

@@ -15,3 +15,3 @@ /**

const { FileEnumerator } = require("./cli-engine/file-enumerator");
const { FlatESLint } = require("./eslint/flat-eslint");
const { FlatESLint, shouldUseFlatConfig } = require("./eslint/flat-eslint");
const FlatRuleTester = require("./rule-tester/flat-rule-tester");

@@ -26,4 +26,5 @@

FlatESLint,
shouldUseFlatConfig,
FlatRuleTester,
FileEnumerator
};
{
"name": "eslint",
"version": "8.40.0",
"version": "8.41.0",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",

@@ -66,3 +66,3 @@ "description": "An AST-based pattern checker for JavaScript.",

"@eslint/eslintrc": "^2.0.3",
"@eslint/js": "8.40.0",
"@eslint/js": "8.41.0",
"@humanwhocodes/config-array": "^0.11.8",

@@ -87,3 +87,3 @@ "@humanwhocodes/module-importer": "^1.0.1",

"globals": "^13.19.0",
"grapheme-splitter": "^1.0.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.0",

@@ -94,3 +94,2 @@ "import-fresh": "^3.0.0",

"is-path-inside": "^3.0.3",
"js-sdsl": "^4.1.4",
"js-yaml": "^4.1.0",

@@ -97,0 +96,0 @@ "json-stable-stringify-without-jsonify": "^1.0.1",

@@ -287,3 +287,3 @@ [![npm version](https://img.shields.io/npm/v/eslint.svg)](https://www.npmjs.com/package/eslint)

<p><a href="https://sentry.io"><img src="https://avatars.githubusercontent.com/u/1396951?v=4" alt="Sentry" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://paydaysay.com/"><img src="https://images.opencollective.com/payday-say-organization/9cd2467/logo.png" alt="PayDay Say" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
<p><a href="https://www.vedonlyontibonukset.com/pitkavetovihjeet"><img src="https://images.opencollective.com/pitkavetovihjeet/0131f1d/logo.png" alt="Ilmaiset Pitkävetovihjeet" height="32"></a> <a href="https://paydaysay.com/"><img src="https://images.opencollective.com/payday-say-organization/9cd2467/logo.png" alt="PayDay Say" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
<!--sponsorsend-->

@@ -290,0 +290,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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