Socket
Socket
Sign inDemoInstall

eslint

Package Overview
Dependencies
Maintainers
0
Versions
366
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 9.5.0 to 9.6.0

lib/shared/flags.js

2

conf/ecma-version.js

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

*/
const LATEST_ECMA_VERSION = 2024;
const LATEST_ECMA_VERSION = 2025;

@@ -15,0 +15,0 @@ module.exports = {

@@ -136,3 +136,7 @@ /**

const es2025 = {
...es2024
};
//-----------------------------------------------------------------------------

@@ -155,3 +159,4 @@ // Exports

es2023,
es2024
es2024,
es2025
};

@@ -29,3 +29,3 @@ /**

const { ModuleImporter } = require("@humanwhocodes/module-importer");
const { inactiveFlags, activeFlags } = require("./shared/flags");
const debug = require("debug")("eslint:cli");

@@ -121,2 +121,3 @@

fixType,
flag,
global,

@@ -230,2 +231,3 @@ ignore,

options.warnIgnored = warnIgnored;
options.flags = flag;

@@ -491,4 +493,23 @@ /*

const ActiveESLint = usingFlatConfig ? ESLint : LegacyESLint;
const eslintOptions = await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc");
const engine = new ActiveESLint(await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc"));
if (eslintOptions.flags) {
debug("Checking for inactive flags");
for (const flag of eslintOptions.flags) {
if (inactiveFlags.has(flag)) {
log.warn(`InactiveFlag: The '${flag}' flag is no longer active: ${inactiveFlags.get(flag)}`);
continue;
}
if (activeFlags.has(flag)) {
continue;
}
log.error(`InvalidFlag: The '${flag}' flag is invalid.`);
return 2;
}
}
const engine = new ActiveESLint(eslintOptions);
let results;

@@ -495,0 +516,0 @@

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

fixTypes = null, // ← should be null by default because if it's an array then it suppresses rules that don't have the `meta.type` property.
flags = [],
globInputPaths = true,

@@ -814,2 +815,5 @@ ignore = true,

}
if (!isEmptyArrayOrArrayOfNonEmptyString(flags)) {
errors.push("'flags' must be an array of non-empty strings.");
}
if (typeof globInputPaths !== "boolean") {

@@ -868,2 +872,3 @@ errors.push("'globInputPaths' must be a boolean.");

fixTypes,
flags: [...flags],
globInputPaths,

@@ -870,0 +875,0 @@ ignore,

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

* @property {string[]} [fixTypes] Array of rule types to apply fixes for.
* @property {string[]} [flags] Array of feature flags to enable.
* @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file.

@@ -425,3 +426,4 @@ * @property {boolean} [ignore] False disables all ignore patterns except for the default ones.

const relativeIgnorePath = path.relative(basePath, cwd);
// In minimatch patterns, only `/` can be used as path separator
const relativeIgnorePath = path.relative(basePath, cwd).replaceAll(path.sep, "/");

@@ -598,3 +600,4 @@ relativeIgnorePatterns = ignorePatterns.map(pattern => {

cwd: processedOptions.cwd,
configType: "flat"
configType: "flat",
flags: processedOptions.flags
});

@@ -773,2 +776,13 @@

/**
* Indicates if the given feature flag is enabled for this instance.
* @param {string} flag The feature flag to check.
* @returns {boolean} `true` if the feature flag is enabled, `false` if not.
*/
hasFlag(flag) {
// note: Linter does validation of the flags
return privateMembers.get(this).linter.hasFlag(flag);
}
/**
* Executes the current configuration on an array of file and directory names.

@@ -775,0 +789,0 @@ * @param {string|string[]} patterns An array of file and directory names.

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

fixTypes = null, // ← should be null by default because if it's an array then it suppresses rules that don't have the `meta.type` property.
flags, /* eslint-disable-line no-unused-vars -- leaving for compatibility with ESLint#hasFlag */
globInputPaths = true,

@@ -314,2 +315,3 @@ ignore = true,

fixTypes,
flags: [], // LegacyESLint does not support flags, so just ignore them.
globInputPaths,

@@ -563,3 +565,15 @@ ignore,

/* eslint-disable no-unused-vars, class-methods-use-this -- leaving for compatibility with ESLint#hasFlag */
/**
* Indicates if the given feature flag is enabled for this instance. For this
* class, this always returns `false` because it does not support feature flags.
* @param {string} flag The feature flag to check.
* @returns {boolean} Always false.
*/
hasFlag(flag) {
return false;
}
/* eslint-enable no-unused-vars, class-methods-use-this -- reenable rules for the rest of the file */
/**
* Executes the current configuration on an array of file and directory names.

@@ -566,0 +580,0 @@ * @param {string[]} patterns An array of file and directory names.

@@ -1102,3 +1102,3 @@ /**

* called when ESLint is running with inline configuration allowed.
* @returns {{problems:Array<Problem>,configs:{config:FlatConfigArray,node:ASTNode}}} Information
* @returns {{problems:Array<Problem>,configs:{config:FlatConfigArray,loc:Location}}} Information
* that ESLint needs to further process the inline configuration.

@@ -1151,3 +1151,3 @@ */

case "eslint": {
const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc);
const parseResult = commentParser.parseJsonConfig(directiveValue);

@@ -1159,6 +1159,10 @@ if (parseResult.success) {

},
node: comment
loc: comment.loc
});
} else {
problems.push(parseResult.error);
problems.push({
ruleId: null,
loc: comment.loc,
message: parseResult.error.message
});
}

@@ -1165,0 +1169,0 @@

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

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

@@ -73,6 +67,5 @@ //------------------------------------------------------------------------------

* @param {string} string The string to parse.
* @param {Object} location Start line and column of comments for potential error message.
* @returns {({success: true, config: Object}|{success: false, error: LintMessage})} Result map object
* @returns {({success: true, config: Object}|{success: false, error: {message: string}})} Result map object
*/
parseJsonConfig(string, location) {
parseJsonConfig(string) {
debug("Parsing JSON config");

@@ -120,9 +113,3 @@

error: {
ruleId: null,
fatal: true,
severity: 2,
message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`,
line: location.start.line,
column: location.start.column + 1,
nodeType: null
message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`
}

@@ -129,0 +116,0 @@ };

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

* @property {string[]} [ext] Specify JavaScript file extensions
* @property {string[]} [flag] Feature flags
* @property {boolean} fix Automatically fix problems

@@ -180,2 +181,12 @@ * @property {boolean} fixDryRun Automatically fix problems without saving the changes to the file system

let flagFlag;
if (usingFlatConfig) {
flagFlag = {
option: "flag",
type: "[String]",
description: "Enable a feature flag"
};
}
return optionator({

@@ -429,5 +440,6 @@ prepend: "eslint [options] file.js [file.js] [dir]",

},
statsFlag
statsFlag,
flagFlag
].filter(value => !!value)
});
};

@@ -151,2 +151,32 @@ /**

/**
* Determines what variable type a def is.
* @param {Object} def the declaration to check
* @returns {VariableType} a simple name for the types of variables that this rule supports
*/
function defToVariableType(def) {
/*
* This `destructuredArrayIgnorePattern` error report works differently from the catch
* clause and parameter error reports. _Both_ the `varsIgnorePattern` and the
* `destructuredArrayIgnorePattern` will be checked for array destructuring. However,
* for the purposes of the report, the currently defined behavior is to only inform the
* user of the `destructuredArrayIgnorePattern` if it's present (regardless of the fact
* that the `varsIgnorePattern` would also apply). If it's not present, the user will be
* informed of the `varsIgnorePattern`, assuming that's present.
*/
if (config.destructuredArrayIgnorePattern && def.name.parent.type === "ArrayPattern") {
return "array-destructure";
}
switch (def.type) {
case "CatchClause":
return "catch-clause";
case "Parameter":
return "parameter";
default:
return "variable";
}
}
/**
* Gets a given variable's description and configured ignore pattern

@@ -171,3 +201,3 @@ * based on the provided variableType

pattern = config.caughtErrorsIgnorePattern;
variableDescription = "args";
variableDescription = "caught errors";
break;

@@ -207,25 +237,4 @@

if (def) {
let pattern;
let variableDescription;
const [variableDescription, pattern] = getVariableDescription(defToVariableType(def));
switch (def.type) {
case "CatchClause":
if (config.caughtErrorsIgnorePattern) {
[variableDescription, pattern] = getVariableDescription("catch-clause");
}
break;
case "Parameter":
if (config.argsIgnorePattern) {
[variableDescription, pattern] = getVariableDescription("parameter");
}
break;
default:
if (config.varsIgnorePattern) {
[variableDescription, pattern] = getVariableDescription("variable");
}
break;
}
if (pattern && variableDescription) {

@@ -254,11 +263,4 @@ additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`;

if (def) {
let pattern;
let variableDescription;
const [variableDescription, pattern] = getVariableDescription(defToVariableType(def));
if (def.name.parent.type === "ArrayPattern" && config.destructuredArrayIgnorePattern) {
[variableDescription, pattern] = getVariableDescription("array-destructure");
} else if (config.varsIgnorePattern) {
[variableDescription, pattern] = getVariableDescription("variable");
}
if (pattern && variableDescription) {

@@ -265,0 +267,0 @@ additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`;

@@ -14,3 +14,3 @@ /**

/**
* Cover for console.log
* Cover for console.info
* @param {...any} args The elements to log.

@@ -24,2 +24,11 @@ * @returns {void}

/**
* Cover for console.warn
* @param {...any} args The elements to log.
* @returns {void}
*/
warn(...args) {
console.warn(...args);
},
/**
* Cover for console.error

@@ -26,0 +35,0 @@ * @param {...any} args The elements to log.

@@ -24,3 +24,3 @@ /**

* @property {EcmaFeatures} [ecmaFeatures] The optional features.
* @property {3|5|6|7|8|9|10|11|12|13|14|15|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024} [ecmaVersion] The ECMAScript version (or revision number).
* @property {3|5|6|7|8|9|10|11|12|13|14|15|16|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024|2025} [ecmaVersion] The ECMAScript version (or revision number).
* @property {"script"|"module"} [sourceType] The source code type.

@@ -27,0 +27,0 @@ * @property {boolean} [allowReserved] Allowing the use of reserved words as identifiers in ES3.

{
"name": "eslint",
"version": "9.5.0",
"version": "9.6.0",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",

@@ -71,5 +71,5 @@ "description": "An AST-based pattern checker for JavaScript.",

"@eslint-community/regexpp": "^4.6.1",
"@eslint/config-array": "^0.16.0",
"@eslint/config-array": "^0.17.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "9.5.0",
"@eslint/js": "9.6.0",
"@humanwhocodes/module-importer": "^1.0.1",

@@ -85,3 +85,3 @@ "@humanwhocodes/retry": "^0.3.0",

"eslint-visitor-keys": "^4.0.0",
"espree": "^10.0.1",
"espree": "^10.1.0",
"esquery": "^1.5.0",

@@ -109,3 +109,2 @@ "esutils": "^2.0.2",

"@babel/preset-env": "^7.4.3",
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
"@types/estree": "^1.0.5",

@@ -116,3 +115,2 @@ "@types/node": "^20.11.5",

"@wdio/concise-reporter": "^8.38.2",
"@wdio/globals": "^8.38.2",
"@wdio/mocha-framework": "^8.38.2",

@@ -129,7 +127,4 @@ "babel-loader": "^8.0.5",

"eslint-plugin-eslint-plugin": "^6.0.0",
"eslint-plugin-internal-rules": "file:tools/internal-rules",
"eslint-plugin-jsdoc": "^48.2.3",
"eslint-plugin-n": "^17.2.0",
"eslint-plugin-unicorn": "^52.0.0",
"eslint-release": "^3.2.2",
"eslint-rule-composer": "^0.3.0",
"eslump": "^3.0.0",

@@ -144,3 +139,3 @@ "esprima": "^4.0.1",

"js-yaml": "^4.1.0",
"knip": "^5.8.0",
"knip": "^5.21.0",
"lint-staged": "^11.0.0",

@@ -147,0 +142,0 @@ "load-perf": "^0.2.0",

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

<h3>Platinum Sponsors</h3>
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
<p><a href="#"><img src="https://images.opencollective.com/guest-bf377e88/avatar.png" alt="Eli Schleifer" height="96"></a> <a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="undefined"></a></p><h3>Gold Sponsors</h3>
<p><a href="#"><img src="https://images.opencollective.com/guest-bf377e88/avatar.png" alt="Eli Schleifer" height="96"></a> <a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" 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> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>

@@ -301,0 +301,0 @@ <p><a href="https://www.notion.so"><img src="https://images.opencollective.com/notion/bf3b117/logo.png" alt="notion" 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" 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://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" 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://usenextbase.com"><img src="https://avatars.githubusercontent.com/u/145838380?v=4" alt="Nextbase Starter Kit" height="32"></a></p>

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