Socket
Socket
Sign inDemoInstall

eslint

Package Overview
Dependencies
Maintainers
4
Versions
365
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.31.0 to 8.42.0

lib/rules/utils/regular-expressions.js

4

conf/rule-type-list.json

@@ -9,3 +9,3 @@ {

"name": "Deprecated",
"description": "These rules have been deprecated in accordance with the <a href=\"/docs/user-guide/rule-deprecation\">deprecation policy</a>, and replaced by newer rules:",
"description": "These rules have been deprecated in accordance with the <a href=\"{{ '/use/rule-deprecation' | url }}\">deprecation policy</a>, and replaced by newer rules:",
"rules": []

@@ -15,3 +15,3 @@ },

"name": "Removed",
"description": "These rules from older versions of ESLint (before the <a href=\"/docs/user-guide/rule-deprecation\">deprecation policy</a> existed) have been replaced by newer rules:",
"description": "These rules from older versions of ESLint (before the <a href=\"{{ '/use/rule-deprecation' | url }}\">deprecation policy</a> existed) have been replaced by newer rules:",
"rules": [

@@ -18,0 +18,0 @@ { "removed": "generator-star", "replacedBy": ["generator-star-spacing"] },

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

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

@@ -619,4 +621,4 @@ ],

loadRules,
getEslintRecommendedConfig: () => require("../../conf/eslint-recommended.js"),
getEslintAllConfig: () => require("../../conf/eslint-all.js")
getEslintRecommendedConfig: () => require("@eslint/js").configs.recommended,
getEslintAllConfig: () => require("@eslint/js").configs.all
});

@@ -623,0 +625,0 @@ const fileEnumerator = new FileEnumerator({

@@ -220,4 +220,4 @@ /**

cwd,
getEslintRecommendedConfig: () => require("../../conf/eslint-recommended.js"),
getEslintAllConfig: () => require("../../conf/eslint-all.js")
getEslintRecommendedConfig: () => require("@eslint/js").configs.recommended,
getEslintAllConfig: () => require("@eslint/js").configs.all
}),

@@ -353,3 +353,3 @@ extensions = null,

if (globInputPaths && isGlobPattern(pattern)) {
return this._iterateFilesWithGlob(absolutePath, isDot);
return this._iterateFilesWithGlob(pattern, isDot);
}

@@ -403,4 +403,6 @@

const directoryPath = path.resolve(getGlobParent(pattern));
const globPart = pattern.slice(directoryPath.length + 1);
const { cwd } = internalSlotsMap.get(this);
const directoryPath = path.resolve(cwd, getGlobParent(pattern));
const absolutePath = path.resolve(cwd, pattern);
const globPart = absolutePath.slice(directoryPath.length + 1);

@@ -412,3 +414,3 @@ /*

const recursive = /\*\*|\/|\\/u.test(globPart);
const selector = new Minimatch(pattern, minimatchOpts);
const selector = new Minimatch(absolutePath, minimatchOpts);

@@ -415,0 +417,0 @@ debug(`recursive? ${recursive}`);

@@ -20,7 +20,7 @@ [

"name": "json-with-metadata",
"description": "Outputs JSON-serialized results. The `json-with-metadata` provides the same linting results as the [`json`](#json) formatter with additional metadata about the rules applied. The linting results are included in the `results` property and the rules metadata is included in the `metadata` property.\n\nAlternatively, you can use the [ESLint Node.js API](../../developer-guide/nodejs-api) to programmatically use ESLint."
"description": "Outputs JSON-serialized results. The `json-with-metadata` provides the same linting results as the [`json`](#json) formatter with additional metadata about the rules applied. The linting results are included in the `results` property and the rules metadata is included in the `metadata` property.\n\nAlternatively, you can use the [ESLint Node.js API](../../integrate/nodejs-api) to programmatically use ESLint."
},
{
"name": "json",
"description": "Outputs JSON-serialized results. The `json` formatter is useful when you want to programmatically work with the CLI's linting results.\n\nAlternatively, you can use the [ESLint Node.js API](../../developer-guide/nodejs-api) to programmatically use ESLint."
"description": "Outputs JSON-serialized results. The `json` formatter is useful when you want to programmatically work with the CLI's linting results.\n\nAlternatively, you can use the [ESLint Node.js API](../../integrate/nodejs-api) to programmatically use ESLint."
},

@@ -27,0 +27,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);

@@ -22,5 +22,2 @@ /**

"@": {
parsers: {
espree: require("espree")
},

@@ -47,3 +44,3 @@ /*

ecmaVersion: "latest",
parser: "@/espree",
parser: require("espree"),
parserOptions: {}

@@ -56,3 +53,3 @@ }

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

@@ -59,0 +56,0 @@ ]

@@ -16,3 +16,3 @@ /**

const { defaultConfig } = require("./default-config");
const recommendedConfig = require("../../conf/eslint-recommended");
const jsPlugin = require("@eslint/js");

@@ -40,2 +40,41 @@ //-----------------------------------------------------------------------------

/**
* Returns the name of an object in the config by reading its `meta` key.
* @param {Object} object The object to check.
* @returns {string?} The name of the object if found or `null` if there
* is no name.
*/
function getObjectId(object) {
// first check old-style name
let name = object.name;
if (!name) {
if (!object.meta) {
return null;
}
name = object.meta.name;
if (!name) {
return null;
}
}
// now check for old-style version
let version = object.version;
if (!version) {
version = object.meta && object.meta.version;
}
// if there's a version then append that
if (version) {
return `${name}@${version}`;
}
return name;
}
const originalBaseConfig = Symbol("originalBaseConfig");

@@ -101,3 +140,9 @@

if (config === "eslint:recommended") {
return recommendedConfig;
// if we are in a Node.js environment warn the user
if (typeof process !== "undefined" && process.emitWarning) {
process.emitWarning("The 'eslint:recommended' string configuration is deprecated and will be replaced by the @eslint/js package's 'recommended' config.");
}
return jsPlugin.configs.recommended;
}

@@ -107,8 +152,8 @@

/*
* Load `eslint-all.js` here instead of at the top level to avoid loading all rule modules
* when it isn't necessary. `eslint-all.js` reads `meta` of rule objects to filter out deprecated ones,
* so requiring `eslint-all.js` module loads all rule modules as a consequence.
*/
return require("../../conf/eslint-all");
// if we are in a Node.js environment warn the user
if (typeof process !== "undefined" && process.emitWarning) {
process.emitWarning("The 'eslint:all' string configuration is deprecated and will be replaced by the @eslint/js package's 'all' config.");
}
return jsPlugin.configs.all;
}

@@ -152,12 +197,11 @@

if (languageOptions && languageOptions.parser) {
if (typeof languageOptions.parser === "string") {
const { pluginName, objectName: localParserName } = splitPluginIdentifier(languageOptions.parser);
const { parser } = languageOptions;
parserName = languageOptions.parser;
if (typeof parser === "object") {
parserName = getObjectId(parser);
if (!plugins || !plugins[pluginName] || !plugins[pluginName].parsers || !plugins[pluginName].parsers[localParserName]) {
throw new TypeError(`Key "parser": Could not find "${localParserName}" in plugin "${pluginName}".`);
if (!parserName) {
invalidParser = true;
}
languageOptions.parser = plugins[pluginName].parsers[localParserName];
} else {

@@ -180,2 +224,9 @@ invalidParser = true;

config.processor = plugins[pluginName].processors[localProcessorName];
} else if (typeof processor === "object") {
processorName = getObjectId(processor);
if (!processorName) {
invalidProcessor = true;
}
} else {

@@ -194,7 +245,7 @@ invalidProcessor = true;

if (invalidParser) {
throw new Error("Caching is not supported when parser is an object.");
throw new Error("Could not serialize parser object (missing 'meta' object).");
}
if (invalidProcessor) {
throw new Error("Caching is not supported when processor is an object.");
throw new Error("Could not serialize processor object (missing 'meta' object).");
}

@@ -204,3 +255,12 @@

...this,
plugins: Object.keys(plugins),
plugins: Object.entries(plugins).map(([namespace, plugin]) => {
const pluginId = getObjectId(plugin);
if (!pluginId) {
return namespace;
}
return `${namespace}:${pluginId}`;
}),
languageOptions: {

@@ -207,0 +267,0 @@ ...languageOptions,

@@ -130,11 +130,27 @@ /**

/**
* The error type when a rule's options are configured with an invalid type.
*/
class InvalidRuleOptionsError extends Error {
/**
* @param {string} ruleId Rule name being configured.
* @param {any} value The invalid value.
*/
constructor(ruleId, value) {
super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`);
this.messageTemplate = "invalid-rule-options";
this.messageData = { ruleId, value };
}
}
/**
* Validates that a value is a valid rule options entry.
* @param {string} ruleId Rule name being configured.
* @param {any} value The value to check.
* @returns {void}
* @throws {TypeError} If the value isn't a valid rule options.
* @throws {InvalidRuleOptionsError} If the value isn't a valid rule options.
*/
function assertIsRuleOptions(value) {
function assertIsRuleOptions(ruleId, value) {
if (typeof value !== "string" && typeof value !== "number" && !Array.isArray(value)) {
throw new TypeError("Expected a string, number, or array.");
throw new InvalidRuleOptionsError(ruleId, value);
}

@@ -144,8 +160,25 @@ }

/**
* The error type when a rule's severity is invalid.
*/
class InvalidRuleSeverityError extends Error {
/**
* @param {string} ruleId Rule name being configured.
* @param {any} value The invalid value.
*/
constructor(ruleId, value) {
super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`);
this.messageTemplate = "invalid-rule-severity";
this.messageData = { ruleId, value };
}
}
/**
* Validates that a value is valid rule severity.
* @param {string} ruleId Rule name being configured.
* @param {any} value The value to check.
* @returns {void}
* @throws {TypeError} If the value isn't a valid rule severity.
* @throws {InvalidRuleSeverityError} If the value isn't a valid rule severity.
*/
function assertIsRuleSeverity(value) {
function assertIsRuleSeverity(ruleId, value) {
const severity = typeof value === "string"

@@ -156,3 +189,3 @@ ? ruleSeverities.get(value.toLowerCase())

if (typeof severity === "undefined") {
throw new TypeError("Expected severity of \"off\", 0, \"warn\", 1, \"error\", or 2.");
throw new InvalidRuleSeverityError(ruleId, value);
}

@@ -185,14 +218,2 @@ }

/**
* Validates that a value is an object or a string.
* @param {any} value The value to check.
* @returns {void}
* @throws {TypeError} If the value isn't an object or a string.
*/
function assertIsObjectOrString(value) {
if ((!value || typeof value !== "object") && typeof value !== "string") {
throw new TypeError("Expected an object or string.");
}
}
//-----------------------------------------------------------------------------

@@ -249,11 +270,9 @@ // Low-Level Schemas

validate(value) {
assertIsObjectOrString(value);
if (typeof value === "object" && typeof value.parse !== "function" && typeof value.parseForESLint !== "function") {
throw new TypeError("Expected object to have a parse() or parseForESLint() method.");
if (!value || typeof value !== "object" ||
(typeof value.parse !== "function" && typeof value.parseForESLint !== "function")
) {
throw new TypeError("Expected object with parse() or parseForESLint() method.");
}
if (typeof value === "string") {
assertIsPluginMemberName(value);
}
}

@@ -379,35 +398,24 @@ };

let lastRuleId;
/*
* We are not checking the rule schema here because there is no
* guarantee that the rule definition is present at this point. Instead
* we wait and check the rule schema during the finalization step
* of calculating a config.
*/
for (const ruleId of Object.keys(value)) {
// Performance: One try-catch has less overhead than one per loop iteration
try {
// avoid hairy edge case
if (ruleId === "__proto__") {
continue;
}
/*
* We are not checking the rule schema here because there is no
* guarantee that the rule definition is present at this point. Instead
* we wait and check the rule schema during the finalization step
* of calculating a config.
*/
for (const ruleId of Object.keys(value)) {
const ruleOptions = value[ruleId];
// avoid hairy edge case
if (ruleId === "__proto__") {
continue;
}
assertIsRuleOptions(ruleId, ruleOptions);
lastRuleId = ruleId;
const ruleOptions = value[ruleId];
assertIsRuleOptions(ruleOptions);
if (Array.isArray(ruleOptions)) {
assertIsRuleSeverity(ruleOptions[0]);
} else {
assertIsRuleSeverity(ruleOptions);
}
if (Array.isArray(ruleOptions)) {
assertIsRuleSeverity(ruleId, ruleOptions[0]);
} else {
assertIsRuleSeverity(ruleId, ruleOptions);
}
} catch (error) {
error.message = `Key "${lastRuleId}": ${error.message}`;
throw error;
}

@@ -414,0 +422,0 @@ }

@@ -226,3 +226,3 @@ /**

* or an empty array if there are no matches.
* @throws {UnmatchedSearchPatternsErrror} If there is a pattern that doesn't
* @throws {UnmatchedSearchPatternsError} If there is a pattern that doesn't
* match any files.

@@ -530,5 +530,5 @@ */

// save patterns for later use based on whether globs are enabled
if (globInputPaths && isGlobPattern(filePath)) {
if (globInputPaths && isGlobPattern(pattern)) {
const basePath = globParent(filePath);
const basePath = path.resolve(cwd, globParent(pattern));

@@ -573,37 +573,2 @@ // group in cwd if possible and split out others

/**
* Checks whether a file exists at the given location
* @param {string} resolvedPath A path from the CWD
* @throws {Error} As thrown by `fs.statSync` or `fs.isFile`.
* @returns {boolean} `true` if a file exists
*/
function fileExists(resolvedPath) {
try {
return fs.statSync(resolvedPath).isFile();
} catch (error) {
if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
return false;
}
throw error;
}
}
/**
* Checks whether a directory exists at the given location
* @param {string} resolvedPath A path from the CWD
* @throws {Error} As thrown by `fs.statSync` or `fs.isDirectory`.
* @returns {boolean} `true` if a directory exists
*/
function directoryExists(resolvedPath) {
try {
return fs.statSync(resolvedPath).isDirectory();
} catch (error) {
if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
return false;
}
throw error;
}
}
//-----------------------------------------------------------------------------

@@ -632,10 +597,6 @@ // Results-related Helpers

let message;
const isHidden = filePath.split(path.sep)
.find(segment => /^\./u.test(segment));
const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules");
const isInNodeModules = baseDir && path.dirname(path.relative(baseDir, filePath)).split(path.sep).includes("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 {

@@ -649,5 +610,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
}

@@ -801,2 +764,5 @@ ],

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

@@ -933,4 +899,2 @@ errors.push("'overrideConfig' must be an object or null.");

isGlobPattern,
directoryExists,
fileExists,
findFiles,

@@ -937,0 +901,0 @@

@@ -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.
*/

@@ -327,2 +328,41 @@ function findFlatConfigFile(cwd) {

/**
* Determines which config file to use. This is determined by seeing if an
* override config file was passed, and if so, using it; otherwise, as long
* as override config file is not explicitly set to `false`, it will search
* upwards from the cwd for a file named `eslint.config.js`.
* @param {import("./eslint").ESLintOptions} options The ESLint instance options.
* @returns {{configFilePath:string|undefined,basePath:string,error:Error|null}} Location information for
* the config file.
*/
async function locateConfigFileToUse({ configFile, cwd }) {
// determine where to load config file from
let configFilePath;
let basePath = cwd;
let error = null;
if (typeof configFile === "string") {
debug(`Override config file path is ${configFile}`);
configFilePath = path.resolve(cwd, configFile);
} else if (configFile !== false) {
debug("Searching for eslint.config.js");
configFilePath = await findFlatConfigFile(cwd);
if (configFilePath) {
basePath = path.resolve(path.dirname(configFilePath));
} else {
error = new Error("Could not find config file.");
}
}
return {
configFilePath,
basePath,
error
};
}
/**
* Calculates the config array for this run based on inputs.

@@ -349,21 +389,9 @@ * @param {FlatESLint} eslint The instance to create the config array for.

// determine where to load config file from
let configFilePath;
let basePath = cwd;
const { configFilePath, basePath, error } = await locateConfigFileToUse({ configFile, cwd });
if (typeof configFile === "string") {
debug(`Override config file path is ${configFile}`);
configFilePath = path.resolve(cwd, configFile);
} else if (configFile !== false) {
debug("Searching for eslint.config.js");
configFilePath = await findFlatConfigFile(cwd);
if (!configFilePath) {
throw new Error("Could not find config file.");
}
basePath = path.resolve(path.dirname(configFilePath));
// config file is required to calculate config
if (error) {
throw error;
}
const configs = new FlatConfigArray(baseConfig || [], { basePath, shouldIgnore });

@@ -385,35 +413,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) {
/*

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

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

@@ -1171,2 +1193,15 @@ }

/**
* Finds the config file being used by this instance based on the options
* passed to the constructor.
* @returns {string|undefined} The path to the config file being used or
* `undefined` if no config file is being used.
*/
async findConfigFile() {
const options = privateMembers.get(this).options;
const { configFilePath } = await locateConfigFileToUse(options);
return configFilePath;
}
/**
* Checks if a given path is ignored by ESLint.

@@ -1183,2 +1218,22 @@ * @param {string} filePath The path of the file to check.

/**
* 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()));
}
}
//------------------------------------------------------------------------------

@@ -1190,3 +1245,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 @@ */

@@ -112,3 +112,3 @@ /**

if (codePath.thrownSegments.length > 0) {
text += "thrown[label=\"✘\",shape=circle,width=0.3,height=0.3,fixedsize];\n";
text += "thrown[label=\"✘\",shape=circle,width=0.3,height=0.3,fixedsize=true];\n";
}

@@ -115,0 +115,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 @@

@@ -348,3 +348,3 @@ /**

static setDefaultConfig(config) {
if (typeof config !== "object") {
if (typeof config !== "object" || config === null) {
throw new TypeError("FlatRuleTester.setDefaultConfig: config must be an object");

@@ -434,3 +434,3 @@ }

"Set `RuleTester.itOnly` to use `only` with a custom test framework.\n" +
"See https://eslint.org/docs/developer-guide/nodejs-api#customizing-ruletester for more."
"See https://eslint.org/docs/latest/integrate/nodejs-api#customizing-ruletester for more."
);

@@ -437,0 +437,0 @@ }

@@ -317,3 +317,3 @@ /**

process.emitWarning(
`"${ruleName}" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/developer-guide/working-with-rules`,
`"${ruleName}" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/latest/extend/custom-rules`,
"DeprecationWarning"

@@ -333,3 +333,3 @@ );

process.emitWarning(
`"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/developer-guide/working-with-rules#options-schemas`,
`"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas`,
"DeprecationWarning"

@@ -417,3 +417,3 @@ );

static setDefaultConfig(config) {
if (typeof config !== "object") {
if (typeof config !== "object" || config === null) {
throw new TypeError("RuleTester.setDefaultConfig: config must be an object");

@@ -499,3 +499,3 @@ }

"Set `RuleTester.itOnly` to use `only` with a custom test framework.\n" +
"See https://eslint.org/docs/developer-guide/nodejs-api#customizing-ruletester for more."
"See https://eslint.org/docs/latest/integrate/nodejs-api#customizing-ruletester for more."
);

@@ -502,0 +502,0 @@ }

@@ -145,3 +145,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/accessor-pairs"
url: "https://eslint.org/docs/latest/rules/accessor-pairs"
},

@@ -182,3 +182,3 @@

const enforceForClassMembers = config.enforceForClassMembers !== false;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -185,0 +185,0 @@ /**

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

recommended: false,
url: "https://eslint.org/docs/rules/array-bracket-newline"
url: "https://eslint.org/docs/latest/rules/array-bracket-newline"
},

@@ -60,3 +60,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -63,0 +63,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/array-bracket-spacing"
url: "https://eslint.org/docs/latest/rules/array-bracket-spacing"
},

@@ -57,3 +57,3 @@

const spaced = context.options[0] === "always",
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -60,0 +60,0 @@ /**

@@ -19,3 +19,3 @@ /**

const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u;
const TARGET_METHODS = /^(?:every|filter|find(?:Last)?(?:Index)?|flatMap|forEach|map|reduce(?:Right)?|some|sort)$/u;
const TARGET_METHODS = /^(?:every|filter|find(?:Last)?(?:Index)?|flatMap|forEach|map|reduce(?:Right)?|some|sort|toSorted)$/u;

@@ -145,3 +145,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/array-callback-return"
url: "https://eslint.org/docs/latest/rules/array-callback-return"
},

@@ -177,3 +177,3 @@

const options = context.options[0] || { allowImplicit: false, checkForEach: false };
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -180,0 +180,0 @@ let funcInfo = {

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

recommended: false,
url: "https://eslint.org/docs/rules/array-element-newline"
url: "https://eslint.org/docs/latest/rules/array-element-newline"
},

@@ -51,2 +51,3 @@

},
type: "array",
items: [

@@ -83,3 +84,3 @@ {

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -86,0 +87,0 @@ //----------------------------------------------------------------------

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/arrow-body-style"
url: "https://eslint.org/docs/latest/rules/arrow-body-style"
},

@@ -78,3 +78,3 @@

const requireReturnForObjectLiteral = options[1] && options[1].requireReturnForObjectLiteral;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let funcInfo = null;

@@ -81,0 +81,0 @@

@@ -38,3 +38,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/arrow-parens"
url: "https://eslint.org/docs/latest/rules/arrow-parens"
},

@@ -73,3 +73,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -76,0 +76,0 @@ /**

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/arrow-spacing"
url: "https://eslint.org/docs/latest/rules/arrow-spacing"
},

@@ -65,3 +65,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -68,0 +68,0 @@ /**

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/block-scoped-var"
url: "https://eslint.org/docs/latest/rules/block-scoped-var"
},

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

let stack = [];
const sourceCode = context.sourceCode;

@@ -88,3 +89,3 @@ /**

// Gets declared variables, and checks its references.
const variables = context.getDeclaredVariables(node);
const variables = sourceCode.getDeclaredVariables(node);

@@ -91,0 +92,0 @@ for (let i = 0; i < variables.length; ++i) {

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

recommended: false,
url: "https://eslint.org/docs/rules/block-spacing"
url: "https://eslint.org/docs/latest/rules/block-spacing"
},

@@ -41,3 +41,3 @@

messageId = always ? "missing" : "extra",
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -44,0 +44,0 @@ /**

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

recommended: false,
url: "https://eslint.org/docs/rules/brace-style"
url: "https://eslint.org/docs/latest/rules/brace-style"
},

@@ -57,3 +57,3 @@

params = context.options[1] || {},
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -60,0 +60,0 @@ //--------------------------------------------------------------------------

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

recommended: false,
url: "https://eslint.org/docs/rules/callback-return"
url: "https://eslint.org/docs/latest/rules/callback-return"
},

@@ -41,3 +41,3 @@

const callbacks = context.options[0] || ["callback", "cb", "next"],
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -44,0 +44,0 @@ //--------------------------------------------------------------------------

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/camelcase"
url: "https://eslint.org/docs/latest/rules/camelcase"
},

@@ -77,2 +77,3 @@

const allow = options.allow || [];
const sourceCode = context.sourceCode;

@@ -250,4 +251,4 @@ //--------------------------------------------------------------------------

// Report camelcase of global variable references ------------------
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);

@@ -301,3 +302,3 @@ if (!ignoreGlobals) {

]](node) {
for (const variable of context.getDeclaredVariables(node)) {
for (const variable of sourceCode.getDeclaredVariables(node)) {
if (isGoodName(variable.name)) {

@@ -352,3 +353,3 @@ continue;

ImportDeclaration(node) {
for (const variable of context.getDeclaredVariables(node)) {
for (const variable of sourceCode.getDeclaredVariables(node)) {
if (isGoodName(variable.name)) {

@@ -355,0 +356,0 @@ continue;

@@ -110,3 +110,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/capitalized-comments"
url: "https://eslint.org/docs/latest/rules/capitalized-comments"
},

@@ -143,3 +143,3 @@

normalizedOptions = getAllNormalizedOptions(context.options[1]),
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -146,0 +146,0 @@ createRegExpForIgnorePatterns(normalizedOptions);

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/class-methods-use-this"
url: "https://eslint.org/docs/latest/rules/class-methods-use-this"
},

@@ -137,3 +137,3 @@

node,
loc: astUtils.getFunctionHeadLoc(node, context.getSourceCode()),
loc: astUtils.getFunctionHeadLoc(node, context.sourceCode),
messageId: "missingThis",

@@ -140,0 +140,0 @@ data: {

@@ -81,3 +81,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/comma-dangle"
url: "https://eslint.org/docs/latest/rules/comma-dangle"
},

@@ -140,3 +140,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -143,0 +143,0 @@ /**

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/comma-spacing"
url: "https://eslint.org/docs/latest/rules/comma-spacing"
},

@@ -52,3 +52,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const tokensAndComments = sourceCode.tokensAndComments;

@@ -55,0 +55,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/comma-style"
url: "https://eslint.org/docs/latest/rules/comma-style"
},

@@ -55,3 +55,3 @@

const style = context.options[0] || "last",
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;
const exceptions = {

@@ -58,0 +58,0 @@ ArrayPattern: true,

@@ -28,3 +28,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/complexity"
url: "https://eslint.org/docs/latest/rules/complexity"
},

@@ -31,0 +31,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/computed-property-spacing"
url: "https://eslint.org/docs/latest/rules/computed-property-spacing"
},

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

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const propertyNameMustBeSpaced = context.options[0] === "always"; // default is "never"

@@ -56,0 +56,0 @@ const enforceForClassMembers = !context.options[1] || context.options[1].enforceForClassMembers;

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

recommended: false,
url: "https://eslint.org/docs/rules/consistent-return"
url: "https://eslint.org/docs/latest/rules/consistent-return"
},

@@ -108,3 +108,3 @@

// `=>` token
loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc;
loc = context.sourceCode.getTokenBefore(node.body, astUtils.isArrowToken).loc;
} else if (

@@ -120,3 +120,3 @@ node.parent.type === "MethodDefinition" ||

// Function name or `function` keyword.
loc = (node.id || context.getSourceCode().getFirstToken(node)).loc;
loc = (node.id || context.sourceCode.getFirstToken(node)).loc;
}

@@ -123,0 +123,0 @@

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/consistent-this"
url: "https://eslint.org/docs/latest/rules/consistent-this"
},

@@ -40,2 +40,3 @@

let aliases = [];
const sourceCode = context.sourceCode;

@@ -120,6 +121,7 @@ if (context.options.length === 0) {

* Check each alias to ensure that is was assigned to the correct value.
* @param {ASTNode} node The node that represents the scope to check.
* @returns {void}
*/
function ensureWasAssigned() {
const scope = context.getScope();
function ensureWasAssigned(node) {
const scope = sourceCode.getScope(node);

@@ -126,0 +128,0 @@ aliases.forEach(alias => {

@@ -127,3 +127,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/constructor-super"
url: "https://eslint.org/docs/latest/rules/constructor-super"
},

@@ -130,0 +130,0 @@

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/curly"
url: "https://eslint.org/docs/latest/rules/curly"
},

@@ -74,3 +74,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -77,0 +77,0 @@ //--------------------------------------------------------------------------

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/default-case-last"
url: "https://eslint.org/docs/latest/rules/default-case-last"
},

@@ -23,0 +23,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/default-case"
url: "https://eslint.org/docs/latest/rules/default-case"
},

@@ -46,3 +46,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -49,0 +49,0 @@ //--------------------------------------------------------------------------

@@ -16,3 +16,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/default-param-last"
url: "https://eslint.org/docs/latest/rules/default-param-last"
},

@@ -19,0 +19,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/dot-location"
url: "https://eslint.org/docs/latest/rules/dot-location"
},

@@ -47,3 +47,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -50,0 +50,0 @@ /**

@@ -31,3 +31,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/dot-notation"
url: "https://eslint.org/docs/latest/rules/dot-notation"
},

@@ -63,3 +63,3 @@

const allowKeywords = options.allowKeywords === void 0 || options.allowKeywords;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -66,0 +66,0 @@ let allowPattern;

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/eol-last"
url: "https://eslint.org/docs/latest/rules/eol-last"
},

@@ -44,3 +44,3 @@

Program: function checkBadEOF(node) {
const sourceCode = context.getSourceCode(),
const sourceCode = context.sourceCode,
src = sourceCode.getText(),

@@ -47,0 +47,0 @@ lastLine = sourceCode.lines[sourceCode.lines.length - 1],

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/eqeqeq"
url: "https://eslint.org/docs/latest/rules/eqeqeq"
},

@@ -72,3 +72,3 @@

const options = context.options[1] || {};
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -75,0 +75,0 @@ const nullOption = (config === "always")

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/for-direction"
url: "https://eslint.org/docs/latest/rules/for-direction"
},

@@ -23,0 +23,0 @@

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/func-call-spacing"
url: "https://eslint.org/docs/latest/rules/func-call-spacing"
},

@@ -77,3 +77,3 @@

const allowNewlines = !never && context.options[1] && context.options[1].allowNewlines;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const text = sourceCode.getText();

@@ -80,0 +80,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/func-name-matching"
url: "https://eslint.org/docs/latest/rules/func-name-matching"
},

@@ -82,0 +82,0 @@

@@ -35,3 +35,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/func-names"
url: "https://eslint.org/docs/latest/rules/func-names"
},

@@ -73,3 +73,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -164,3 +164,3 @@ /**

// Skip recursive functions.
const nameVar = context.getDeclaredVariables(node)[0];
const nameVar = sourceCode.getDeclaredVariables(node)[0];

@@ -167,0 +167,0 @@ if (isFunctionName(nameVar) && nameVar.references.length > 0) {

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/func-style"
url: "https://eslint.org/docs/latest/rules/func-style"
},

@@ -22,0 +22,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/function-call-argument-newline"
url: "https://eslint.org/docs/latest/rules/function-call-argument-newline"
},

@@ -39,3 +39,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -42,0 +42,0 @@ const checkers = {

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/function-paren-newline"
url: "https://eslint.org/docs/latest/rules/function-paren-newline"
},

@@ -61,3 +61,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const rawOption = context.options[0] || "multiline";

@@ -64,0 +64,0 @@ const multilineOption = rawOption === "multiline";

@@ -36,3 +36,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/generator-star-spacing"
url: "https://eslint.org/docs/latest/rules/generator-star-spacing"
},

@@ -106,3 +106,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -109,0 +109,0 @@ /**

@@ -40,3 +40,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/getter-return"
url: "https://eslint.org/docs/latest/rules/getter-return"
},

@@ -68,3 +68,3 @@

const options = context.options[0] || { allowImplicit: false };
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -71,0 +71,0 @@ let funcInfo = {

@@ -64,3 +64,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/global-require"
url: "https://eslint.org/docs/latest/rules/global-require"
},

@@ -75,8 +75,10 @@

create(context) {
const sourceCode = context.sourceCode;
return {
CallExpression(node) {
const currentScope = context.getScope();
const currentScope = sourceCode.getScope(node);
if (node.callee.name === "require" && !isShadowed(currentScope, node.callee)) {
const isGoodRequire = context.getAncestors().every(parent => ACCEPTABLE_PARENTS.has(parent.type));
const isGoodRequire = sourceCode.getAncestors(node).every(parent => ACCEPTABLE_PARENTS.has(parent.type));

@@ -83,0 +85,0 @@ if (!isGoodRequire) {

@@ -101,3 +101,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/grouped-accessor-pairs"
url: "https://eslint.org/docs/latest/rules/grouped-accessor-pairs"
},

@@ -119,3 +119,3 @@

const order = context.options[0] || "anyOrder";
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -122,0 +122,0 @@ /**

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/guard-for-in"
url: "https://eslint.org/docs/latest/rules/guard-for-in"
},

@@ -23,0 +23,0 @@

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/handle-callback-err"
url: "https://eslint.org/docs/latest/rules/handle-callback-err"
},

@@ -42,2 +42,3 @@

const errorArgument = context.options[0] || "err";
const sourceCode = context.sourceCode;

@@ -84,3 +85,3 @@ /**

function checkForError(node) {
const scope = context.getScope(),
const scope = sourceCode.getScope(node),
parameters = getParameters(scope),

@@ -87,0 +88,0 @@ firstParameter = parameters[0];

@@ -124,3 +124,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/id-blacklist"
url: "https://eslint.org/docs/latest/rules/id-blacklist"
},

@@ -144,2 +144,3 @@

const reportedNodes = new Set();
const sourceCode = context.sourceCode;

@@ -236,4 +237,4 @@ let globalScope;

Program() {
globalScope = context.getScope();
Program(node) {
globalScope = sourceCode.getScope(node);
},

@@ -240,0 +241,0 @@

@@ -104,3 +104,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/id-denylist"
url: "https://eslint.org/docs/latest/rules/id-denylist"
},

@@ -125,2 +125,3 @@

const reportedNodes = new Set();
const sourceCode = context.sourceCode;

@@ -215,4 +216,4 @@ let globalScope;

Program() {
globalScope = context.getScope();
Program(node) {
globalScope = sourceCode.getScope(node);
},

@@ -219,0 +220,0 @@

@@ -12,38 +12,5 @@ /**

//------------------------------------------------------------------------------
const GraphemeSplitter = require("grapheme-splitter");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const { getGraphemeCount } = require("../shared/string-utils");
/**
* Checks if the string given as argument is ASCII or not.
* @param {string} value A string that you want to know if it is ASCII or not.
* @returns {boolean} `true` if `value` is ASCII string.
*/
function isASCII(value) {
if (typeof value !== "string") {
return false;
}
return /^[\u0020-\u007f]*$/u.test(value);
}
/** @type {GraphemeSplitter | undefined} */
let splitter;
/**
* Gets the length of the string. If the string is not in ASCII, counts graphemes.
* @param {string} value A string that you want to get the length.
* @returns {number} The length of `value`.
*/
function getStringLength(value) {
if (isASCII(value)) {
return value.length;
}
if (!splitter) {
splitter = new GraphemeSplitter();
}
return splitter.countGraphemes(value);
}
//------------------------------------------------------------------------------

@@ -61,3 +28,3 @@ // Rule Definition

recommended: false,
url: "https://eslint.org/docs/rules/id-length"
url: "https://eslint.org/docs/latest/rules/id-length"
},

@@ -174,3 +141,3 @@

const nameLength = getStringLength(name);
const nameLength = getGraphemeCount(name);

@@ -177,0 +144,0 @@ const isShort = nameLength < minLength;

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/id-match"
url: "https://eslint.org/docs/latest/rules/id-match"
},

@@ -71,2 +71,3 @@

const sourceCode = context.sourceCode;
let globalScope;

@@ -175,4 +176,4 @@

Program() {
globalScope = context.getScope();
Program(node) {
globalScope = sourceCode.getScope(node);
},

@@ -179,0 +180,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/implicit-arrow-linebreak"
url: "https://eslint.org/docs/latest/rules/implicit-arrow-linebreak"
},

@@ -38,3 +38,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const option = context.options[0] || "beside";

@@ -41,0 +41,0 @@

@@ -31,3 +31,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/indent-legacy"
url: "https://eslint.org/docs/latest/rules/indent-legacy"
},

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

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -213,0 +213,0 @@ if (context.options.length) {

@@ -53,3 +53,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/init-declarations"
url: "https://eslint.org/docs/latest/rules/init-declarations"
},

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

@@ -47,3 +47,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/jsx-quotes"
url: "https://eslint.org/docs/latest/rules/jsx-quotes"
},

@@ -50,0 +50,0 @@

@@ -12,10 +12,4 @@ /**

const astUtils = require("./utils/ast-utils");
const GraphemeSplitter = require("grapheme-splitter");
const { getGraphemeCount } = require("../shared/string-utils");
const splitter = new GraphemeSplitter();
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**

@@ -148,3 +142,3 @@ * Checks whether a string contains a line terminator as defined in

recommended: false,
url: "https://eslint.org/docs/rules/key-spacing"
url: "https://eslint.org/docs/latest/rules/key-spacing"
},

@@ -337,3 +331,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -529,3 +523,3 @@ /**

return splitter.countGraphemes(sourceCode.getText().slice(startToken.range[0], endToken.range[1]));
return getGraphemeCount(sourceCode.getText().slice(startToken.range[0], endToken.range[1]));
}

@@ -532,0 +526,0 @@

@@ -72,3 +72,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/keyword-spacing"
url: "https://eslint.org/docs/latest/rules/keyword-spacing"
},

@@ -112,3 +112,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -115,0 +115,0 @@ const tokensToIgnore = new WeakSet();

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/line-comment-position"
url: "https://eslint.org/docs/latest/rules/line-comment-position"
},

@@ -82,3 +82,3 @@

const customIgnoreRegExp = new RegExp(ignorePattern, "u");
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -85,0 +85,0 @@ //--------------------------------------------------------------------------

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/linebreak-style"
url: "https://eslint.org/docs/latest/rules/linebreak-style"
},

@@ -44,3 +44,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -47,0 +47,0 @@ //--------------------------------------------------------------------------

@@ -60,3 +60,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/lines-around-comment"
url: "https://eslint.org/docs/latest/rules/lines-around-comment"
},

@@ -117,2 +117,6 @@

type: "boolean"
},
afterHashbangComment: {
type: "boolean",
default: false
}

@@ -139,3 +143,3 @@ },

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -455,2 +459,9 @@ const lines = sourceCode.lines,

}
} else if (token.type === "Shebang") {
if (options.afterHashbangComment) {
checkForEmptyLine(token, {
after: options.afterHashbangComment,
before: false
});
}
}

@@ -457,0 +468,0 @@ });

@@ -23,3 +23,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/lines-around-directive"
url: "https://eslint.org/docs/latest/rules/lines-around-directive"
},

@@ -58,3 +58,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const config = context.options[0] || "always";

@@ -61,0 +61,0 @@ const expectLineBefore = typeof config === "string" ? config : config.before;

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/lines-between-class-members"
url: "https://eslint.org/docs/latest/rules/lines-between-class-members"
},

@@ -59,3 +59,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -62,0 +62,0 @@ /**

@@ -115,3 +115,3 @@ /**

* truthiness checks: value, Boolean(value), !!value
* falsyness checks: !value, !Boolean(value)
* falsiness checks: !value, !Boolean(value)
* nullish checks: value == null, value === undefined || value === null

@@ -163,5 +163,5 @@ * @param {ASTNode} expression Test condition

docs: {
description: "Require or disallow logical assignment logical operator shorthand",
description: "Require or disallow logical assignment operator shorthand",
recommended: false,
url: "https://eslint.org/docs/rules/logical-assignment-operators"
url: "https://eslint.org/docs/latest/rules/logical-assignment-operators"
},

@@ -210,4 +210,4 @@

const checkIf = mode === "always" && context.options.length > 1 && context.options[1].enforceForIfStatements;
const sourceCode = context.getSourceCode();
const isStrict = context.getScope().isStrict;
const sourceCode = context.sourceCode;
const isStrict = sourceCode.getScope(sourceCode.ast).isStrict;

@@ -415,3 +415,3 @@ /**

const body = hasBody ? ifNode.consequent.body[0] : ifNode.consequent;
const scope = context.getScope();
const scope = sourceCode.getScope(ifNode);
const existence = getExistence(ifNode.test, scope);

@@ -418,0 +418,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/max-classes-per-file"
url: "https://eslint.org/docs/latest/rules/max-classes-per-file"
},

@@ -27,0 +27,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/max-depth"
url: "https://eslint.org/docs/latest/rules/max-depth"
},

@@ -23,0 +23,0 @@

@@ -74,3 +74,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/max-len"
url: "https://eslint.org/docs/latest/rules/max-len"
},

@@ -101,3 +101,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -104,0 +104,0 @@ /**

@@ -76,3 +76,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/max-lines-per-function"
url: "https://eslint.org/docs/latest/rules/max-lines-per-function"
},

@@ -89,3 +89,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const lines = sourceCode.lines;

@@ -92,0 +92,0 @@

@@ -39,3 +39,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/max-lines"
url: "https://eslint.org/docs/latest/rules/max-lines"
},

@@ -91,3 +91,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -94,0 +94,0 @@ /**

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/max-nested-callbacks"
url: "https://eslint.org/docs/latest/rules/max-nested-callbacks"
},

@@ -23,0 +23,0 @@

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/max-params"
url: "https://eslint.org/docs/latest/rules/max-params"
},

@@ -61,3 +61,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const option = context.options[0];

@@ -64,0 +64,0 @@ let numParams = 3;

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/max-statements-per-line"
url: "https://eslint.org/docs/latest/rules/max-statements-per-line"
},

@@ -49,3 +49,3 @@

const sourceCode = context.getSourceCode(),
const sourceCode = context.sourceCode,
options = context.options[0] || {},

@@ -52,0 +52,0 @@ maxStatementsPerLine = typeof options.max !== "undefined" ? options.max : 1;

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/max-statements"
url: "https://eslint.org/docs/latest/rules/max-statements"
},

@@ -30,0 +30,0 @@

@@ -21,7 +21,37 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/multiline-comment-style"
url: "https://eslint.org/docs/latest/rules/multiline-comment-style"
},
fixable: "whitespace",
schema: [{ enum: ["starred-block", "separate-lines", "bare-block"] }],
schema: {
anyOf: [
{
type: "array",
items: [
{
enum: ["starred-block", "bare-block"]
}
],
additionalItems: false
},
{
type: "array",
items: [
{
enum: ["separate-lines"]
},
{
type: "object",
properties: {
checkJSDoc: {
type: "boolean"
}
},
additionalProperties: false
}
],
additionalItems: false
}
]
},
messages: {

@@ -39,4 +69,6 @@ expectedBlock: "Expected a block comment instead of consecutive line comments.",

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const option = context.options[0] || "starred-block";
const params = context.options[1] || {};
const checkJSDoc = !!params.checkJSDoc;

@@ -338,7 +370,14 @@ //----------------------------------------------------------------------

if (firstComment.type !== "Block" || isJSDocComment(commentGroup)) {
const isJSDoc = isJSDocComment(commentGroup);
if (firstComment.type !== "Block" || (!checkJSDoc && isJSDoc)) {
return;
}
const commentLines = getCommentLines(commentGroup);
let commentLines = getCommentLines(commentGroup);
if (isJSDoc) {
commentLines = commentLines.slice(1, commentLines.length - 1);
}
const tokenAfter = sourceCode.getTokenAfter(firstComment, { includeComments: true });

@@ -345,0 +384,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/multiline-ternary"
url: "https://eslint.org/docs/latest/rules/multiline-ternary"
},

@@ -43,3 +43,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const option = context.options[0];

@@ -46,0 +46,0 @@ const multiline = option !== "never";

@@ -87,3 +87,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/new-cap"
url: "https://eslint.org/docs/latest/rules/new-cap"
},

@@ -151,3 +151,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -154,0 +154,0 @@ //--------------------------------------------------------------------------

@@ -30,20 +30,11 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/new-parens"
url: "https://eslint.org/docs/latest/rules/new-parens"
},
fixable: "code",
schema: {
anyOf: [
{
type: "array",
items: [
{
enum: ["always", "never"]
}
],
minItems: 0,
maxItems: 1
}
]
},
schema: [
{
enum: ["always", "never"]
}
],
messages: {

@@ -59,3 +50,3 @@ missing: "Missing '()' invoking a constructor.",

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -62,0 +53,0 @@ return {

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/newline-after-var"
url: "https://eslint.org/docs/latest/rules/newline-after-var"
},

@@ -47,3 +47,3 @@ schema: [

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -50,0 +50,0 @@ // Default `mode` to "always".

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/newline-before-return"
url: "https://eslint.org/docs/latest/rules/newline-before-return"
},

@@ -35,3 +35,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -38,0 +38,0 @@ //--------------------------------------------------------------------------

@@ -23,3 +23,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/newline-per-chained-call"
url: "https://eslint.org/docs/latest/rules/newline-per-chained-call"
},

@@ -51,3 +51,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -54,0 +54,0 @@ /**

@@ -93,3 +93,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-alert"
url: "https://eslint.org/docs/latest/rules/no-alert"
},

@@ -105,6 +105,8 @@

create(context) {
const sourceCode = context.sourceCode;
return {
CallExpression(node) {
const callee = skipChainExpression(node.callee),
currentScope = context.getScope();
currentScope = sourceCode.getScope(node);

@@ -111,0 +113,0 @@ // without window.

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-array-constructor"
url: "https://eslint.org/docs/latest/rules/no-array-constructor"
},

@@ -23,0 +23,0 @@

@@ -19,3 +19,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-async-promise-executor"
url: "https://eslint.org/docs/latest/rules/no-async-promise-executor"
},

@@ -34,3 +34,3 @@

context.report({
node: context.getSourceCode().getFirstToken(node.arguments[0], token => token.value === "async"),
node: context.sourceCode.getFirstToken(node.arguments[0], token => token.value === "async"),
messageId: "async"

@@ -37,0 +37,0 @@ });

@@ -64,3 +64,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-await-in-loop"
url: "https://eslint.org/docs/latest/rules/no-await-in-loop"
},

@@ -67,0 +67,0 @@

@@ -31,3 +31,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-bitwise"
url: "https://eslint.org/docs/latest/rules/no-bitwise"
},

@@ -34,0 +34,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/no-buffer-constructor"
url: "https://eslint.org/docs/latest/rules/no-buffer-constructor"
},

@@ -27,0 +27,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-caller"
url: "https://eslint.org/docs/latest/rules/no-caller"
},

@@ -23,0 +23,0 @@

@@ -19,3 +19,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-case-declarations"
url: "https://eslint.org/docs/latest/rules/no-case-declarations"
},

@@ -22,0 +22,0 @@

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-catch-shadow"
url: "https://eslint.org/docs/latest/rules/no-catch-shadow"
},

@@ -43,2 +43,4 @@

const sourceCode = context.sourceCode;
//--------------------------------------------------------------------------

@@ -65,3 +67,3 @@ // Helpers

"CatchClause[param!=null]"(node) {
let scope = context.getScope();
let scope = sourceCode.getScope(node);

@@ -68,0 +70,0 @@ /*

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

recommended: true,
url: "https://eslint.org/docs/rules/no-class-assign"
url: "https://eslint.org/docs/latest/rules/no-class-assign"
},

@@ -35,2 +35,4 @@

const sourceCode = context.sourceCode;
/**

@@ -54,3 +56,3 @@ * Finds and reports references that are non initializer and writable.

function checkForClass(node) {
context.getDeclaredVariables(node).forEach(checkVariable);
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
}

@@ -57,0 +59,0 @@

@@ -19,3 +19,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-compare-neg-zero"
url: "https://eslint.org/docs/latest/rules/no-compare-neg-zero"
},

@@ -22,0 +22,0 @@

@@ -39,3 +39,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-cond-assign"
url: "https://eslint.org/docs/latest/rules/no-cond-assign"
},

@@ -61,3 +61,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -64,0 +64,0 @@ /**

@@ -36,3 +36,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-confusing-arrow"
url: "https://eslint.org/docs/latest/rules/no-confusing-arrow"
},

@@ -60,3 +60,3 @@

const onlyOneSimpleParam = config.onlyOneSimpleParam;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -63,0 +63,0 @@

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-console"
url: "https://eslint.org/docs/latest/rules/no-console"
},

@@ -55,2 +55,3 @@

const allowed = options.allow || [];
const sourceCode = context.sourceCode;

@@ -114,4 +115,4 @@ /**

return {
"Program:exit"() {
const scope = context.getScope();
"Program:exit"(node) {
const scope = sourceCode.getScope(node);
const consoleVar = astUtils.getVariableByName(scope, "console");

@@ -118,0 +119,0 @@ const shadowed = consoleVar && consoleVar.defs.length > 0;

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

recommended: true,
url: "https://eslint.org/docs/rules/no-const-assign"
url: "https://eslint.org/docs/latest/rules/no-const-assign"
},

@@ -35,2 +35,4 @@

const sourceCode = context.sourceCode;
/**

@@ -50,3 +52,3 @@ * Finds and reports references that are non initializer and writable.

if (node.kind === "const") {
context.getDeclaredVariables(node).forEach(checkVariable);
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
}

@@ -53,0 +55,0 @@ }

@@ -18,2 +18,19 @@ /**

/**
* Checks whether or not a node is `null` or `undefined`. Similar to the one
* found in ast-utils.js, but this one correctly handles the edge case that
* `undefined` has been redefined.
* @param {Scope} scope Scope in which the expression was found.
* @param {ASTNode} node A node to check.
* @returns {boolean} Whether or not the node is a `null` or `undefined`.
* @public
*/
function isNullOrUndefined(scope, node) {
return (
isNullLiteral(node) ||
(node.type === "Identifier" && node.name === "undefined" && isReferenceToGlobalVariable(scope, node)) ||
(node.type === "UnaryExpression" && node.operator === "void")
);
}
/**
* Test if an AST node has a statically knowable constant nullishness. Meaning,

@@ -25,5 +42,10 @@ * it will always resolve to a constant value of either: `null`, `undefined`

* @param {ASTNode} node The AST node being tested.
* @param {boolean} nonNullish if `true` then nullish values are not considered constant.
* @returns {boolean} Does `node` have constant nullishness?
*/
function hasConstantNullishness(scope, node) {
function hasConstantNullishness(scope, node, nonNullish) {
if (nonNullish && isNullOrUndefined(scope, node)) {
return false;
}
switch (node.type) {

@@ -50,5 +72,8 @@ case "ObjectExpression": // Objects are never nullish

}
case "LogicalExpression": {
return node.operator === "??" && hasConstantNullishness(scope, node.right, true);
}
case "AssignmentExpression":
if (node.operator === "=") {
return hasConstantNullishness(scope, node.right);
return hasConstantNullishness(scope, node.right, nonNullish);
}

@@ -86,3 +111,3 @@

return hasConstantNullishness(scope, last);
return hasConstantNullishness(scope, last, nonNullish);
}

@@ -355,3 +380,3 @@ case "Identifier":

*
* Catching these is especially useful for primitive constructures
* Catching these is especially useful for primitive constructors
* which return boxed values, a surprising gotcha' in JavaScript.

@@ -387,20 +412,2 @@ */

/**
* Checks whether or not a node is `null` or `undefined`. Similar to the one
* found in ast-utils.js, but this one correctly handles the edge case that
* `undefined` has been redefined.
* @param {Scope} scope Scope in which the expression was found.
* @param {ASTNode} node A node to check.
* @returns {boolean} Whether or not the node is a `null` or `undefined`.
* @public
*/
function isNullOrUndefined(scope, node) {
return (
isNullLiteral(node) ||
(node.type === "Identifier" && node.name === "undefined" && isReferenceToGlobalVariable(scope, node)) ||
(node.type === "UnaryExpression" && node.operator === "void")
);
}
/**
* Checks if one operand will cause the result to be constant.

@@ -416,3 +423,3 @@ * @param {Scope} scope Scope in which the expression was found.

if (
(isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b)) ||
(isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b, false)) ||
(isStaticBoolean(scope, a) && hasConstantLooseBooleanComparison(scope, b))

@@ -424,3 +431,3 @@ ) {

if (
(isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b)) ||
(isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b, false)) ||
(isStaticBoolean(scope, a) && hasConstantStrictBooleanComparison(scope, b))

@@ -445,3 +452,3 @@ ) {

recommended: false,
url: "https://eslint.org/docs/rules/no-constant-binary-expression"
url: "https://eslint.org/docs/latest/rules/no-constant-binary-expression"
},

@@ -458,10 +465,12 @@ schema: [],

create(context) {
const sourceCode = context.sourceCode;
return {
LogicalExpression(node) {
const { operator, left } = node;
const scope = context.getScope();
const scope = sourceCode.getScope(node);
if ((operator === "&&" || operator === "||") && isConstant(scope, left, true)) {
context.report({ node: left, messageId: "constantShortCircuit", data: { property: "truthiness", operator } });
} else if (operator === "??" && hasConstantNullishness(scope, left)) {
} else if (operator === "??" && hasConstantNullishness(scope, left, false)) {
context.report({ node: left, messageId: "constantShortCircuit", data: { property: "nullishness", operator } });

@@ -471,3 +480,3 @@ }

BinaryExpression(node) {
const scope = context.getScope();
const scope = sourceCode.getScope(node);
const { right, left, operator } = node;

@@ -474,0 +483,0 @@ const rightConstantOperand = findBinaryExpressionConstantOperand(scope, left, right, operator);

@@ -26,3 +26,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-constant-condition"
url: "https://eslint.org/docs/latest/rules/no-constant-condition"
},

@@ -52,2 +52,3 @@

loopSetStack = [];
const sourceCode = context.sourceCode;

@@ -67,3 +68,3 @@ let loopsInCurrentScope = new Set();

function trackConstantConditionLoop(node) {
if (node.test && isConstant(context.getScope(), node.test, true)) {
if (node.test && isConstant(sourceCode.getScope(node), node.test, true)) {
loopsInCurrentScope.add(node);

@@ -93,3 +94,3 @@ }

function reportIfConstant(node) {
if (node.test && isConstant(context.getScope(), node.test, true)) {
if (node.test && isConstant(sourceCode.getScope(node), node.test, true)) {
context.report({ node: node.test, messageId: "unexpected" });

@@ -96,0 +97,0 @@ }

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-constructor-return"
url: "https://eslint.org/docs/latest/rules/no-constructor-return"
},

@@ -23,0 +23,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-continue"
url: "https://eslint.org/docs/latest/rules/no-continue"
},

@@ -23,0 +23,0 @@

@@ -8,3 +8,3 @@ /**

const RegExpValidator = require("regexpp").RegExpValidator;
const RegExpValidator = require("@eslint-community/regexpp").RegExpValidator;
const collector = new (class {

@@ -60,3 +60,3 @@ constructor() {

recommended: true,
url: "https://eslint.org/docs/rules/no-control-regex"
url: "https://eslint.org/docs/latest/rules/no-control-regex"
},

@@ -63,0 +63,0 @@

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-debugger"
url: "https://eslint.org/docs/latest/rules/no-debugger"
},

@@ -23,0 +23,0 @@

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-delete-var"
url: "https://eslint.org/docs/latest/rules/no-delete-var"
},

@@ -23,0 +23,0 @@

@@ -18,5 +18,5 @@ /**

docs: {
description: "Disallow division operators explicitly at the beginning of regular expressions",
description: "Disallow equal signs explicitly at the beginning of regular expressions",
recommended: false,
url: "https://eslint.org/docs/rules/no-div-regex"
url: "https://eslint.org/docs/latest/rules/no-div-regex"
},

@@ -34,3 +34,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -37,0 +37,0 @@ return {

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-dupe-args"
url: "https://eslint.org/docs/latest/rules/no-dupe-args"
},

@@ -33,2 +33,4 @@

const sourceCode = context.sourceCode;
//--------------------------------------------------------------------------

@@ -54,3 +56,3 @@ // Helpers

function checkParams(node) {
const variables = context.getDeclaredVariables(node);
const variables = sourceCode.getDeclaredVariables(node);

@@ -57,0 +59,0 @@ for (let i = 0; i < variables.length; ++i) {

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

recommended: true,
url: "https://eslint.org/docs/rules/no-dupe-class-members"
url: "https://eslint.org/docs/latest/rules/no-dupe-class-members"
},

@@ -25,0 +25,0 @@

@@ -57,3 +57,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-dupe-else-if"
url: "https://eslint.org/docs/latest/rules/no-dupe-else-if"
},

@@ -69,3 +69,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -72,0 +72,0 @@ /**

@@ -93,3 +93,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-dupe-keys"
url: "https://eslint.org/docs/latest/rules/no-dupe-keys"
},

@@ -96,0 +96,0 @@

@@ -27,3 +27,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-duplicate-case"
url: "https://eslint.org/docs/latest/rules/no-duplicate-case"
},

@@ -39,3 +39,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -42,0 +42,0 @@ /**

@@ -238,3 +238,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-duplicate-imports"
url: "https://eslint.org/docs/latest/rules/no-duplicate-imports"
},

@@ -241,0 +241,0 @@

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-else-return"
url: "https://eslint.org/docs/latest/rules/no-else-return"
},

@@ -51,2 +51,4 @@

const sourceCode = context.sourceCode;
//--------------------------------------------------------------------------

@@ -174,21 +176,20 @@ // Helpers

* Display the context report if rule is violated
* @param {Node} node The 'else' node
* @param {Node} elseNode The 'else' node
* @returns {void}
*/
function displayReport(node) {
const currentScope = context.getScope();
function displayReport(elseNode) {
const currentScope = sourceCode.getScope(elseNode.parent);
context.report({
node,
node: elseNode,
messageId: "unexpected",
fix(fixer) {
if (!isSafeFromNameCollisions(node, currentScope)) {
if (!isSafeFromNameCollisions(elseNode, currentScope)) {
return null;
}
const sourceCode = context.getSourceCode();
const startToken = sourceCode.getFirstToken(node);
const startToken = sourceCode.getFirstToken(elseNode);
const elseToken = sourceCode.getTokenBefore(startToken);
const source = sourceCode.getText(node);
const source = sourceCode.getText(elseNode);
const lastIfToken = sourceCode.getTokenBefore(elseToken);

@@ -209,3 +210,3 @@ let fixedSource, firstTokenOfElseBlock;

*/
const ifBlockMaybeUnsafe = node.parent.consequent.type !== "BlockStatement" && lastIfToken.value !== ";";
const ifBlockMaybeUnsafe = elseNode.parent.consequent.type !== "BlockStatement" && lastIfToken.value !== ";";
const elseBlockUnsafe = /^[([/+`-]/u.test(firstTokenOfElseBlock.value);

@@ -217,3 +218,3 @@

const endToken = sourceCode.getLastToken(node);
const endToken = sourceCode.getLastToken(elseNode);
const lastTokenOfElseBlock = sourceCode.getTokenBefore(endToken);

@@ -252,4 +253,4 @@

return new FixTracker(fixer, sourceCode)
.retainEnclosingFunction(node)
.replaceTextRange([elseToken.range[0], node.range[1]], fixedSource);
.retainEnclosingFunction(elseNode)
.replaceTextRange([elseToken.range[0], elseNode.range[1]], fixedSource);
}

@@ -256,0 +257,0 @@ });

@@ -35,3 +35,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-empty-character-class"
url: "https://eslint.org/docs/latest/rules/no-empty-character-class"
},

@@ -38,0 +38,0 @@

@@ -100,3 +100,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-empty-function"
url: "https://eslint.org/docs/latest/rules/no-empty-function"
},

@@ -127,3 +127,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -130,0 +130,0 @@ /**

@@ -19,3 +19,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-empty-pattern"
url: "https://eslint.org/docs/latest/rules/no-empty-pattern"
},

@@ -22,0 +22,0 @@

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-empty-static-block"
url: "https://eslint.org/docs/latest/rules/no-empty-static-block"
},

@@ -31,3 +31,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -34,0 +34,0 @@ return {

@@ -26,3 +26,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-empty"
url: "https://eslint.org/docs/latest/rules/no-empty"
},

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

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -56,0 +56,0 @@ return {

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-eq-null"
url: "https://eslint.org/docs/latest/rules/no-eq-null"
},

@@ -24,0 +24,0 @@

@@ -48,3 +48,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-eval"
url: "https://eslint.org/docs/latest/rules/no-eval"
},

@@ -72,7 +72,7 @@

);
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let funcInfo = null;
/**
* Pushs a `this` scope (non-arrow function, class static block, or class field initializer) information to the stack.
* Pushes a `this` scope (non-arrow function, class static block, or class field initializer) information to the stack.
* Top-level scopes are handled separately.

@@ -89,3 +89,3 @@ *

function enterThisScope(node) {
const strict = context.getScope().isStrict;
const strict = sourceCode.getScope(node).isStrict;

@@ -227,3 +227,3 @@ funcInfo = {

Program(node) {
const scope = context.getScope(),
const scope = sourceCode.getScope(node),
features = context.parserOptions.ecmaFeatures || {},

@@ -246,4 +246,4 @@ strict =

"Program:exit"() {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);

@@ -250,0 +250,0 @@ exitThisScope();

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

recommended: true,
url: "https://eslint.org/docs/rules/no-ex-assign"
url: "https://eslint.org/docs/latest/rules/no-ex-assign"
},

@@ -35,2 +35,4 @@

const sourceCode = context.sourceCode;
/**

@@ -49,3 +51,3 @@ * Finds and reports references that are non initializer and writable.

CatchClause(node) {
context.getDeclaredVariables(node).forEach(checkVariable);
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
}

@@ -52,0 +54,0 @@ };

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-extend-native"
url: "https://eslint.org/docs/latest/rules/no-extend-native"
},

@@ -55,2 +55,3 @@

const config = context.options[0] || {};
const sourceCode = context.sourceCode;
const exceptions = new Set(config.exceptions || []);

@@ -164,4 +165,4 @@ const modifiedBuiltins = new Set(

"Program:exit"() {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);

@@ -168,0 +169,0 @@ modifiedBuiltins.forEach(builtin => {

@@ -31,3 +31,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-extra-bind"
url: "https://eslint.org/docs/latest/rules/no-extra-bind"
},

@@ -44,3 +44,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let scopeInfo = null;

@@ -47,0 +47,0 @@

@@ -13,3 +13,3 @@ /**

const astUtils = require("./utils/ast-utils");
const eslintUtils = require("eslint-utils");
const eslintUtils = require("@eslint-community/eslint-utils");

@@ -30,3 +30,3 @@ const precedence = astUtils.getPrecedence;

recommended: true,
url: "https://eslint.org/docs/rules/no-extra-boolean-cast"
url: "https://eslint.org/docs/latest/rules/no-extra-boolean-cast"
},

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

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -56,0 +56,0 @@ // Node types which have a test which will coerce values to booleans.

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-extra-label"
url: "https://eslint.org/docs/latest/rules/no-extra-label"
},

@@ -39,3 +39,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let scopeInfo = null;

@@ -42,0 +42,0 @@

@@ -11,3 +11,3 @@ /**

const { isParenthesized: isParenthesizedRaw } = require("eslint-utils");
const { isParenthesized: isParenthesizedRaw } = require("@eslint-community/eslint-utils");
const astUtils = require("./utils/ast-utils.js");

@@ -23,3 +23,3 @@

recommended: false,
url: "https://eslint.org/docs/rules/no-extra-parens"
url: "https://eslint.org/docs/latest/rules/no-extra-parens"
},

@@ -75,3 +75,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -772,2 +772,34 @@ const tokensToIgnore = new WeakSet();

/**
* Checks if the left-hand side of an assignment is an identifier, the operator is one of
* `=`, `&&=`, `||=` or `??=` and the right-hand side is an anonymous class or function.
*
* As per https://tc39.es/ecma262/#sec-assignment-operators-runtime-semantics-evaluation, an
* assignment involving one of the operators `=`, `&&=`, `||=` or `??=` where the right-hand
* side is an anonymous class or function and the left-hand side is an *unparenthesized*
* identifier has different semantics than other assignments.
* Specifically, when an expression like `foo = function () {}` is evaluated, `foo.name`
* will be set to the string "foo", i.e. the identifier name. The same thing does not happen
* when evaluating `(foo) = function () {}`.
* Since the parenthesizing of the identifier in the left-hand side is significant in this
* special case, the parentheses, if present, should not be flagged as unnecessary.
* @param {ASTNode} node an AssignmentExpression node.
* @returns {boolean} `true` if the left-hand side of the assignment is an identifier, the
* operator is one of `=`, `&&=`, `||=` or `??=` and the right-hand side is an anonymous
* class or function; otherwise, `false`.
*/
function isAnonymousFunctionAssignmentException({ left, operator, right }) {
if (left.type === "Identifier" && ["=", "&&=", "||=", "??="].includes(operator)) {
const rhsType = right.type;
if (rhsType === "ArrowFunctionExpression") {
return true;
}
if ((rhsType === "FunctionExpression" || rhsType === "ClassExpression") && !right.id) {
return true;
}
}
return false;
}
return {

@@ -811,3 +843,4 @@ ArrayExpression(node) {

AssignmentExpression(node) {
if (canBeAssignmentTarget(node.left) && hasExcessParens(node.left)) {
if (canBeAssignmentTarget(node.left) && hasExcessParens(node.left) &&
(!isAnonymousFunctionAssignmentException(node) || isParenthesisedTwice(node.left))) {
report(node.left);

@@ -814,0 +847,0 @@ }

@@ -27,3 +27,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-extra-semi"
url: "https://eslint.org/docs/latest/rules/no-extra-semi"
},

@@ -40,3 +40,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -59,3 +59,3 @@ /**

*/
return new FixTracker(fixer, context.getSourceCode())
return new FixTracker(fixer, context.sourceCode)
.retainSurroundingTokens(nodeOrToken)

@@ -62,0 +62,0 @@ .remove(nodeOrToken);

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

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const { directivesPattern } = require("../shared/directives");
//------------------------------------------------------------------------------
// Helpers

@@ -15,2 +21,12 @@ //------------------------------------------------------------------------------

/**
* Checks whether or not a given comment string is really a fallthrough comment and not an ESLint directive.
* @param {string} comment The comment string to check.
* @param {RegExp} fallthroughCommentPattern The regular expression used for checking for fallthrough comments.
* @returns {boolean} `true` if the comment string is truly a fallthrough comment.
*/
function isFallThroughComment(comment, fallthroughCommentPattern) {
return fallthroughCommentPattern.test(comment) && !directivesPattern.test(comment.trim());
}
/**
* Checks whether or not a given case has a fallthrough comment.

@@ -24,3 +40,3 @@ * @param {ASTNode} caseWhichFallsThrough SwitchCase node which falls through.

function hasFallthroughComment(caseWhichFallsThrough, subsequentCase, context, fallthroughCommentPattern) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -31,3 +47,3 @@ if (caseWhichFallsThrough.consequent.length === 1 && caseWhichFallsThrough.consequent[0].type === "BlockStatement") {

if (commentInBlock && fallthroughCommentPattern.test(commentInBlock.value)) {
if (commentInBlock && isFallThroughComment(commentInBlock.value, fallthroughCommentPattern)) {
return true;

@@ -39,3 +55,3 @@ }

return Boolean(comment && fallthroughCommentPattern.test(comment.value));
return Boolean(comment && isFallThroughComment(comment.value, fallthroughCommentPattern));
}

@@ -74,3 +90,3 @@

recommended: true,
url: "https://eslint.org/docs/rules/no-fallthrough"
url: "https://eslint.org/docs/latest/rules/no-fallthrough"
},

@@ -103,3 +119,3 @@

let currentCodePath = null;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const allowEmptyCase = options.allowEmptyCase || false;

@@ -106,0 +122,0 @@

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-floating-decimal"
url: "https://eslint.org/docs/latest/rules/no-floating-decimal"
},

@@ -39,3 +39,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -42,0 +42,0 @@ return {

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

recommended: true,
url: "https://eslint.org/docs/rules/no-func-assign"
url: "https://eslint.org/docs/latest/rules/no-func-assign"
},

@@ -35,2 +35,4 @@

const sourceCode = context.sourceCode;
/**

@@ -70,3 +72,3 @@ * Reports a reference if is non initializer and writable.

function checkForFunction(node) {
context.getDeclaredVariables(node).forEach(checkVariable);
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
}

@@ -73,0 +75,0 @@

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-global-assign"
url: "https://eslint.org/docs/latest/rules/no-global-assign"
},

@@ -45,2 +45,3 @@

const config = context.options[0];
const sourceCode = context.sourceCode;
const exceptions = (config && config.exceptions) || [];

@@ -89,4 +90,4 @@

return {
Program() {
const globalScope = context.getScope();
Program(node) {
const globalScope = sourceCode.getScope(node);

@@ -93,0 +94,0 @@ globalScope.variables.forEach(checkVariable);

@@ -196,3 +196,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-implicit-coercion"
url: "https://eslint.org/docs/latest/rules/no-implicit-coercion"
},

@@ -239,3 +239,3 @@

const options = parseOptions(context.options[0] || {});
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -242,0 +242,0 @@ /**

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-implicit-globals"
url: "https://eslint.org/docs/latest/rules/no-implicit-globals"
},

@@ -47,2 +47,3 @@

const checkLexicalBindings = context.options[0] && context.options[0].lexicalBindings === true;
const sourceCode = context.sourceCode;

@@ -67,4 +68,4 @@ /**

return {
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);

@@ -71,0 +72,0 @@ scope.variables.forEach(variable => {

@@ -13,3 +13,3 @@ /**

const astUtils = require("./utils/ast-utils");
const { getStaticValue } = require("eslint-utils");
const { getStaticValue } = require("@eslint-community/eslint-utils");

@@ -28,3 +28,3 @@ //------------------------------------------------------------------------------

recommended: false,
url: "https://eslint.org/docs/rules/no-implied-eval"
url: "https://eslint.org/docs/latest/rules/no-implied-eval"
},

@@ -42,2 +42,3 @@

const EVAL_LIKE_FUNC_PATTERN = /^(?:set(?:Interval|Timeout)|execScript)$/u;
const sourceCode = context.sourceCode;

@@ -72,3 +73,3 @@ /**

const staticValue = getStaticValue(firstArgument, context.getScope());
const staticValue = getStaticValue(firstArgument, sourceCode.getScope(node));
const isStaticString = staticValue && typeof staticValue.value === "string";

@@ -124,4 +125,4 @@ const isString = isStaticString || isEvaluatedString(firstArgument);

},
"Program:exit"() {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);

@@ -128,0 +129,0 @@ GLOBAL_CANDIDATES

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

const { findVariable } = require("eslint-utils");
const { findVariable } = require("@eslint-community/eslint-utils");
const astUtils = require("./utils/ast-utils");

@@ -186,3 +186,3 @@

recommended: true,
url: "https://eslint.org/docs/rules/no-import-assign"
url: "https://eslint.org/docs/latest/rules/no-import-assign"
},

@@ -199,7 +199,9 @@

create(context) {
const sourceCode = context.sourceCode;
return {
ImportDeclaration(node) {
const scope = context.getScope();
const scope = sourceCode.getScope(node);
for (const variable of context.getDeclaredVariables(node)) {
for (const variable of sourceCode.getDeclaredVariables(node)) {
const shouldCheckMembers = variable.defs.some(

@@ -206,0 +208,0 @@ d => d.node.type === "ImportNamespaceSpecifier"

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-inline-comments"
url: "https://eslint.org/docs/latest/rules/no-inline-comments"
},

@@ -43,3 +43,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const options = context.options[0];

@@ -46,0 +46,0 @@ let customIgnoreRegExp;

@@ -53,3 +53,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-inner-declarations"
url: "https://eslint.org/docs/latest/rules/no-inner-declarations"
},

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

@@ -11,3 +11,3 @@ /**

const RegExpValidator = require("regexpp").RegExpValidator;
const RegExpValidator = require("@eslint-community/regexpp").RegExpValidator;
const validator = new RegExpValidator();

@@ -29,3 +29,3 @@ const validFlags = /[dgimsuy]/gu;

recommended: true,
url: "https://eslint.org/docs/rules/no-invalid-regexp"
url: "https://eslint.org/docs/latest/rules/no-invalid-regexp"
},

@@ -32,0 +32,0 @@

@@ -41,3 +41,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-invalid-this"
url: "https://eslint.org/docs/latest/rules/no-invalid-this"
},

@@ -67,3 +67,3 @@

const stack = [],
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -100,3 +100,3 @@ /**

if (codePath.origin === "program") {
const scope = context.getScope();
const scope = sourceCode.getScope(node);
const features = context.parserOptions.ecmaFeatures || {};

@@ -126,3 +126,3 @@

stack.push({
init: !context.getScope().isStrict,
init: !sourceCode.getScope(node).isStrict,
node,

@@ -129,0 +129,0 @@ valid: true

@@ -36,3 +36,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-irregular-whitespace"
url: "https://eslint.org/docs/latest/rules/no-irregular-whitespace"
},

@@ -82,3 +82,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const commentNodes = sourceCode.getAllComments();

@@ -105,3 +105,3 @@

/**
* Checks identifier or literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors
* Checks literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors
* @param {ASTNode} node to check for matching errors.

@@ -111,3 +111,3 @@ * @returns {void}

*/
function removeInvalidNodeErrorsInIdentifierOrLiteral(node) {
function removeInvalidNodeErrorsInLiteral(node) {
const shouldCheckStrings = skipStrings && (typeof node.value === "string");

@@ -244,4 +244,3 @@ const shouldCheckRegExps = skipRegExps && Boolean(node.regex);

nodes.Identifier = removeInvalidNodeErrorsInIdentifierOrLiteral;
nodes.Literal = removeInvalidNodeErrorsInIdentifierOrLiteral;
nodes.Literal = removeInvalidNodeErrorsInLiteral;
nodes.TemplateElement = skipTemplates ? removeInvalidNodeErrorsInTemplateLiteral : noop;

@@ -248,0 +247,0 @@ nodes["Program:exit"] = function() {

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-iterator"
url: "https://eslint.org/docs/latest/rules/no-iterator"
},

@@ -29,0 +29,0 @@

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-label-var"
url: "https://eslint.org/docs/latest/rules/no-label-var"
},

@@ -38,2 +38,3 @@

create(context) {
const sourceCode = context.sourceCode;

@@ -64,3 +65,3 @@ //--------------------------------------------------------------------------

// Fetch the innermost scope.
const scope = context.getScope();
const scope = sourceCode.getScope(node);

@@ -67,0 +68,0 @@ /*

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-labels"
url: "https://eslint.org/docs/latest/rules/no-labels"
},

@@ -28,0 +28,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-lone-blocks"
url: "https://eslint.org/docs/latest/rules/no-lone-blocks"
},

@@ -37,2 +37,3 @@

let ruleDef;
const sourceCode = context.sourceCode;

@@ -72,5 +73,6 @@ /**

* and "marks it" as valid if any.
* @param {ASTNode} node The current node to check.
* @returns {void}
*/
function markLoneBlock() {
function markLoneBlock(node) {
if (loneBlocks.length === 0) {

@@ -80,3 +82,3 @@ return;

const block = context.getAncestors().pop();
const block = node.parent;

@@ -123,9 +125,9 @@ if (loneBlocks[loneBlocks.length - 1] === block) {

if (node.kind === "let" || node.kind === "const") {
markLoneBlock();
markLoneBlock(node);
}
};
ruleDef.FunctionDeclaration = function() {
if (context.getScope().isStrict) {
markLoneBlock();
ruleDef.FunctionDeclaration = function(node) {
if (sourceCode.getScope(node).isStrict) {
markLoneBlock(node);
}

@@ -132,0 +134,0 @@ };

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-lonely-if"
url: "https://eslint.org/docs/latest/rules/no-lonely-if"
},

@@ -32,9 +32,8 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
return {
IfStatement(node) {
const ancestors = context.getAncestors(),
parent = ancestors.pop(),
grandparent = ancestors.pop();
const parent = node.parent,
grandparent = parent.parent;

@@ -41,0 +40,0 @@ if (parent && parent.type === "BlockStatement" &&

@@ -159,3 +159,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-loop-func"
url: "https://eslint.org/docs/latest/rules/no-loop-func"
},

@@ -172,2 +172,4 @@

const sourceCode = context.sourceCode;
/**

@@ -188,3 +190,3 @@ * Reports functions which match the following condition:

const references = context.getScope().through;
const references = sourceCode.getScope(node).through;
const unsafeRefs = references.filter(r => !isSafe(loopNode, r)).map(r => r.identifier.name);

@@ -191,0 +193,0 @@

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-loss-of-precision"
url: "https://eslint.org/docs/latest/rules/no-loss-of-precision"
},

@@ -23,0 +23,0 @@ schema: [],

@@ -37,3 +37,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-magic-numbers"
url: "https://eslint.org/docs/latest/rules/no-magic-numbers"
},

@@ -40,0 +40,0 @@

@@ -6,6 +6,7 @@ /**

const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("eslint-utils");
const { RegExpValidator, RegExpParser, visitRegExpAST } = require("regexpp");
const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("@eslint-community/eslint-utils");
const { RegExpParser, visitRegExpAST } = require("@eslint-community/regexpp");
const { isCombiningCharacter, isEmojiModifier, isRegionalIndicatorSymbol, isSurrogatePair } = require("./utils/unicode");
const astUtils = require("./utils/ast-utils.js");
const { isValidWithUnicodeFlag } = require("./utils/regular-expressions");

@@ -16,4 +17,2 @@ //------------------------------------------------------------------------------

const REGEXPP_LATEST_ECMA_VERSION = 2022;
/**

@@ -114,3 +113,3 @@ * Iterate character sequences of a given nodes.

recommended: true,
url: "https://eslint.org/docs/rules/no-misleading-character-class"
url: "https://eslint.org/docs/latest/rules/no-misleading-character-class"
},

@@ -132,3 +131,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const parser = new RegExpParser();

@@ -192,34 +191,6 @@

/**
* Checks if the given regular expression pattern would be valid with the `u` flag.
* @param {string} pattern The regular expression pattern to verify.
* @returns {boolean} `true` if the pattern would be valid with the `u` flag.
* `false` if the pattern would be invalid with the `u` flag or the configured
* ecmaVersion doesn't support the `u` flag.
*/
function isValidWithUnicodeFlag(pattern) {
const { ecmaVersion } = context.languageOptions;
// ecmaVersion <= 5 doesn't support the 'u' flag
if (ecmaVersion <= 5) {
return false;
}
const validator = new RegExpValidator({
ecmaVersion: Math.min(ecmaVersion, REGEXPP_LATEST_ECMA_VERSION)
});
try {
validator.validatePattern(pattern, void 0, void 0, /* uFlag = */ true);
} catch {
return false;
}
return true;
}
return {
"Literal[regex]"(node) {
verify(node, node.regex.pattern, node.regex.flags, fixer => {
if (!isValidWithUnicodeFlag(node.regex.pattern)) {
if (!isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, node.regex.pattern)) {
return null;

@@ -231,4 +202,4 @@ }

},
"Program"() {
const scope = context.getScope();
"Program"(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);

@@ -241,6 +212,6 @@

*/
for (const { node } of tracker.iterateGlobalReferences({
for (const { node: refNode } of tracker.iterateGlobalReferences({
RegExp: { [CALL]: true, [CONSTRUCT]: true }
})) {
const [patternNode, flagsNode] = node.arguments;
const [patternNode, flagsNode] = refNode.arguments;
const pattern = getStringIfConstant(patternNode, scope);

@@ -250,10 +221,10 @@ const flags = getStringIfConstant(flagsNode, scope);

if (typeof pattern === "string") {
verify(node, pattern, flags || "", fixer => {
verify(refNode, pattern, flags || "", fixer => {
if (!isValidWithUnicodeFlag(pattern)) {
if (!isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, pattern)) {
return null;
}
if (node.arguments.length === 1) {
const penultimateToken = sourceCode.getLastToken(node, { skip: 1 }); // skip closing parenthesis
if (refNode.arguments.length === 1) {
const penultimateToken = sourceCode.getLastToken(refNode, { skip: 1 }); // skip closing parenthesis

@@ -260,0 +231,0 @@ return fixer.insertTextAfter(

@@ -93,3 +93,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-mixed-operators"
url: "https://eslint.org/docs/latest/rules/no-mixed-operators"
},

@@ -126,3 +126,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const options = normalizeOptions(context.options[0]);

@@ -129,0 +129,0 @@

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-mixed-requires"
url: "https://eslint.org/docs/latest/rules/no-mixed-requires"
},

@@ -28,0 +28,0 @@

@@ -19,3 +19,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-mixed-spaces-and-tabs"
url: "https://eslint.org/docs/latest/rules/no-mixed-spaces-and-tabs"
},

@@ -35,3 +35,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -38,0 +38,0 @@ let smartTabs;

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-multi-assign"
url: "https://eslint.org/docs/latest/rules/no-multi-assign"
},

@@ -24,0 +24,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/no-multi-spaces"
url: "https://eslint.org/docs/latest/rules/no-multi-spaces"
},

@@ -56,3 +56,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const options = context.options[0] || {};

@@ -59,0 +59,0 @@ const ignoreEOLComments = options.ignoreEOLComments;

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-multi-str"
url: "https://eslint.org/docs/latest/rules/no-multi-str"
},

@@ -29,0 +29,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-multiple-empty-lines"
url: "https://eslint.org/docs/latest/rules/no-multiple-empty-lines"
},

@@ -68,3 +68,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -71,0 +71,0 @@ // Swallow the final newline, as some editors add it automatically and we don't want it to cause an issue

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-native-reassign"
url: "https://eslint.org/docs/latest/rules/no-native-reassign"
},

@@ -51,2 +51,3 @@

const exceptions = (config && config.exceptions) || [];
const sourceCode = context.sourceCode;

@@ -92,4 +93,4 @@ /**

return {
Program() {
const globalScope = context.getScope();
Program(node) {
const globalScope = sourceCode.getScope(node);

@@ -96,0 +97,0 @@ globalScope.variables.forEach(checkVariable);

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-negated-condition"
url: "https://eslint.org/docs/latest/rules/no-negated-condition"
},

@@ -22,0 +22,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-negated-in-lhs"
url: "https://eslint.org/docs/latest/rules/no-negated-in-lhs"
},

@@ -24,0 +24,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-nested-ternary"
url: "https://eslint.org/docs/latest/rules/no-nested-ternary"
},

@@ -23,0 +23,0 @@

@@ -32,3 +32,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-new-func"
url: "https://eslint.org/docs/latest/rules/no-new-func"
},

@@ -44,6 +44,7 @@

create(context) {
const sourceCode = context.sourceCode;
return {
"Program:exit"() {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);
const variable = globalScope.set.get("Function");

@@ -53,8 +54,8 @@

variable.references.forEach(ref => {
const node = ref.identifier;
const { parent } = node;
const idNode = ref.identifier;
const { parent } = idNode;
let evalNode;
if (parent) {
if (node === parent.callee && (
if (idNode === parent.callee && (
parent.type === "NewExpression" ||

@@ -66,3 +67,3 @@ parent.type === "CallExpression"

parent.type === "MemberExpression" &&
node === parent.object &&
idNode === parent.object &&
callMethods.has(astUtils.getStaticPropertyName(parent))

@@ -69,0 +70,0 @@ ) {

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-new-native-nonconstructor"
url: "https://eslint.org/docs/latest/rules/no-new-native-nonconstructor"
},

@@ -39,5 +39,7 @@

const sourceCode = context.sourceCode;
return {
"Program:exit"() {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);

@@ -49,8 +51,8 @@ for (const nonConstructorName of nonConstructorGlobalFunctionNames) {

variable.references.forEach(ref => {
const node = ref.identifier;
const parent = node.parent;
const idNode = ref.identifier;
const parent = idNode.parent;
if (parent && parent.type === "NewExpression" && parent.callee === node) {
if (parent && parent.type === "NewExpression" && parent.callee === idNode) {
context.report({
node,
node: idNode,
messageId: "noNewNonconstructor",

@@ -57,0 +59,0 @@ data: { name: nonConstructorName }

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-new-object"
url: "https://eslint.org/docs/latest/rules/no-new-object"
},

@@ -38,6 +38,9 @@

create(context) {
const sourceCode = context.sourceCode;
return {
NewExpression(node) {
const variable = astUtils.getVariableByName(
context.getScope(),
sourceCode.getScope(node),
node.callee.name

@@ -44,0 +47,0 @@ );

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-new-require"
url: "https://eslint.org/docs/latest/rules/no-new-require"
},

@@ -28,0 +28,0 @@

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-new-symbol"
url: "https://eslint.org/docs/latest/rules/no-new-symbol"
},

@@ -33,5 +33,7 @@

const sourceCode = context.sourceCode;
return {
"Program:exit"() {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);
const variable = globalScope.set.get("Symbol");

@@ -41,8 +43,8 @@

variable.references.forEach(ref => {
const node = ref.identifier;
const parent = node.parent;
const idNode = ref.identifier;
const parent = idNode.parent;
if (parent && parent.type === "NewExpression" && parent.callee === node) {
if (parent && parent.type === "NewExpression" && parent.callee === idNode) {
context.report({
node,
node: idNode,
messageId: "noNewSymbol"

@@ -49,0 +51,0 @@ });

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-new-wrappers"
url: "https://eslint.org/docs/latest/rules/no-new-wrappers"
},

@@ -23,0 +23,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-new"
url: "https://eslint.org/docs/latest/rules/no-new"
},

@@ -24,0 +24,0 @@

@@ -35,3 +35,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape"
url: "https://eslint.org/docs/latest/rules/no-nonoctal-decimal-escape"
},

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

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -56,0 +56,0 @@ /**

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

const { CALL, CONSTRUCT, ReferenceTracker } = require("eslint-utils");
const { CALL, CONSTRUCT, ReferenceTracker } = require("@eslint-community/eslint-utils");
const getPropertyName = require("./utils/ast-utils").getStaticPropertyName;

@@ -49,3 +49,3 @@

recommended: true,
url: "https://eslint.org/docs/rules/no-obj-calls"
url: "https://eslint.org/docs/latest/rules/no-obj-calls"
},

@@ -63,5 +63,7 @@

const sourceCode = context.sourceCode;
return {
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);

@@ -77,8 +79,8 @@ const traceMap = {};

for (const { node, path } of tracker.iterateGlobalReferences(traceMap)) {
const name = getReportNodeName(node.callee);
for (const { node: refNode, path } of tracker.iterateGlobalReferences(traceMap)) {
const name = getReportNodeName(refNode.callee);
const ref = path[0];
const messageId = name === ref ? "unexpectedCall" : "unexpectedRefCall";
context.report({ node, messageId, data: { name, ref } });
context.report({ node: refNode, messageId, data: { name, ref } });
}

@@ -85,0 +87,0 @@ }

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-octal-escape"
url: "https://eslint.org/docs/latest/rules/no-octal-escape"
},

@@ -23,0 +23,0 @@

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-octal"
url: "https://eslint.org/docs/latest/rules/no-octal"
},

@@ -23,0 +23,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-param-reassign"
url: "https://eslint.org/docs/latest/rules/no-param-reassign"
},

@@ -74,2 +74,3 @@

const ignoredPropertyAssignmentsForRegex = context.options[0] && context.options[0].ignorePropertyModificationsForRegex || [];
const sourceCode = context.sourceCode;

@@ -219,3 +220,3 @@ /**

function checkForFunction(node) {
context.getDeclaredVariables(node).forEach(checkVariable);
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
}

@@ -222,0 +223,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/no-path-concat"
url: "https://eslint.org/docs/latest/rules/no-path-concat"
},

@@ -27,0 +27,0 @@

@@ -56,3 +56,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-plusplus"
url: "https://eslint.org/docs/latest/rules/no-plusplus"
},

@@ -59,0 +59,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/no-process-env"
url: "https://eslint.org/docs/latest/rules/no-process-env"
},

@@ -27,0 +27,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/no-process-exit"
url: "https://eslint.org/docs/latest/rules/no-process-exit"
},

@@ -27,0 +27,0 @@

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

const { findVariable } = require("eslint-utils");
const { findVariable } = require("@eslint-community/eslint-utils");

@@ -75,3 +75,3 @@ //------------------------------------------------------------------------------

recommended: false,
url: "https://eslint.org/docs/rules/no-promise-executor-return"
url: "https://eslint.org/docs/latest/rules/no-promise-executor-return"
},

@@ -89,2 +89,3 @@

let funcInfo = null;
const sourceCode = context.sourceCode;

@@ -105,3 +106,3 @@ /**

upper: funcInfo,
shouldCheck: functionTypesToCheck.has(node.type) && isPromiseExecutor(node, context.getScope())
shouldCheck: functionTypesToCheck.has(node.type) && isPromiseExecutor(node, sourceCode.getScope(node))
};

@@ -108,0 +109,0 @@

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-proto"
url: "https://eslint.org/docs/latest/rules/no-proto"
},

@@ -29,0 +29,0 @@

@@ -25,3 +25,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-prototype-builtins"
url: "https://eslint.org/docs/latest/rules/no-prototype-builtins"
},

@@ -28,0 +28,0 @@

@@ -26,3 +26,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-redeclare"
url: "https://eslint.org/docs/latest/rules/no-redeclare"
},

@@ -54,3 +54,3 @@

};
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -134,3 +134,3 @@ /**

function checkForBlock(node) {
const scope = context.getScope();
const scope = sourceCode.getScope(node);

@@ -147,4 +147,4 @@ /*

return {
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);

@@ -151,0 +151,0 @@ findVariablesInScope(scope);

@@ -13,3 +13,3 @@ /**

const astUtils = require("./utils/ast-utils");
const regexpp = require("regexpp");
const regexpp = require("@eslint-community/regexpp");

@@ -45,3 +45,3 @@ //------------------------------------------------------------------------------

recommended: true,
url: "https://eslint.org/docs/rules/no-regex-spaces"
url: "https://eslint.org/docs/latest/rules/no-regex-spaces"
},

@@ -59,2 +59,4 @@

const sourceCode = context.sourceCode;
/**

@@ -155,3 +157,3 @@ * Validate regular expression

function checkFunction(node) {
const scope = context.getScope();
const scope = sourceCode.getScope(node);
const regExpVar = astUtils.getVariableByName(scope, "RegExp");

@@ -158,0 +160,0 @@ const shadowed = regExpVar && regExpVar.defs.length > 0;

@@ -26,21 +26,71 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-restricted-exports"
url: "https://eslint.org/docs/latest/rules/no-restricted-exports"
},
schema: [{
type: "object",
properties: {
restrictedNamedExports: {
type: "array",
items: {
type: "string"
anyOf: [
{
type: "object",
properties: {
restrictedNamedExports: {
type: "array",
items: {
type: "string"
},
uniqueItems: true
}
},
uniqueItems: true
additionalProperties: false
},
{
type: "object",
properties: {
restrictedNamedExports: {
type: "array",
items: {
type: "string",
pattern: "^(?!default$)"
},
uniqueItems: true
},
restrictDefaultExports: {
type: "object",
properties: {
// Allow/Disallow `export default foo; export default 42; export default function foo() {}` format
direct: {
type: "boolean"
},
// Allow/Disallow `export { foo as default };` declarations
named: {
type: "boolean"
},
// Allow/Disallow `export { default } from "mod"; export { default as default } from "mod";` declarations
defaultFrom: {
type: "boolean"
},
// Allow/Disallow `export { foo as default } from "mod";` declarations
namedFrom: {
type: "boolean"
},
// Allow/Disallow `export * as default from "mod"`; declarations
namespaceFrom: {
type: "boolean"
}
},
additionalProperties: false
}
},
additionalProperties: false
}
},
additionalProperties: false
]
}],
messages: {
restrictedNamed: "'{{name}}' is restricted from being used as an exported name."
restrictedNamed: "'{{name}}' is restricted from being used as an exported name.",
restrictedDefault: "Exporting 'default' is restricted."
}

@@ -52,2 +102,4 @@ },

const restrictedNames = new Set(context.options[0] && context.options[0].restrictedNamedExports);
const restrictDefaultExports = context.options[0] && context.options[0].restrictDefaultExports;
const sourceCode = context.sourceCode;

@@ -68,3 +120,39 @@ /**

});
return;
}
if (name === "default") {
if (node.parent.type === "ExportAllDeclaration") {
if (restrictDefaultExports && restrictDefaultExports.namespaceFrom) {
context.report({
node,
messageId: "restrictedDefault"
});
}
} else { // ExportSpecifier
const isSourceSpecified = !!node.parent.parent.source;
const specifierLocalName = astUtils.getModuleExportName(node.parent.local);
if (!isSourceSpecified && restrictDefaultExports && restrictDefaultExports.named) {
context.report({
node,
messageId: "restrictedDefault"
});
return;
}
if (isSourceSpecified && restrictDefaultExports) {
if (
(specifierLocalName === "default" && restrictDefaultExports.defaultFrom) ||
(specifierLocalName !== "default" && restrictDefaultExports.namedFrom)
) {
context.report({
node,
messageId: "restrictedDefault"
});
}
}
}
}
}

@@ -79,2 +167,11 @@

ExportDefaultDeclaration(node) {
if (restrictDefaultExports && restrictDefaultExports.direct) {
context.report({
node,
messageId: "restrictedDefault"
});
}
},
ExportNamedDeclaration(node) {

@@ -87,3 +184,3 @@ const declaration = node.declaration;

} else if (declaration.type === "VariableDeclaration") {
context.getDeclaredVariables(declaration)
sourceCode.getDeclaredVariables(declaration)
.map(v => v.defs.find(d => d.parent === declaration))

@@ -90,0 +187,0 @@ .map(d => d.name) // Identifier nodes

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-restricted-globals"
url: "https://eslint.org/docs/latest/rules/no-restricted-globals"
},

@@ -54,2 +54,4 @@

const sourceCode = context.sourceCode;
// If no globals are restricted, we don't need to do anything

@@ -104,4 +106,4 @@ if (context.options.length === 0) {

return {
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);

@@ -108,0 +110,0 @@ // Report variables declared elsewhere (ex: variables defined as "global" by eslint)

@@ -101,3 +101,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-restricted-imports"
url: "https://eslint.org/docs/latest/rules/no-restricted-imports"
},

@@ -151,3 +151,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const options = Array.isArray(context.options) ? context.options : [];

@@ -154,0 +154,0 @@ const isPathAndPatternsObject =

@@ -54,3 +54,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-restricted-modules"
url: "https://eslint.org/docs/latest/rules/no-restricted-modules"
},

@@ -57,0 +57,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/no-restricted-properties"
url: "https://eslint.org/docs/latest/rules/no-restricted-properties"
},

@@ -25,0 +25,0 @@

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-restricted-syntax"
url: "https://eslint.org/docs/latest/rules/no-restricted-syntax"
},

@@ -22,0 +22,0 @@

@@ -31,3 +31,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-return-assign"
url: "https://eslint.org/docs/latest/rules/no-return-assign"
},

@@ -49,3 +49,3 @@

const always = (context.options[0] || "except-parens") !== "except-parens";
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -52,0 +52,0 @@ return {

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

url: "https://eslint.org/docs/rules/no-return-await"
url: "https://eslint.org/docs/latest/rules/no-return-await"
},

@@ -48,3 +48,3 @@

context.report({
node: context.getSourceCode().getFirstToken(node),
node: context.sourceCode.getFirstToken(node),
loc: node.loc,

@@ -56,3 +56,3 @@ messageId: "redundantUseOfAwait",

fix(fixer) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const [awaitToken, tokenAfterAwait] = sourceCode.getFirstTokens(node, 2);

@@ -59,0 +59,0 @@

@@ -23,3 +23,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-script-url"
url: "https://eslint.org/docs/latest/rules/no-script-url"
},

@@ -26,0 +26,0 @@

@@ -135,3 +135,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-self-assign"
url: "https://eslint.org/docs/latest/rules/no-self-assign"
},

@@ -158,3 +158,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const [{ props = true } = {}] = context.options;

@@ -161,0 +161,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-self-compare"
url: "https://eslint.org/docs/latest/rules/no-self-compare"
},

@@ -33,3 +33,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -36,0 +36,0 @@ /**

@@ -34,3 +34,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-sequences"
url: "https://eslint.org/docs/latest/rules/no-sequences"
},

@@ -55,3 +55,3 @@

const options = Object.assign({}, DEFAULT_OPTIONS, context.options[0]);
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -58,0 +58,0 @@ /**

@@ -13,3 +13,3 @@ /**

const astUtils = require("./utils/ast-utils");
const { findVariable } = require("eslint-utils");
const { findVariable } = require("@eslint-community/eslint-utils");

@@ -148,3 +148,3 @@ //------------------------------------------------------------------------------

recommended: true,
url: "https://eslint.org/docs/rules/no-setter-return"
url: "https://eslint.org/docs/latest/rules/no-setter-return"
},

@@ -161,2 +161,3 @@

let funcInfo = null;
const sourceCode = context.sourceCode;

@@ -169,3 +170,3 @@ /**

function enterFunction(node) {
const outerScope = getOuterScope(context.getScope());
const outerScope = getOuterScope(sourceCode.getScope(node));

@@ -172,0 +173,0 @@ funcInfo = {

@@ -32,3 +32,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-shadow-restricted-names"
url: "https://eslint.org/docs/latest/rules/no-shadow-restricted-names"
},

@@ -47,6 +47,7 @@

const RESTRICTED = new Set(["undefined", "NaN", "Infinity", "arguments", "eval"]);
const sourceCode = context.sourceCode;
return {
"VariableDeclaration, :function, CatchClause"(node) {
for (const variable of context.getDeclaredVariables(node)) {
for (const variable of sourceCode.getDeclaredVariables(node)) {
if (variable.defs.length > 0 && RESTRICTED.has(variable.name) && !safelyShadowsUndefined(variable)) {

@@ -53,0 +54,0 @@ context.report({

@@ -35,3 +35,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-shadow"
url: "https://eslint.org/docs/latest/rules/no-shadow"
},

@@ -71,2 +71,3 @@

};
const sourceCode = context.sourceCode;

@@ -323,4 +324,4 @@ /**

return {
"Program:exit"() {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);
const stack = globalScope.childScopes.slice();

@@ -327,0 +328,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-spaced-func"
url: "https://eslint.org/docs/latest/rules/no-spaced-func"
},

@@ -39,3 +39,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -42,0 +42,0 @@ /**

@@ -19,3 +19,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-sparse-arrays"
url: "https://eslint.org/docs/latest/rules/no-sparse-arrays"
},

@@ -22,0 +22,0 @@

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-sync"
url: "https://eslint.org/docs/latest/rules/no-sync"
},

@@ -28,0 +28,0 @@

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-tabs"
url: "https://eslint.org/docs/latest/rules/no-tabs"
},

@@ -47,3 +47,3 @@ schema: [{

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const allowIndentationTabs = context.options && context.options[0] && context.options[0].allowIndentationTabs;

@@ -50,0 +50,0 @@

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-template-curly-in-string"
url: "https://eslint.org/docs/latest/rules/no-template-curly-in-string"
},

@@ -22,0 +22,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-ternary"
url: "https://eslint.org/docs/latest/rules/no-ternary"
},

@@ -23,0 +23,0 @@

@@ -45,3 +45,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-this-before-super"
url: "https://eslint.org/docs/latest/rules/no-this-before-super"
},

@@ -48,0 +48,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/no-throw-literal"
url: "https://eslint.org/docs/latest/rules/no-throw-literal"
},

@@ -25,0 +25,0 @@

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-trailing-spaces"
url: "https://eslint.org/docs/latest/rules/no-trailing-spaces"
},

@@ -54,3 +54,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -57,0 +57,0 @@ const BLANK_CLASS = "[ \t\u00a0\u2000-\u200b\u3000]",

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

recommended: false,
url: "https://eslint.org/docs/rules/no-undef-init"
url: "https://eslint.org/docs/latest/rules/no-undef-init"
},

@@ -36,3 +36,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -44,3 +44,3 @@ return {

init = node.init && node.init.name,
scope = context.getScope(),
scope = sourceCode.getScope(node),
undefinedVar = astUtils.getVariableByName(scope, "undefined"),

@@ -47,0 +47,0 @@ shadowed = undefinedVar && undefinedVar.defs.length > 0,

@@ -34,3 +34,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-undef"
url: "https://eslint.org/docs/latest/rules/no-undef"
},

@@ -58,6 +58,7 @@

const considerTypeOf = options && options.typeof === true || false;
const sourceCode = context.sourceCode;
return {
"Program:exit"(/* node */) {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);

@@ -64,0 +65,0 @@ globalScope.through.forEach(ref => {

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-undefined"
url: "https://eslint.org/docs/latest/rules/no-undefined"
},

@@ -32,2 +32,4 @@

const sourceCode = context.sourceCode;
/**

@@ -71,4 +73,4 @@ * Report an invalid "undefined" identifier node.

return {
"Program:exit"() {
const globalScope = context.getScope();
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);

@@ -75,0 +77,0 @@ const stack = [globalScope];

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-underscore-dangle"
url: "https://eslint.org/docs/latest/rules/no-underscore-dangle"
},

@@ -88,2 +88,3 @@

const allowInObjectDestructuring = typeof options.allowInObjectDestructuring !== "undefined" ? options.allowInObjectDestructuring : true;
const sourceCode = context.sourceCode;

@@ -218,3 +219,3 @@ //-------------------------------------------------------------------------

function checkForDanglingUnderscoreInVariableExpression(node) {
context.getDeclaredVariables(node).forEach(variable => {
sourceCode.getDeclaredVariables(node).forEach(variable => {
const definition = variable.defs.find(def => def.node === node);

@@ -221,0 +222,0 @@ const identifierNode = definition.name;

@@ -25,3 +25,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-unexpected-multiline"
url: "https://eslint.org/docs/latest/rules/no-unexpected-multiline"
},

@@ -42,3 +42,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -45,0 +45,0 @@ /**

@@ -167,3 +167,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-unmodified-loop-condition"
url: "https://eslint.org/docs/latest/rules/no-unmodified-loop-condition"
},

@@ -179,3 +179,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let groupMap = null;

@@ -345,4 +345,4 @@

return {
"Program:exit"() {
const queue = [context.getScope()];
"Program:exit"(node) {
const queue = [sourceCode.getScope(node)];

@@ -349,0 +349,0 @@ groupMap = new Map();

@@ -34,3 +34,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-unneeded-ternary"
url: "https://eslint.org/docs/latest/rules/no-unneeded-ternary"
},

@@ -62,3 +62,3 @@

const defaultAssignment = options.defaultAssignment !== false;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -65,0 +65,0 @@ /**

@@ -64,3 +64,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-unreachable-loop"
url: "https://eslint.org/docs/latest/rules/no-unreachable-loop"
},

@@ -67,0 +67,0 @@

@@ -116,3 +116,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-unreachable"
url: "https://eslint.org/docs/latest/rules/no-unreachable"
},

@@ -134,3 +134,3 @@

/** @type {ConsecutiveRange} */
const range = new ConsecutiveRange(context.getSourceCode());
const range = new ConsecutiveRange(context.sourceCode);

@@ -137,0 +137,0 @@ /**

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

recommended: true,
url: "https://eslint.org/docs/rules/no-unsafe-finally"
url: "https://eslint.org/docs/latest/rules/no-unsafe-finally"
},

@@ -32,0 +32,0 @@

@@ -57,3 +57,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-unsafe-negation"
url: "https://eslint.org/docs/latest/rules/no-unsafe-negation"
},

@@ -86,3 +86,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const options = context.options[0] || {};

@@ -89,0 +89,0 @@ const enforceForOrderingRelations = options.enforceForOrderingRelations === true;

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

recommended: true,
url: "https://eslint.org/docs/rules/no-unsafe-optional-chaining"
url: "https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining"
},

@@ -32,0 +32,0 @@ schema: [{

@@ -35,3 +35,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-unused-expressions"
url: "https://eslint.org/docs/latest/rules/no-unused-expressions"
},

@@ -113,8 +113,7 @@

* @param {ASTNode} node any node
* @param {ASTNode[]} ancestors the given node's ancestors
* @returns {boolean} whether the given node is considered a directive in its current position
*/
function isDirective(node, ancestors) {
const parent = ancestors[ancestors.length - 1],
grandparent = ancestors[ancestors.length - 2];
function isDirective(node) {
const parent = node.parent,
grandparent = parent.parent;

@@ -185,3 +184,3 @@ /**

ExpressionStatement(node) {
if (Checker.isDisallowed(node.expression) && !isDirective(node, context.getAncestors())) {
if (Checker.isDisallowed(node.expression) && !isDirective(node)) {
context.report({ node, messageId: "unusedExpression" });

@@ -188,0 +187,0 @@ }

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-unused-labels"
url: "https://eslint.org/docs/latest/rules/no-unused-labels"
},

@@ -34,3 +34,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let scopeInfo = null;

@@ -37,0 +37,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-unused-private-class-members"
url: "https://eslint.org/docs/latest/rules/no-unused-private-class-members"
},

@@ -23,0 +23,0 @@

@@ -38,3 +38,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-unused-vars"
url: "https://eslint.org/docs/latest/rules/no-unused-vars"
},

@@ -88,3 +88,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -560,3 +560,3 @@ const REST_PROPERTY_TYPE = /^(?:RestElement|(?:Experimental)?RestProperty)$/u;

const def = variable.defs[0];
const params = context.getDeclaredVariables(def.node);
const params = sourceCode.getDeclaredVariables(def.node);
const posteriorParams = params.slice(params.indexOf(variable) + 1);

@@ -679,3 +679,3 @@

"Program:exit"(programNode) {
const unusedVars = collectUnusedVariables(context.getScope(), []);
const unusedVars = collectUnusedVariables(sourceCode.getScope(programNode), []);

@@ -682,0 +682,0 @@ for (let i = 0, l = unusedVars.length; i < l; ++i) {

@@ -231,3 +231,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-use-before-define"
url: "https://eslint.org/docs/latest/rules/no-use-before-define"
},

@@ -262,2 +262,3 @@

const options = parseOptions(context.options[0]);
const sourceCode = context.sourceCode;

@@ -344,4 +345,4 @@ /**

return {
Program() {
checkReferencesInScope(context.getScope());
Program(node) {
checkReferencesInScope(sourceCode.getScope(node));
}

@@ -348,0 +349,0 @@ };

@@ -12,4 +12,4 @@ /**

const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("eslint-utils");
const { RegExpParser, visitRegExpAST } = require("regexpp");
const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("@eslint-community/eslint-utils");
const { RegExpParser, visitRegExpAST } = require("@eslint-community/regexpp");

@@ -70,3 +70,3 @@ //------------------------------------------------------------------------------

recommended: true,
url: "https://eslint.org/docs/rules/no-useless-backreference"
url: "https://eslint.org/docs/latest/rules/no-useless-backreference"
},

@@ -87,2 +87,4 @@

const sourceCode = context.sourceCode;
/**

@@ -173,4 +175,4 @@ * Checks and reports useless backreferences in the given regular expression.

},
Program() {
const scope = context.getScope(),
Program(node) {
const scope = sourceCode.getScope(node),
tracker = new ReferenceTracker(scope),

@@ -184,4 +186,4 @@ traceMap = {

for (const { node } of tracker.iterateGlobalReferences(traceMap)) {
const [patternNode, flagsNode] = node.arguments,
for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) {
const [patternNode, flagsNode] = refNode.arguments,
pattern = getStringIfConstant(patternNode, scope),

@@ -191,3 +193,3 @@ flags = getStringIfConstant(flagsNode, scope);

if (typeof pattern === "string") {
checkRegex(node, pattern, flags || "");
checkRegex(refNode, pattern, flags || "");
}

@@ -194,0 +196,0 @@ }

@@ -60,3 +60,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-useless-call"
url: "https://eslint.org/docs/latest/rules/no-useless-call"
},

@@ -72,3 +72,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -75,0 +75,0 @@ return {

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-useless-catch"
url: "https://eslint.org/docs/latest/rules/no-useless-catch"
},

@@ -23,0 +23,0 @@

@@ -96,3 +96,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-useless-computed-key"
url: "https://eslint.org/docs/latest/rules/no-useless-computed-key"
},

@@ -117,3 +117,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const enforceForClassMembers = context.options[0] && context.options[0].enforceForClassMembers;

@@ -120,0 +120,0 @@

@@ -75,3 +75,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-useless-concat"
url: "https://eslint.org/docs/latest/rules/no-useless-concat"
},

@@ -87,3 +87,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -90,0 +90,0 @@ return {

@@ -143,3 +143,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-useless-constructor"
url: "https://eslint.org/docs/latest/rules/no-useless-constructor"
},

@@ -146,0 +146,0 @@

@@ -89,3 +89,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-useless-escape"
url: "https://eslint.org/docs/latest/rules/no-useless-escape"
},

@@ -105,3 +105,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -108,0 +108,0 @@ /**

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-useless-rename"
url: "https://eslint.org/docs/latest/rules/no-useless-rename"
},

@@ -50,3 +50,3 @@

create(context) {
const sourceCode = context.getSourceCode(),
const sourceCode = context.sourceCode,
options = context.options[0] || {},

@@ -53,0 +53,0 @@ ignoreDestructuring = options.ignoreDestructuring === true,

@@ -72,3 +72,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-useless-return"
url: "https://eslint.org/docs/latest/rules/no-useless-return"
},

@@ -86,4 +86,3 @@

const segmentInfoMap = new WeakMap();
const usedUnreachableSegments = new WeakSet();
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let scopeInfo = null;

@@ -157,5 +156,6 @@

* @param {CodePathSegment} segment The segment to get return statements.
* @param {Set<CodePathSegment>} usedUnreachableSegments A set of segments that have already been traversed in this call.
* @returns {void}
*/
function markReturnStatementsOnSegmentAsUsed(segment) {
function markReturnStatementsOnSegmentAsUsed(segment, usedUnreachableSegments) {
if (!segment.reachable) {

@@ -166,3 +166,3 @@ usedUnreachableSegments.add(segment);

.filter(prevSegment => !usedUnreachableSegments.has(prevSegment))
.forEach(markReturnStatementsOnSegmentAsUsed);
.forEach(prevSegment => markReturnStatementsOnSegmentAsUsed(prevSegment, usedUnreachableSegments));
return;

@@ -173,6 +173,25 @@ }

for (const node of info.uselessReturns) {
info.uselessReturns = info.uselessReturns.filter(node => {
if (scopeInfo.traversedTryBlockStatements && scopeInfo.traversedTryBlockStatements.length > 0) {
const returnInitialRange = node.range[0];
const returnFinalRange = node.range[1];
const areBlocksInRange = scopeInfo.traversedTryBlockStatements.some(tryBlockStatement => {
const blockInitialRange = tryBlockStatement.range[0];
const blockFinalRange = tryBlockStatement.range[1];
return (
returnInitialRange >= blockInitialRange &&
returnFinalRange <= blockFinalRange
);
});
if (areBlocksInRange) {
return true;
}
}
remove(scopeInfo.uselessReturns, node);
}
info.uselessReturns = [];
return false;
});
}

@@ -196,3 +215,3 @@

.currentSegments
.forEach(markReturnStatementsOnSegmentAsUsed);
.forEach(segment => markReturnStatementsOnSegmentAsUsed(segment, new Set()));
}

@@ -206,3 +225,3 @@

// Makes and pushs a new scope information.
// Makes and pushes a new scope information.
onCodePathStart(codePath) {

@@ -212,2 +231,3 @@ scopeInfo = {

uselessReturns: [],
traversedTryBlockStatements: [],
codePath

@@ -286,2 +306,10 @@ };

"TryStatement > BlockStatement.block:exit"(node) {
scopeInfo.traversedTryBlockStatements.push(node);
},
"TryStatement:exit"() {
scopeInfo.traversedTryBlockStatements.pop();
},
/*

@@ -288,0 +316,0 @@ * Registers for all statement nodes except FunctionDeclaration, BlockStatement, BreakStatement.

@@ -190,3 +190,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-var"
url: "https://eslint.org/docs/latest/rules/no-var"
},

@@ -203,3 +203,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -215,3 +215,3 @@ /**

}
const variables = context.getDeclaredVariables(declarator);
const variables = sourceCode.getDeclaredVariables(declarator);

@@ -274,3 +274,3 @@ return variables.some(hasReferenceInTDZ(declarator.init));

function canFix(node) {
const variables = context.getDeclaredVariables(node);
const variables = sourceCode.getDeclaredVariables(node);
const scopeNode = getScopeNode(node);

@@ -277,0 +277,0 @@

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-void"
url: "https://eslint.org/docs/latest/rules/no-void"
},

@@ -22,0 +22,0 @@

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-warning-comments"
url: "https://eslint.org/docs/latest/rules/no-warning-comments"
},

@@ -62,3 +62,3 @@

create(context) {
const sourceCode = context.getSourceCode(),
const sourceCode = context.sourceCode,
configuration = context.options[0] || {},

@@ -65,0 +65,0 @@ warningTerms = configuration.terms || ["todo", "fixme", "xxx"],

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/no-whitespace-before-property"
url: "https://eslint.org/docs/latest/rules/no-whitespace-before-property"
},

@@ -38,3 +38,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -41,0 +41,0 @@ //--------------------------------------------------------------------------

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/no-with"
url: "https://eslint.org/docs/latest/rules/no-with"
},

@@ -23,0 +23,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/nonblock-statement-body-position"
url: "https://eslint.org/docs/latest/rules/nonblock-statement-body-position"
},

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

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

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

@@ -155,3 +155,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/object-curly-newline"
url: "https://eslint.org/docs/latest/rules/object-curly-newline"
},

@@ -189,3 +189,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const normalizedOptions = normalizeOptions(context.options[0]);

@@ -192,0 +192,0 @@

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/object-curly-spacing"
url: "https://eslint.org/docs/latest/rules/object-curly-spacing"
},

@@ -55,3 +55,3 @@

const spaced = context.options[0] === "always",
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -86,3 +86,3 @@ /**

function reportNoBeginningSpace(node, token) {
const nextToken = context.getSourceCode().getTokenAfter(token, { includeComments: true });
const nextToken = context.sourceCode.getTokenAfter(token, { includeComments: true });

@@ -109,3 +109,3 @@ context.report({

function reportNoEndingSpace(node, token) {
const previousToken = context.getSourceCode().getTokenBefore(token, { includeComments: true });
const previousToken = context.sourceCode.getTokenBefore(token, { includeComments: true });

@@ -112,0 +112,0 @@ context.report({

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/object-property-newline"
url: "https://eslint.org/docs/latest/rules/object-property-newline"
},

@@ -57,3 +57,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -60,0 +60,0 @@ return {

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

recommended: false,
url: "https://eslint.org/docs/rules/object-shorthand"
url: "https://eslint.org/docs/latest/rules/object-shorthand"
},

@@ -127,3 +127,3 @@

const AVOID_EXPLICIT_RETURN_ARROWS = !!PARAMS.avoidExplicitReturnArrows;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -359,7 +359,8 @@ //--------------------------------------------------------------------------

* Also, this marks all `arguments` identifiers so that they can be detected later.
* @param {ASTNode} node The node representing the function.
* @returns {void}
*/
function enterFunction() {
function enterFunction(node) {
lexicalScopeStack.unshift(new Set());
context.getScope().variables.filter(variable => variable.name === "arguments").forEach(variable => {
sourceCode.getScope(node).variables.filter(variable => variable.name === "arguments").forEach(variable => {
variable.references.map(ref => ref.identifier).forEach(identifier => argumentsIdentifiers.add(identifier));

@@ -366,0 +367,0 @@ });

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/one-var-declaration-per-line"
url: "https://eslint.org/docs/latest/rules/one-var-declaration-per-line"
},

@@ -22,0 +22,0 @@

@@ -39,3 +39,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/one-var"
url: "https://eslint.org/docs/latest/rules/one-var"
},

@@ -125,3 +125,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -128,0 +128,0 @@ //--------------------------------------------------------------------------

@@ -68,3 +68,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/operator-assignment"
url: "https://eslint.org/docs/latest/rules/operator-assignment"
},

@@ -87,3 +87,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -90,0 +90,0 @@ /**

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/operator-linebreak"
url: "https://eslint.org/docs/latest/rules/operator-linebreak"
},

@@ -73,3 +73,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -76,0 +76,0 @@ //--------------------------------------------------------------------------

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/padded-blocks"
url: "https://eslint.org/docs/latest/rules/padded-blocks"
},

@@ -100,3 +100,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -103,0 +103,0 @@ /**

@@ -256,3 +256,3 @@ /**

const end = nextToken.range[0];
const text = context.getSourceCode().text
const text = context.sourceCode.text
.slice(start, end)

@@ -288,3 +288,3 @@ .replace(PADDING_LINE_SEQUENCE, replacerToRemovePaddingLines);

fix(fixer) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let prevToken = getActualLastToken(sourceCode, prevNode);

@@ -438,3 +438,3 @@ const nextToken = sourceCode.getFirstTokenBetween(

recommended: false,
url: "https://eslint.org/docs/rules/padding-line-between-statements"
url: "https://eslint.org/docs/latest/rules/padding-line-between-statements"
},

@@ -481,3 +481,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const configureList = context.options || [];

@@ -484,0 +484,0 @@ let scopeInfo = null;

@@ -156,3 +156,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-arrow-callback"
url: "https://eslint.org/docs/latest/rules/prefer-arrow-callback"
},

@@ -189,3 +189,3 @@

const allowNamedFunctions = options.allowNamedFunctions;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -268,3 +268,3 @@ /*

// Skip recursive functions.
const nameVar = context.getDeclaredVariables(node)[0];
const nameVar = sourceCode.getDeclaredVariables(node)[0];

@@ -276,3 +276,3 @@ if (isFunctionName(nameVar) && nameVar.references.length > 0) {

// Skip if it's using arguments.
const variable = getVariableOfArguments(context.getScope());
const variable = getVariableOfArguments(sourceCode.getScope(node));

@@ -279,0 +279,0 @@ if (variable && variable.references.length > 0) {

@@ -337,3 +337,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-const"
url: "https://eslint.org/docs/latest/rules/prefer-const"
},

@@ -360,3 +360,3 @@

const options = context.options[0] || {};
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const shouldMatchAnyDestructuredVariable = options.destructuring !== "all";

@@ -498,3 +498,3 @@ const ignoreReadBeforeAssign = options.ignoreReadBeforeAssign === true;

if (node.kind === "let" && !isInitOfForStatement(node)) {
variables.push(...context.getDeclaredVariables(node));
variables.push(...sourceCode.getDeclaredVariables(node));
}

@@ -501,0 +501,0 @@ }

@@ -31,3 +31,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-destructuring"
url: "https://eslint.org/docs/latest/rules/prefer-destructuring"
},

@@ -194,3 +194,3 @@

const rightNode = node.init;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -197,0 +197,0 @@ // Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved.

@@ -13,3 +13,3 @@ /**

const astUtils = require("./utils/ast-utils");
const { CALL, ReferenceTracker } = require("eslint-utils");
const { CALL, ReferenceTracker } = require("@eslint-community/eslint-utils");

@@ -96,3 +96,3 @@ //------------------------------------------------------------------------------

recommended: false,
url: "https://eslint.org/docs/rules/prefer-exponentiation-operator"
url: "https://eslint.org/docs/latest/rules/prefer-exponentiation-operator"
},

@@ -109,3 +109,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -178,4 +178,4 @@ /**

return {
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);

@@ -188,4 +188,4 @@ const trackMap = {

for (const { node } of tracker.iterateGlobalReferences(trackMap)) {
report(node);
for (const { node: refNode } of tracker.iterateGlobalReferences(trackMap)) {
report(refNode);
}

@@ -192,0 +192,0 @@ }

@@ -17,4 +17,4 @@ /**

getStringIfConstant
} = require("eslint-utils");
const regexpp = require("regexpp");
} = require("@eslint-community/eslint-utils");
const regexpp = require("@eslint-community/regexpp");

@@ -94,3 +94,3 @@ //------------------------------------------------------------------------------

recommended: false,
url: "https://eslint.org/docs/rules/prefer-named-capture-group"
url: "https://eslint.org/docs/latest/rules/prefer-named-capture-group"
},

@@ -110,3 +110,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -157,4 +157,4 @@ /**

},
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);

@@ -168,8 +168,8 @@ const traceMap = {

for (const { node } of tracker.iterateGlobalReferences(traceMap)) {
const regex = getStringIfConstant(node.arguments[0]);
const flags = getStringIfConstant(node.arguments[1]);
for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) {
const regex = getStringIfConstant(refNode.arguments[0]);
const flags = getStringIfConstant(refNode.arguments[1]);
if (regex) {
checkRegex(regex, node, node.arguments[0], flags && flags.includes("u"));
checkRegex(regex, refNode, refNode.arguments[0], flags && flags.includes("u"));
}

@@ -176,0 +176,0 @@ }

@@ -50,3 +50,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-numeric-literals"
url: "https://eslint.org/docs/latest/rules/prefer-numeric-literals"
},

@@ -64,3 +64,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -67,0 +67,0 @@ //----------------------------------------------------------------------

@@ -55,3 +55,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-object-has-own"
url: "https://eslint.org/docs/latest/rules/prefer-object-has-own"
},

@@ -65,2 +65,5 @@ schema: [],

create(context) {
const sourceCode = context.sourceCode;
return {

@@ -77,3 +80,3 @@ CallExpression(node) {

// check `Object` scope
const scope = context.getScope();
const scope = sourceCode.getScope(node);
const variable = astUtils.getVariableByName(scope, "Object");

@@ -91,3 +94,2 @@

fix(fixer) {
const sourceCode = context.getSourceCode();

@@ -94,0 +96,0 @@ if (sourceCode.getCommentsInside(node.callee).length > 0) {

/**
* @fileoverview Prefers object spread property over Object.assign
* @author Sharmila Jesupaul
* See LICENSE file in root directory for full license.
*/

@@ -9,3 +8,3 @@

const { CALL, ReferenceTracker } = require("eslint-utils");
const { CALL, ReferenceTracker } = require("@eslint-community/eslint-utils");
const {

@@ -253,3 +252,3 @@ isCommaToken,

recommended: false,
url: "https://eslint.org/docs/rules/prefer-object-spread"
url: "https://eslint.org/docs/latest/rules/prefer-object-spread"
},

@@ -267,7 +266,7 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
return {
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);

@@ -281,18 +280,18 @@ const trackMap = {

// Iterate all calls of `Object.assign` (only of the global variable `Object`).
for (const { node } of tracker.iterateGlobalReferences(trackMap)) {
for (const { node: refNode } of tracker.iterateGlobalReferences(trackMap)) {
if (
node.arguments.length >= 1 &&
node.arguments[0].type === "ObjectExpression" &&
!hasArraySpread(node) &&
refNode.arguments.length >= 1 &&
refNode.arguments[0].type === "ObjectExpression" &&
!hasArraySpread(refNode) &&
!(
node.arguments.length > 1 &&
hasArgumentsWithAccessors(node)
refNode.arguments.length > 1 &&
hasArgumentsWithAccessors(refNode)
)
) {
const messageId = node.arguments.length === 1
const messageId = refNode.arguments.length === 1
? "useLiteralMessage"
: "useSpreadMessage";
const fix = defineFixer(node, sourceCode);
const fix = defineFixer(refNode, sourceCode);
context.report({ node, messageId, fix });
context.report({ node: refNode, messageId, fix });
}

@@ -299,0 +298,0 @@ }

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-promise-reject-errors"
url: "https://eslint.org/docs/latest/rules/prefer-promise-reject-errors"
},

@@ -45,2 +45,3 @@

const ALLOW_EMPTY_REJECT = context.options.length && context.options[0].allowEmptyReject;
const sourceCode = context.sourceCode;

@@ -105,3 +106,3 @@ //----------------------------------------------------------------------

) {
context.getDeclaredVariables(node.arguments[0])
sourceCode.getDeclaredVariables(node.arguments[0])

@@ -108,0 +109,0 @@ /*

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-reflect"
url: "https://eslint.org/docs/latest/rules/prefer-reflect"
},

@@ -23,0 +23,0 @@

@@ -13,5 +13,6 @@ /**

const astUtils = require("./utils/ast-utils");
const { CALL, CONSTRUCT, ReferenceTracker, findVariable } = require("eslint-utils");
const { RegExpValidator, visitRegExpAST, RegExpParser } = require("regexpp");
const { CALL, CONSTRUCT, ReferenceTracker, findVariable } = require("@eslint-community/eslint-utils");
const { RegExpValidator, visitRegExpAST, RegExpParser } = require("@eslint-community/regexpp");
const { canTokensBeAdjacent } = require("./utils/ast-utils");
const { REGEXPP_LATEST_ECMA_VERSION } = require("./utils/regular-expressions");

@@ -22,4 +23,2 @@ //------------------------------------------------------------------------------

const REGEXPP_LATEST_ECMA_VERSION = 2022;
/**

@@ -130,3 +129,3 @@ * Determines whether the given node is a string literal.

recommended: false,
url: "https://eslint.org/docs/rules/prefer-regex-literals"
url: "https://eslint.org/docs/latest/rules/prefer-regex-literals"
},

@@ -152,2 +151,4 @@

replaceWithLiteral: "Replace with an equivalent regular expression literal.",
replaceWithLiteralAndFlags: "Replace with an equivalent regular expression literal with flags '{{ flags }}'.",
replaceWithIntendedLiteralAndFlags: "Replace with a regular expression literal with flags '{{ flags }}'.",
unexpectedRedundantRegExp: "Regular expression literal is unnecessarily wrapped within a 'RegExp' constructor.",

@@ -160,3 +161,3 @@ unexpectedRedundantRegExpWithFlags: "Use regular expression literal with flags instead of the 'RegExp' constructor."

const [{ disallowRedundantWrapping = false } = {}] = context.options;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -169,3 +170,3 @@ /**

function isGlobalReference(node) {
const scope = context.getScope();
const scope = sourceCode.getScope(node);
const variable = findVariable(scope, node);

@@ -267,2 +268,4 @@

const regexppEcmaVersion = getRegexppEcmaVersion(context.languageOptions.ecmaVersion);
/**

@@ -303,5 +306,82 @@ * Makes a character escaped or else returns null.

/**
* Checks whether the given regex and flags are valid for the ecma version or not.
* @param {string} pattern The regex pattern to check.
* @param {string | undefined} flags The regex flags to check.
* @returns {boolean} True if the given regex pattern and flags are valid for the ecma version.
*/
function isValidRegexForEcmaVersion(pattern, flags) {
const validator = new RegExpValidator({ ecmaVersion: regexppEcmaVersion });
try {
validator.validatePattern(pattern, 0, pattern.length, flags ? flags.includes("u") : false);
if (flags) {
validator.validateFlags(flags);
}
return true;
} catch {
return false;
}
}
/**
* Checks whether two given regex flags contain the same flags or not.
* @param {string} flagsA The regex flags.
* @param {string} flagsB The regex flags.
* @returns {boolean} True if two regex flags contain same flags.
*/
function areFlagsEqual(flagsA, flagsB) {
return [...flagsA].sort().join("") === [...flagsB].sort().join("");
}
/**
* Merges two regex flags.
* @param {string} flagsA The regex flags.
* @param {string} flagsB The regex flags.
* @returns {string} The merged regex flags.
*/
function mergeRegexFlags(flagsA, flagsB) {
const flagsSet = new Set([
...flagsA,
...flagsB
]);
return [...flagsSet].join("");
}
/**
* Checks whether a give node can be fixed to the given regex pattern and flags.
* @param {ASTNode} node The node to check.
* @param {string} pattern The regex pattern to check.
* @param {string} flags The regex flags
* @returns {boolean} True if a node can be fixed to the given regex pattern and flags.
*/
function canFixTo(node, pattern, flags) {
const tokenBefore = sourceCode.getTokenBefore(node);
return sourceCode.getCommentsInside(node).length === 0 &&
(!tokenBefore || validPrecedingTokens.has(tokenBefore.value)) &&
isValidRegexForEcmaVersion(pattern, flags);
}
/**
* Returns a safe output code considering the before and after tokens.
* @param {ASTNode} node The regex node.
* @param {string} newRegExpValue The new regex expression value.
* @returns {string} The output code.
*/
function getSafeOutput(node, newRegExpValue) {
const tokenBefore = sourceCode.getTokenBefore(node);
const tokenAfter = sourceCode.getTokenAfter(node);
return (tokenBefore && !canTokensBeAdjacent(tokenBefore, newRegExpValue) && tokenBefore.range[1] === node.range[0] ? " " : "") +
newRegExpValue +
(tokenAfter && !canTokensBeAdjacent(newRegExpValue, tokenAfter) && node.range[1] === tokenAfter.range[0] ? " " : "");
}
return {
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);

@@ -315,36 +395,81 @@ const traceMap = {

for (const { node } of tracker.iterateGlobalReferences(traceMap)) {
if (disallowRedundantWrapping && isUnnecessarilyWrappedRegexLiteral(node)) {
if (node.arguments.length === 2) {
context.report({ node, messageId: "unexpectedRedundantRegExpWithFlags" });
for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) {
if (disallowRedundantWrapping && isUnnecessarilyWrappedRegexLiteral(refNode)) {
const regexNode = refNode.arguments[0];
if (refNode.arguments.length === 2) {
const suggests = [];
const argFlags = getStringValue(refNode.arguments[1]) || "";
if (canFixTo(refNode, regexNode.regex.pattern, argFlags)) {
suggests.push({
messageId: "replaceWithLiteralAndFlags",
pattern: regexNode.regex.pattern,
flags: argFlags
});
}
const literalFlags = regexNode.regex.flags || "";
const mergedFlags = mergeRegexFlags(literalFlags, argFlags);
if (
!areFlagsEqual(mergedFlags, argFlags) &&
canFixTo(refNode, regexNode.regex.pattern, mergedFlags)
) {
suggests.push({
messageId: "replaceWithIntendedLiteralAndFlags",
pattern: regexNode.regex.pattern,
flags: mergedFlags
});
}
context.report({
node: refNode,
messageId: "unexpectedRedundantRegExpWithFlags",
suggest: suggests.map(({ flags, pattern, messageId }) => ({
messageId,
data: {
flags
},
fix(fixer) {
return fixer.replaceText(refNode, getSafeOutput(refNode, `/${pattern}/${flags}`));
}
}))
});
} else {
context.report({ node, messageId: "unexpectedRedundantRegExp" });
const outputs = [];
if (canFixTo(refNode, regexNode.regex.pattern, regexNode.regex.flags)) {
outputs.push(sourceCode.getText(regexNode));
}
context.report({
node: refNode,
messageId: "unexpectedRedundantRegExp",
suggest: outputs.map(output => ({
messageId: "replaceWithLiteral",
fix(fixer) {
return fixer.replaceText(
refNode,
getSafeOutput(refNode, output)
);
}
}))
});
}
} else if (hasOnlyStaticStringArguments(node)) {
let regexContent = getStringValue(node.arguments[0]);
} else if (hasOnlyStaticStringArguments(refNode)) {
let regexContent = getStringValue(refNode.arguments[0]);
let noFix = false;
let flags;
if (node.arguments[1]) {
flags = getStringValue(node.arguments[1]);
if (refNode.arguments[1]) {
flags = getStringValue(refNode.arguments[1]);
}
const regexppEcmaVersion = getRegexppEcmaVersion(context.languageOptions.ecmaVersion);
const RegExpValidatorInstance = new RegExpValidator({ ecmaVersion: regexppEcmaVersion });
try {
RegExpValidatorInstance.validatePattern(regexContent, 0, regexContent.length, flags ? flags.includes("u") : false);
if (flags) {
RegExpValidatorInstance.validateFlags(flags);
}
} catch {
if (!canFixTo(refNode, regexContent, flags)) {
noFix = true;
}
const tokenBefore = sourceCode.getTokenBefore(node);
if (tokenBefore && !validPrecedingTokens.has(tokenBefore.value)) {
noFix = true;
}
if (!/^[-a-zA-Z0-9\\[\](){} \t\r\n\v\f!@#$%^&*+^_=/~`.><?,'"|:;]*$/u.test(regexContent)) {

@@ -354,6 +479,2 @@ noFix = true;

if (sourceCode.getCommentsInside(node).length > 0) {
noFix = true;
}
if (regexContent && !noFix) {

@@ -385,3 +506,3 @@ let charIncrease = 0;

context.report({
node,
node: refNode,
messageId: "unexpectedRegExp",

@@ -391,10 +512,3 @@ suggest: noFix ? [] : [{

fix(fixer) {
const tokenAfter = sourceCode.getTokenAfter(node);
return fixer.replaceText(
node,
(tokenBefore && !canTokensBeAdjacent(tokenBefore, newRegExpValue) && tokenBefore.range[1] === node.range[0] ? " " : "") +
newRegExpValue +
(tokenAfter && !canTokensBeAdjacent(newRegExpValue, tokenAfter) && node.range[1] === tokenAfter.range[0] ? " " : "")
);
return fixer.replaceText(refNode, getSafeOutput(refNode, newRegExpValue));
}

@@ -401,0 +515,0 @@ }]

@@ -70,3 +70,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-rest-params"
url: "https://eslint.org/docs/latest/rules/prefer-rest-params"
},

@@ -83,2 +83,4 @@

const sourceCode = context.sourceCode;
/**

@@ -99,6 +101,7 @@ * Reports a given reference.

* Reports references of the implicit `arguments` variable if exist.
* @param {ASTNode} node The node representing the function.
* @returns {void}
*/
function checkForArguments() {
const argumentsVar = getVariableOfArguments(context.getScope());
function checkForArguments(node) {
const argumentsVar = getVariableOfArguments(sourceCode.getScope(node));

@@ -105,0 +108,0 @@ if (argumentsVar) {

@@ -54,3 +54,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-spread"
url: "https://eslint.org/docs/latest/rules/prefer-spread"
},

@@ -67,3 +67,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -70,0 +70,0 @@ return {

@@ -133,3 +133,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/prefer-template"
url: "https://eslint.org/docs/latest/rules/prefer-template"
},

@@ -146,3 +146,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let done = Object.create(null);

@@ -149,0 +149,0 @@

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/quote-props"
url: "https://eslint.org/docs/latest/rules/quote-props"
},

@@ -90,3 +90,3 @@

sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -93,0 +93,0 @@

@@ -85,3 +85,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/quotes"
url: "https://eslint.org/docs/latest/rules/quotes"
},

@@ -127,3 +127,3 @@

allowTemplateLiterals = options && options.allowTemplateLiterals === true,
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;
let avoidEscape = options && options.avoidEscape === true;

@@ -130,0 +130,0 @@

@@ -85,3 +85,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/radix"
url: "https://eslint.org/docs/latest/rules/radix"
},

@@ -108,2 +108,3 @@

const mode = context.options[0] || MODE_ALWAYS;
const sourceCode = context.sourceCode;

@@ -136,3 +137,2 @@ /**

fix(fixer) {
const sourceCode = context.getSourceCode();
const tokens = sourceCode.getTokens(node);

@@ -168,4 +168,4 @@ const lastToken = tokens[tokens.length - 1]; // Parenthesis.

return {
"Program:exit"() {
const scope = context.getScope();
"Program:exit"(node) {
const scope = sourceCode.getScope(node);
let variable;

@@ -177,6 +177,6 @@

variable.references.forEach(reference => {
const node = reference.identifier;
const idNode = reference.identifier;
if (astUtils.isCallee(node)) {
checkArguments(node.parent);
if (astUtils.isCallee(idNode)) {
checkArguments(idNode.parent);
}

@@ -190,8 +190,8 @@ });

variable.references.forEach(reference => {
const node = reference.identifier.parent;
const maybeCallee = node.parent.type === "ChainExpression"
? node.parent
: node;
const parentNode = reference.identifier.parent;
const maybeCallee = parentNode.parent.type === "ChainExpression"
? parentNode.parent
: parentNode;
if (isParseIntMethod(node) && astUtils.isCallee(maybeCallee)) {
if (isParseIntMethod(parentNode) && astUtils.isCallee(maybeCallee)) {
checkArguments(maybeCallee.parent);

@@ -198,0 +198,0 @@ }

@@ -176,3 +176,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/require-atomic-updates"
url: "https://eslint.org/docs/latest/rules/require-atomic-updates"
},

@@ -202,3 +202,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const assignmentReferences = new Map();

@@ -209,4 +209,4 @@ const segmentInfo = new SegmentInfo();

return {
onCodePathStart(codePath) {
const scope = context.getScope();
onCodePathStart(codePath, node) {
const scope = sourceCode.getScope(node);
const shouldVerify =

@@ -213,0 +213,0 @@ scope.type === "function" &&

@@ -39,3 +39,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/require-await"
url: "https://eslint.org/docs/latest/rules/require-await"
},

@@ -51,3 +51,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
let scopeInfo = null;

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

@@ -16,3 +16,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/require-jsdoc"
url: "https://eslint.org/docs/latest/rules/require-jsdoc"
},

@@ -65,3 +65,3 @@

create(context) {
const source = context.getSourceCode();
const source = context.sourceCode;
const DEFAULT_OPTIONS = {

@@ -68,0 +68,0 @@ FunctionDeclaration: true,

@@ -17,3 +17,5 @@ /**

getStringIfConstant
} = require("eslint-utils");
} = require("@eslint-community/eslint-utils");
const astUtils = require("./utils/ast-utils.js");
const { isValidWithUnicodeFlag } = require("./utils/regular-expressions");

@@ -32,6 +34,9 @@ //------------------------------------------------------------------------------

recommended: false,
url: "https://eslint.org/docs/rules/require-unicode-regexp"
url: "https://eslint.org/docs/latest/rules/require-unicode-regexp"
},
hasSuggestions: true,
messages: {
addUFlag: "Add the 'u' flag.",
requireUFlag: "Use the 'u' flag."

@@ -44,2 +49,5 @@ },

create(context) {
const sourceCode = context.sourceCode;
return {

@@ -50,8 +58,21 @@ "Literal[regex]"(node) {

if (!flags.includes("u")) {
context.report({ node, messageId: "requireUFlag" });
context.report({
messageId: "requireUFlag",
node,
suggest: isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, node.regex.pattern)
? [
{
fix(fixer) {
return fixer.insertTextAfter(node, "u");
},
messageId: "addUFlag"
}
]
: null
});
}
},
Program() {
const scope = context.getScope();
Program(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);

@@ -62,8 +83,47 @@ const trackMap = {

for (const { node } of tracker.iterateGlobalReferences(trackMap)) {
const flagsNode = node.arguments[1];
for (const { node: refNode } of tracker.iterateGlobalReferences(trackMap)) {
const [patternNode, flagsNode] = refNode.arguments;
if (patternNode && patternNode.type === "SpreadElement") {
continue;
}
const pattern = getStringIfConstant(patternNode, scope);
const flags = getStringIfConstant(flagsNode, scope);
if (!flagsNode || (typeof flags === "string" && !flags.includes("u"))) {
context.report({ node, messageId: "requireUFlag" });
context.report({
messageId: "requireUFlag",
node: refNode,
suggest: typeof pattern === "string" && isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, pattern)
? [
{
fix(fixer) {
if (flagsNode) {
if ((flagsNode.type === "Literal" && typeof flagsNode.value === "string") || flagsNode.type === "TemplateLiteral") {
const flagsNodeText = sourceCode.getText(flagsNode);
return fixer.replaceText(flagsNode, [
flagsNodeText.slice(0, flagsNodeText.length - 1),
flagsNodeText.slice(flagsNodeText.length - 1)
].join("u"));
}
// We intentionally don't suggest concatenating + "u" to non-literals
return null;
}
const penultimateToken = sourceCode.getLastToken(refNode, { skip: 1 }); // skip closing parenthesis
return fixer.insertTextAfter(
penultimateToken,
astUtils.isCommaToken(penultimateToken)
? ' "u",'
: ', "u"'
);
},
messageId: "addUFlag"
}
]
: null
});
}

@@ -70,0 +130,0 @@ }

@@ -20,3 +20,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/require-yield"
url: "https://eslint.org/docs/latest/rules/require-yield"
},

@@ -23,0 +23,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/rest-spread-spacing"
url: "https://eslint.org/docs/latest/rules/rest-spread-spacing"
},

@@ -39,3 +39,3 @@

create(context) {
const sourceCode = context.getSourceCode(),
const sourceCode = context.sourceCode,
alwaysSpace = context.options[0] === "always";

@@ -42,0 +42,0 @@

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

recommended: false,
url: "https://eslint.org/docs/rules/semi-spacing"
url: "https://eslint.org/docs/latest/rules/semi-spacing"
},

@@ -56,3 +56,3 @@

const config = context.options[0],
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;
let requireSpaceBefore = false,

@@ -59,0 +59,0 @@ requireSpaceAfter = true;

@@ -78,3 +78,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/semi-style"
url: "https://eslint.org/docs/latest/rules/semi-style"
},

@@ -91,3 +91,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const option = context.options[0] || "last";

@@ -94,0 +94,0 @@

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/semi"
url: "https://eslint.org/docs/latest/rules/semi"
},

@@ -62,3 +62,4 @@

properties: {
omitLastInOneLineBlock: { type: "boolean" }
omitLastInOneLineBlock: { type: "boolean" },
omitLastInOneLineClassBody: { type: "boolean" }
},

@@ -88,4 +89,5 @@ additionalProperties: false

const exceptOneLine = Boolean(options && options.omitLastInOneLineBlock);
const exceptOneLineClassBody = Boolean(options && options.omitLastInOneLineClassBody);
const beforeStatementContinuationChars = options && options.beforeStatementContinuationChars || "any";
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -341,2 +343,23 @@ //--------------------------------------------------------------------------

/**
* Checks a node to see if it's the last item in a one-liner `ClassBody` node.
* ClassBody is a one-liner if its braces (and consequently everything between them) are on the same line.
* @param {ASTNode} node The node to check.
* @returns {boolean} whether the node is the last item in a one-liner ClassBody.
*/
function isLastInOneLinerClassBody(node) {
const parent = node.parent;
const nextToken = sourceCode.getTokenAfter(node);
if (!nextToken || nextToken.value !== "}") {
return false;
}
if (parent.type === "ClassBody") {
return parent.loc.start.line === parent.loc.end.line;
}
return false;
}
/**
* Checks a node to see if it's followed by a semicolon.

@@ -361,6 +384,8 @@ * @param {ASTNode} node The node to check.

const oneLinerBlock = (exceptOneLine && isLastInOneLinerBlock(node));
const oneLinerClassBody = (exceptOneLineClassBody && isLastInOneLinerClassBody(node));
const oneLinerBlockOrClassBody = oneLinerBlock || oneLinerClassBody;
if (isSemi && oneLinerBlock) {
if (isSemi && oneLinerBlockOrClassBody) {
report(node, true);
} else if (!isSemi && !oneLinerBlock) {
} else if (!isSemi && !oneLinerBlockOrClassBody) {
report(node);

@@ -367,0 +392,0 @@ }

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/sort-imports"
url: "https://eslint.org/docs/latest/rules/sort-imports"
},

@@ -75,3 +75,3 @@

allowSeparatedGroups = configuration.allowSeparatedGroups || false,
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;
let previousDeclaration = null;

@@ -78,0 +78,0 @@

@@ -86,3 +86,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/sort-keys"
url: "https://eslint.org/docs/latest/rules/sort-keys"
},

@@ -139,3 +139,3 @@

let stack = null;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -142,0 +142,0 @@ return {

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/sort-vars"
url: "https://eslint.org/docs/latest/rules/sort-vars"
},

@@ -48,3 +48,3 @@

ignoreCase = configuration.ignoreCase || false,
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;

@@ -51,0 +51,0 @@ return {

@@ -45,3 +45,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/space-before-blocks"
url: "https://eslint.org/docs/latest/rules/space-before-blocks"
},

@@ -84,3 +84,3 @@

const config = context.options[0],
sourceCode = context.getSourceCode();
sourceCode = context.sourceCode;
let alwaysFunctions = true,

@@ -87,0 +87,0 @@ alwaysKeywords = true,

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/space-before-function-paren"
url: "https://eslint.org/docs/latest/rules/space-before-function-paren"
},

@@ -63,3 +63,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const baseConfig = typeof context.options[0] === "string" ? context.options[0] : "always";

@@ -66,0 +66,0 @@ const overrideConfig = typeof context.options[0] === "object" ? context.options[0] : {};

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/space-in-parens"
url: "https://eslint.org/docs/latest/rules/space-in-parens"
},

@@ -106,3 +106,3 @@

//--------------------------------------------------------------------------
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -109,0 +109,0 @@ /**

@@ -21,3 +21,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/space-infix-ops"
url: "https://eslint.org/docs/latest/rules/space-infix-ops"
},

@@ -47,3 +47,3 @@

const int32Hint = context.options[0] ? context.options[0].int32Hint === true : false;
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -50,0 +50,0 @@ /**

@@ -25,3 +25,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/space-unary-ops"
url: "https://eslint.org/docs/latest/rules/space-unary-ops"
},

@@ -66,3 +66,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -69,0 +69,0 @@ //--------------------------------------------------------------------------

@@ -157,3 +157,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/spaced-comment"
url: "https://eslint.org/docs/latest/rules/spaced-comment"
},

@@ -239,3 +239,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -242,0 +242,0 @@ // Unless the first option is never, require a space

@@ -74,3 +74,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/strict"
url: "https://eslint.org/docs/latest/rules/strict"
},

@@ -77,0 +77,0 @@

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/switch-colon-spacing"
url: "https://eslint.org/docs/latest/rules/switch-colon-spacing"
},

@@ -50,3 +50,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const options = context.options[0] || {};

@@ -53,0 +53,0 @@ const beforeSpacing = options.before === true; // false by default

@@ -27,3 +27,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/symbol-description"
url: "https://eslint.org/docs/latest/rules/symbol-description"
},

@@ -39,2 +39,4 @@ fixable: null,

const sourceCode = context.sourceCode;
/**

@@ -56,4 +58,4 @@ * Reports if node does not conform the rule in case rule is set to

return {
"Program:exit"() {
const scope = context.getScope();
"Program:exit"(node) {
const scope = sourceCode.getScope(node);
const variable = astUtils.getVariableByName(scope, "Symbol");

@@ -63,6 +65,6 @@

variable.references.forEach(reference => {
const node = reference.identifier;
const idNode = reference.identifier;
if (astUtils.isCallee(node)) {
checkArgument(node.parent);
if (astUtils.isCallee(idNode)) {
checkArgument(idNode.parent);
}

@@ -69,0 +71,0 @@ });

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/template-curly-spacing"
url: "https://eslint.org/docs/latest/rules/template-curly-spacing"
},

@@ -44,3 +44,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;
const always = context.options[0] === "always";

@@ -47,0 +47,0 @@

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/template-tag-spacing"
url: "https://eslint.org/docs/latest/rules/template-tag-spacing"
},

@@ -37,3 +37,3 @@

const never = context.options[0] !== "always";
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -40,0 +40,0 @@ /**

@@ -19,3 +19,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/unicode-bom"
url: "https://eslint.org/docs/latest/rules/unicode-bom"
},

@@ -46,3 +46,3 @@

const sourceCode = context.getSourceCode(),
const sourceCode = context.sourceCode,
location = { column: 0, line: 1 },

@@ -49,0 +49,0 @@ requireBOM = context.options[0] || "never";

@@ -42,3 +42,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/use-isnan"
url: "https://eslint.org/docs/latest/rules/use-isnan"
},

@@ -45,0 +45,0 @@

@@ -26,3 +26,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/valid-jsdoc"
url: "https://eslint.org/docs/latest/rules/valid-jsdoc"
},

@@ -100,3 +100,3 @@

prefer = options.prefer || {},
sourceCode = context.getSourceCode(),
sourceCode = context.sourceCode,

@@ -103,0 +103,0 @@ // these both default to true, so you have to explicitly make them false

@@ -19,3 +19,3 @@ /**

recommended: true,
url: "https://eslint.org/docs/rules/valid-typeof"
url: "https://eslint.org/docs/latest/rules/valid-typeof"
},

@@ -48,3 +48,3 @@

OPERATORS = new Set(["==", "===", "!=", "!=="]);
const sourceCode = context.sourceCode;
const requireStringLiterals = context.options[0] && context.options[0].requireStringLiterals;

@@ -82,4 +82,4 @@

Program() {
globalScope = context.getScope();
Program(node) {
globalScope = sourceCode.getScope(node);
},

@@ -89,3 +89,3 @@

if (isTypeofExpression(node)) {
const parent = context.getAncestors().pop();
const { parent } = node;

@@ -92,0 +92,0 @@ if (parent.type === "BinaryExpression" && OPERATORS.has(parent.operator)) {

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/vars-on-top"
url: "https://eslint.org/docs/latest/rules/vars-on-top"
},

@@ -23,0 +23,0 @@

@@ -13,3 +13,3 @@ /**

const astUtils = require("./utils/ast-utils");
const eslintUtils = require("eslint-utils");
const eslintUtils = require("@eslint-community/eslint-utils");

@@ -49,3 +49,3 @@ //----------------------------------------------------------------------

recommended: false,
url: "https://eslint.org/docs/rules/wrap-iife"
url: "https://eslint.org/docs/latest/rules/wrap-iife"
},

@@ -82,3 +82,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -85,0 +85,0 @@ /**

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/wrap-regex"
url: "https://eslint.org/docs/latest/rules/wrap-regex"
},

@@ -33,3 +33,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -45,6 +45,5 @@ return {

const afterToken = sourceCode.getTokenAfter(node);
const ancestors = context.getAncestors();
const grandparent = ancestors[ancestors.length - 1];
const { parent } = node;
if (grandparent.type === "MemberExpression" && grandparent.object === node &&
if (parent.type === "MemberExpression" && parent.object === node &&
!(beforeToken && beforeToken.value === "(" && afterToken && afterToken.value === ")")) {

@@ -51,0 +50,0 @@ context.report({

@@ -20,3 +20,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/yield-star-spacing"
url: "https://eslint.org/docs/latest/rules/yield-star-spacing"
},

@@ -52,3 +52,3 @@

create(context) {
const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -55,0 +55,0 @@ const mode = (function(option) {

@@ -126,3 +126,3 @@ /**

recommended: false,
url: "https://eslint.org/docs/rules/yoda"
url: "https://eslint.org/docs/latest/rules/yoda"
},

@@ -166,3 +166,3 @@

const sourceCode = context.getSourceCode();
const sourceCode = context.sourceCode;

@@ -348,3 +348,3 @@ /**

isComparisonOperator(node.operator) &&
!(exceptRange && isRangeTest(context.getAncestors().pop()))
!(exceptRange && isRangeTest(node.parent))
) {

@@ -351,0 +351,0 @@ context.report({

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

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const Graphemer = require("graphemer").default;
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
// eslint-disable-next-line no-control-regex -- intentionally including control characters
const ASCII_REGEX = /^[\u0000-\u007f]*$/u;
/** @type {Graphemer | undefined} */
let splitter;
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
/**

@@ -21,4 +41,22 @@ * Converts the first letter of a string to uppercase.

/**
* Counts graphemes in a given string.
* @param {string} value A string to count graphemes.
* @returns {number} The number of graphemes in `value`.
*/
function getGraphemeCount(value) {
if (ASCII_REGEX.test(value)) {
return value.length;
}
if (!splitter) {
splitter = new Graphemer();
}
return splitter.countGraphemes(value);
}
module.exports = {
upperCaseFirst
upperCaseFirst,
getGraphemeCount
};

@@ -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.

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

const
{ isCommentToken } = require("eslint-utils"),
{ isCommentToken } = require("@eslint-community/eslint-utils"),
TokenStore = require("./token-store"),

@@ -19,2 +19,8 @@ astUtils = require("../shared/ast-utils"),

//------------------------------------------------------------------------------
// Type Definitions
//------------------------------------------------------------------------------
/** @typedef {import("eslint-scope").Variable} Variable */
//------------------------------------------------------------------------------
// Private

@@ -148,2 +154,4 @@ //------------------------------------------------------------------------------

const caches = Symbol("caches");
/**

@@ -182,2 +190,9 @@ * Represents parsed source code.

/**
* General purpose caching for the class.
*/
this[caches] = new Map([
["scopes", new WeakMap()]
]);
/**
* The flag to indicate that the source code has Unicode BOM.

@@ -595,4 +610,125 @@ * @type {boolean}

}
/**
* Gets the scope for the given node
* @param {ASTNode} currentNode The node to get the scope of
* @returns {eslint-scope.Scope} The scope information for this node
* @throws {TypeError} If the `currentNode` argument is missing.
*/
getScope(currentNode) {
if (!currentNode) {
throw new TypeError("Missing required argument: node.");
}
// check cache first
const cache = this[caches].get("scopes");
const cachedScope = cache.get(currentNode);
if (cachedScope) {
return cachedScope;
}
// On Program node, get the outermost scope to avoid return Node.js special function scope or ES modules scope.
const inner = currentNode.type !== "Program";
for (let node = currentNode; node; node = node.parent) {
const scope = this.scopeManager.acquire(node, inner);
if (scope) {
if (scope.type === "function-expression-name") {
cache.set(currentNode, scope.childScopes[0]);
return scope.childScopes[0];
}
cache.set(currentNode, scope);
return scope;
}
}
cache.set(currentNode, this.scopeManager.scopes[0]);
return this.scopeManager.scopes[0];
}
/**
* Get the variables that `node` defines.
* This is a convenience method that passes through
* to the same method on the `scopeManager`.
* @param {ASTNode} node The node for which the variables are obtained.
* @returns {Array<Variable>} An array of variable nodes representing
* the variables that `node` defines.
*/
getDeclaredVariables(node) {
return this.scopeManager.getDeclaredVariables(node);
}
/* eslint-disable class-methods-use-this -- node is owned by SourceCode */
/**
* Gets all the ancestors of a given node
* @param {ASTNode} node The node
* @returns {Array<ASTNode>} All the ancestor nodes in the AST, not including the provided node, starting
* from the root node at index 0 and going inwards to the parent node.
* @throws {TypeError} When `node` is missing.
*/
getAncestors(node) {
if (!node) {
throw new TypeError("Missing required argument: node.");
}
const ancestorsStartingAtParent = [];
for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
ancestorsStartingAtParent.push(ancestor);
}
return ancestorsStartingAtParent.reverse();
}
/* eslint-enable class-methods-use-this -- node is owned by SourceCode */
/**
* Marks a variable as used in the current scope
* @param {string} name The name of the variable to mark as used.
* @param {ASTNode} [refNode] The closest node to the variable reference.
* @returns {boolean} True if the variable was found and marked as used, false if not.
*/
markVariableAsUsed(name, refNode = this.ast) {
const currentScope = this.getScope(refNode);
let initialScope = currentScope;
/*
* When we are in an ESM or CommonJS module, we need to start searching
* from the top-level scope, not the global scope. For ESM the top-level
* scope is the module scope; for CommonJS the top-level scope is the
* outer function scope.
*
* Without this check, we might miss a variable declared with `var` at
* the top-level because it won't exist in the global scope.
*/
if (
currentScope.type === "global" &&
currentScope.childScopes.length > 0 &&
// top-level scopes refer to a `Program` node
currentScope.childScopes[0].block === this.ast
) {
initialScope = currentScope.childScopes[0];
}
for (let scope = initialScope; scope; scope = scope.upper) {
const variable = scope.variables.find(scopeVar => scopeVar.name === name);
if (variable) {
variable.eslintUsed = true;
return true;
}
}
return false;
}
}
module.exports = SourceCode;

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

const assert = require("assert");
const { isCommentToken } = require("eslint-utils");
const { isCommentToken } = require("@eslint-community/eslint-utils");
const cursors = require("./cursors");

@@ -15,0 +15,0 @@ const ForwardTokenCursor = require("./forward-token-cursor");

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

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Gets `token.range[0]` from the given token.
* @param {Node|Token|Comment} token The token to get.
* @returns {number} The start location.
* @private
*/
function getStartLocation(token) {
return token.range[0];
}
//------------------------------------------------------------------------------
// Exports

@@ -34,5 +20,24 @@ //------------------------------------------------------------------------------

exports.search = function search(tokens, location) {
const index = tokens.findIndex(el => location <= getStartLocation(el));
for (let minIndex = 0, maxIndex = tokens.length - 1; minIndex <= maxIndex;) {
return index === -1 ? tokens.length : index;
/*
* Calculate the index in the middle between minIndex and maxIndex.
* `| 0` is used to round a fractional value down to the nearest integer: this is similar to
* using `Math.trunc()` or `Math.floor()`, but performance tests have shown this method to
* be faster.
*/
const index = (minIndex + maxIndex) / 2 | 0;
const token = tokens[index];
const tokenStartLocation = token.range[0];
if (location <= tokenStartLocation) {
if (index === minIndex) {
return index;
}
maxIndex = index;
} else {
minIndex = index + 1;
}
}
return tokens.length;
};

@@ -54,4 +59,9 @@

const index = indexMap[startLoc - 1];
const token = (index >= 0 && index < tokens.length) ? tokens[index] : null;
const token = tokens[index];
// If the mapped index is out of bounds, the returned cursor index will point after the end of the tokens array.
if (!token) {
return tokens.length;
}
/*

@@ -61,3 +71,3 @@ * For the map of "comment's location -> token's index", it points the next token of a comment.

*/
if (token && token.range[0] >= startLoc) {
if (token.range[0] >= startLoc) {
return index;

@@ -84,4 +94,9 @@ }

const index = indexMap[endLoc - 1];
const token = (index >= 0 && index < tokens.length) ? tokens[index] : null;
const token = tokens[index];
// If the mapped index is out of bounds, the returned cursor index will point before the end of the tokens array.
if (!token) {
return tokens.length - 1;
}
/*

@@ -91,3 +106,3 @@ * For the map of "comment's location -> token's index", it points the next token of a comment.

*/
if (token && token.range[1] > endLoc) {
if (token.range[1] > endLoc) {
return index - 1;

@@ -94,0 +109,0 @@ }

@@ -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
};

@@ -13,4 +13,4 @@ "use strict";

If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://eslint.org/chat/help
If you think you already have a configuration file or if you need more help, please stop by the ESLint Discord server: https://eslint.org/chat
`.trimStart();
};

@@ -6,4 +6,4 @@ "use strict";

The '--print-config' CLI option requires a path to a source code file rather than a directory.
See also: https://eslint.org/docs/user-guide/command-line-interface#--print-config
See also: https://eslint.org/docs/latest/use/command-line-interface#--print-config
`.trimStart();
};
{
"name": "eslint",
"version": "8.31.0",
"version": "8.42.0",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",

@@ -40,2 +40,6 @@ "description": "An AST-based pattern checker for JavaScript.",

"*.md": "markdownlint --fix",
"lib/rules/*.js": [
"node tools/update-eslint-all.js",
"git add packages/js/src/configs/eslint-all.js"
],
"docs/src/rules/*.md": [

@@ -60,4 +64,7 @@ "node tools/fetch-docs-links.js",

"dependencies": {
"@eslint/eslintrc": "^1.4.1",
"@humanwhocodes/config-array": "^0.11.8",
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.4.0",
"@eslint/eslintrc": "^2.0.3",
"@eslint/js": "8.42.0",
"@humanwhocodes/config-array": "^0.11.10",
"@humanwhocodes/module-importer": "^1.0.1",

@@ -71,7 +78,6 @@ "@nodelib/fs.walk": "^1.2.8",

"escape-string-regexp": "^4.0.0",
"eslint-scope": "^7.1.1",
"eslint-utils": "^3.0.0",
"eslint-visitor-keys": "^3.3.0",
"espree": "^9.4.0",
"esquery": "^1.4.0",
"eslint-scope": "^7.2.0",
"eslint-visitor-keys": "^3.4.1",
"espree": "^9.5.2",
"esquery": "^1.4.2",
"esutils": "^2.0.2",

@@ -83,3 +89,3 @@ "fast-deep-equal": "^3.1.3",

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

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

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

@@ -99,3 +104,2 @@ "json-stable-stringify-without-jsonify": "^1.0.1",

"optionator": "^0.9.1",
"regexpp": "^3.2.0",
"strip-ansi": "^6.0.1",

@@ -102,0 +106,0 @@ "strip-json-comments": "^3.1.0",

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

[Website](https://eslint.org) |
[Configuring](https://eslint.org/docs/user-guide/configuring) |
[Configure ESLint](https://eslint.org/docs/latest/use/configure) |
[Rules](https://eslint.org/docs/rules/) |
[Contributing](https://eslint.org/docs/developer-guide/contributing) |
[Reporting Bugs](https://eslint.org/docs/developer-guide/contributing/reporting-bugs) |
[Contribute to ESLint](https://eslint.org/docs/latest/contribute) |
[Report Bugs](https://eslint.org/docs/latest/contribute/report-bugs) |
[Code of Conduct](https://eslint.org/conduct) |
[Twitter](https://twitter.com/geteslint) |
[Mailing List](https://groups.google.com/group/eslint) |
[Chat Room](https://eslint.org/chat)
[Discord](https://eslint.org/chat) |
[Mastodon](https://fosstodon.org/@eslint)

@@ -63,3 +63,3 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions:

After running `npm init @eslint/config`, you'll have a `.eslintrc` file in your directory. In it, you'll see some rules configured like this:
After running `npm init @eslint/config`, you'll have an `.eslintrc` file in your directory. In it, you'll see some rules configured like this:

@@ -81,3 +81,3 @@ ```json

The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](https://eslint.org/docs/user-guide/configuring)).
The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](https://eslint.org/docs/latest/use/configure)).

@@ -92,6 +92,6 @@ ## Code of Conduct

* [Bug Report](https://eslint.org/docs/developer-guide/contributing/reporting-bugs)
* [Propose a New Rule](https://eslint.org/docs/developer-guide/contributing/new-rules)
* [Proposing a Rule Change](https://eslint.org/docs/developer-guide/contributing/rule-changes)
* [Request a Change](https://eslint.org/docs/developer-guide/contributing/changes)
* [Bug Report](https://eslint.org/docs/latest/contribute/report-bugs)
* [Propose a New Rule](https://eslint.org/docs/latest/contribute/propose-new-rule)
* [Proposing a Rule Change](https://eslint.org/docs/latest/contribute/propose-rule-change)
* [Request a Change](https://eslint.org/docs/latest/contribute/request-change)

@@ -104,3 +104,3 @@ ## Frequently Asked Questions

We have prepared a [migration guide](https://eslint.org/docs/user-guide/migrating-from-jscs) to help you convert your JSCS settings to an ESLint configuration.
We have prepared a [migration guide](https://eslint.org/docs/latest/use/migrating-from-jscs) to help you convert your JSCS settings to an ESLint configuration.

@@ -121,7 +121,7 @@ We are now at or near 100% compatibility with JSCS. If you try ESLint and believe we are not yet compatible with a JSCS rule/configuration, please create an issue (mentioning that it is a JSCS compatibility issue) and we will evaluate it as per our normal process.

Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/user-guide/configuring)). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics.
Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/latest/use/configure)). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics.
### What ECMAScript versions does ESLint support?
ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021 and 2022. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring).
ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021 and 2022. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/latest/use/configure).

@@ -134,7 +134,7 @@ ### What about experimental features?

Once a language feature has been adopted into the ECMAScript standard (stage 4 according to the [TC39 process](https://tc39.github.io/process-document/)), we will accept issues and pull requests related to the new feature, subject to our [contributing guidelines](https://eslint.org/docs/developer-guide/contributing). Until then, please use the appropriate parser and plugin(s) for your experimental feature.
Once a language feature has been adopted into the ECMAScript standard (stage 4 according to the [TC39 process](https://tc39.github.io/process-document/)), we will accept issues and pull requests related to the new feature, subject to our [contributing guidelines](https://eslint.org/docs/latest/contribute). Until then, please use the appropriate parser and plugin(s) for your experimental feature.
### Where to ask for help?
Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://eslint.org/chat).
Open a [discussion](https://github.com/eslint/eslint/discussions) or stop by our [Discord server](https://eslint.org/chat).

@@ -223,7 +223,2 @@ ### Why doesn't ESLint lock dependency versions?

</td><td align="center" valign="top" width="11%">
<a href="https://github.com/btmills">
<img src="https://github.com/btmills.png?s=75" width="75" height="75"><br />
Brandon Mills
</a>
</td><td align="center" valign="top" width="11%">
<a href="https://github.com/mdjermanovic">

@@ -261,11 +256,6 @@ <img src="https://github.com/mdjermanovic.png?s=75" width="75" height="75"><br />

</td><td align="center" valign="top" width="11%">
<a href="https://github.com/SaraSoueidan">
<img src="https://github.com/SaraSoueidan.png?s=75" width="75" height="75"><br />
Sara Soueidan
<a href="https://github.com/fasttime">
<img src="https://github.com/fasttime.png?s=75" width="75" height="75"><br />
Francesco Trotta
</a>
</td><td align="center" valign="top" width="11%">
<a href="https://github.com/yeonjuan">
<img src="https://github.com/yeonjuan.png?s=75" width="75" height="75"><br />
YeonJuan
</a>
</td></tr></tbody></table>

@@ -304,5 +294,5 @@

<p><a href="#"><img src="https://images.opencollective.com/2021-frameworks-fund/logo.png" alt="Chrome Frameworks Fund" height="undefined"></a> <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="https://ridicorp.com/career/"><img src="https://images.opencollective.com/ridi-corporation/175dcf3/logo.png" alt="RIDI" 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://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></p><h3>Bronze Sponsors</h3>
<p><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://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://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://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="#"><img src="https://images.opencollective.com/king-billy-slots1/c30c2aa/avatar.png" alt="King Billy Slots" 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-->

@@ -309,0 +299,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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc