Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump eslint from 8.57.0 to 9.10.0 #1788

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Sep 9, 2024

Bumps eslint from 8.57.0 to 9.10.0.

Release notes

Sourced from eslint's releases.

v9.10.0

Features

  • 301b90d feat: Add types (#18854) (Nicholas C. Zakas)
  • bcf0df5 feat: limit namespace import identifier in id-length rule (#18849) (ChaedongIm)
  • 45c18e1 feat: add requireFlag option to require-unicode-regexp rule (#18836) (Brett Zamir)
  • 183b459 feat: add error message for duplicate flags in no-invalid-regexp (#18837) (Tanuj Kanti)
  • c69b406 feat: report duplicate allowed flags in no-invalid-regexp (#18754) (Tanuj Kanti)

Documentation

  • bee0e7a docs: update README (#18865) (Milos Djermanovic)
  • 5d80b59 docs: specify that ruleId can be null in custom formatter docs (#18857) (Milos Djermanovic)
  • 156b1c3 docs: Update README (GitHub Actions Bot)
  • f6fdef9 docs: Update README (GitHub Actions Bot)
  • a20c870 docs: Update README (GitHub Actions Bot)
  • 90e699b docs: Update README (GitHub Actions Bot)

Chores

  • 24c3ff7 chore: upgrade to @​eslint/js@​9.10.0 (#18866) (Francesco Trotta)
  • 1ebdde1 chore: package.json update for @​eslint/js release (Jenkins)
  • e8fc5bd chore: update dependency @​eslint/core to ^0.5.0 (#18848) (renovate[bot])
  • 343f992 refactor: don't use node.value when removing unused directives (#18835) (Milos Djermanovic)
  • 3db18b0 refactor: Extract FileContext into class (#18831) (Nicholas C. Zakas)
  • 931d650 refactor: Use @​eslint/plugin-kit (#18822) (Nicholas C. Zakas)
  • ed5cf0c chore: update dependency @​eslint/json to ^0.4.0 (#18829) (Milos Djermanovic)
  • d1f0831 chore: added missing ids (#18817) (Strek)
  • ec92813 refactor: Config class (#18763) (Nicholas C. Zakas)

v9.9.1

Bug Fixes

  • 9bde90c fix: add logic to handle fixTypes in lintText() (#18736) (Amaresh S M)

Documentation

  • 4840930 docs: Update README with version support and clean up content (#18804) (Nicholas C. Zakas)
  • f61f40d docs: Update globals examples (#18805) (Nicholas C. Zakas)
  • 241fcea docs: Use and define languages (#18795) (Nicholas C. Zakas)
  • 5dbdd63 docs: eslint-plugin-markdown -> @​eslint/markdown (#18797) (Nicholas C. Zakas)
  • c6c8ddd docs: update links to eslint-visitor-keys repo (#18796) (Francesco Trotta)
  • f981d05 docs: Update README (GitHub Actions Bot)
  • b516974 docs: update links to eslint/js repo (#18781) (Francesco Trotta)
  • fb7a3f5 docs: update note for package managers (#18779) (Jay)

Chores

  • b0c34d0 chore: upgrade to @​eslint/js@​9.9.1 (#18809) (Francesco Trotta)
  • cd5a0da chore: package.json update for @​eslint/js release (Jenkins)
  • e112642 refactor: Extract parsing logic from Linter (#18790) (Nicholas C. Zakas)
  • 0f68a85 chore: use eslint-plugin-yml on yaml files only (#18801) (Milos Djermanovic)
  • f8d1b3c chore: update dependencies for browser tests (#18794) (Christian Bromann)
  • aed2624 chore: update dependency @​eslint/config-array to ^0.18.0 (#18788) (renovate[bot])
  • 5c29128 chore: update dependency @​eslint/core to ^0.4.0 (#18789) (renovate[bot])
  • 5d66fb2 chore: migrate linting workflow to use trunk check meta-linter (#18643) (Chris Clearwater)

... (truncated)

Changelog

Sourced from eslint's changelog.

v9.10.0 - September 6, 2024

  • 24c3ff7 chore: upgrade to @​eslint/js@​9.10.0 (#18866) (Francesco Trotta)
  • 1ebdde1 chore: package.json update for @​eslint/js release (Jenkins)
  • 301b90d feat: Add types (#18854) (Nicholas C. Zakas)
  • bee0e7a docs: update README (#18865) (Milos Djermanovic)
  • bcf0df5 feat: limit namespace import identifier in id-length rule (#18849) (ChaedongIm)
  • 45c18e1 feat: add requireFlag option to require-unicode-regexp rule (#18836) (Brett Zamir)
  • 5d80b59 docs: specify that ruleId can be null in custom formatter docs (#18857) (Milos Djermanovic)
  • 156b1c3 docs: Update README (GitHub Actions Bot)
  • e8fc5bd chore: update dependency @​eslint/core to ^0.5.0 (#18848) (renovate[bot])
  • 343f992 refactor: don't use node.value when removing unused directives (#18835) (Milos Djermanovic)
  • 183b459 feat: add error message for duplicate flags in no-invalid-regexp (#18837) (Tanuj Kanti)
  • f6fdef9 docs: Update README (GitHub Actions Bot)
  • c69b406 feat: report duplicate allowed flags in no-invalid-regexp (#18754) (Tanuj Kanti)
  • a20c870 docs: Update README (GitHub Actions Bot)
  • 90e699b docs: Update README (GitHub Actions Bot)
  • 3db18b0 refactor: Extract FileContext into class (#18831) (Nicholas C. Zakas)
  • 931d650 refactor: Use @​eslint/plugin-kit (#18822) (Nicholas C. Zakas)
  • ed5cf0c chore: update dependency @​eslint/json to ^0.4.0 (#18829) (Milos Djermanovic)
  • d1f0831 chore: added missing ids (#18817) (Strek)
  • ec92813 refactor: Config class (#18763) (Nicholas C. Zakas)

v9.9.1 - August 23, 2024

  • b0c34d0 chore: upgrade to @​eslint/js@​9.9.1 (#18809) (Francesco Trotta)
  • cd5a0da chore: package.json update for @​eslint/js release (Jenkins)
  • 4840930 docs: Update README with version support and clean up content (#18804) (Nicholas C. Zakas)
  • f61f40d docs: Update globals examples (#18805) (Nicholas C. Zakas)
  • e112642 refactor: Extract parsing logic from Linter (#18790) (Nicholas C. Zakas)
  • 241fcea docs: Use and define languages (#18795) (Nicholas C. Zakas)
  • 0f68a85 chore: use eslint-plugin-yml on yaml files only (#18801) (Milos Djermanovic)
  • 5dbdd63 docs: eslint-plugin-markdown -> @​eslint/markdown (#18797) (Nicholas C. Zakas)
  • c6c8ddd docs: update links to eslint-visitor-keys repo (#18796) (Francesco Trotta)
  • f8d1b3c chore: update dependencies for browser tests (#18794) (Christian Bromann)
  • aed2624 chore: update dependency @​eslint/config-array to ^0.18.0 (#18788) (renovate[bot])
  • 5c29128 chore: update dependency @​eslint/core to ^0.4.0 (#18789) (renovate[bot])
  • 5d66fb2 chore: migrate linting workflow to use trunk check meta-linter (#18643) (Chris Clearwater)
  • f981d05 docs: Update README (GitHub Actions Bot)
  • b516974 docs: update links to eslint/js repo (#18781) (Francesco Trotta)
  • fb7a3f5 docs: update note for package managers (#18779) (Jay)
  • bf96855 chore: add ids to github issue templates (#18775) (Strek)
  • 9bde90c fix: add logic to handle fixTypes in lintText() (#18736) (Amaresh S M)

v9.9.0 - August 9, 2024

  • 461b2c3 chore: upgrade to @eslint/js@9.9.0 (#18765) (Francesco Trotta)
  • 59dba1b chore: package.json update for @​eslint/js release (Jenkins)
  • fea8563 chore: update dependency @​eslint/core to ^0.3.0 (#18724) (renovate[bot])
  • 41d0206 feat: Add support for TS config files (#18134) (Arya Emami)

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Sep 9, 2024
Copy link
Contributor

github-actions bot commented Sep 9, 2024

Diff between eslint 8.57.0 and 9.10.0
diff --git a/lib/api.js b/lib/api.js
index v8.57.0..v9.10.0 100644
--- a/lib/api.js
+++ b/lib/api.js
@@ -10,9 +10,9 @@
 //-----------------------------------------------------------------------------
 
-const { ESLint, FlatESLint } = require("./eslint");
-const { shouldUseFlatConfig } = require("./eslint/flat-eslint");
+const { ESLint, shouldUseFlatConfig } = require("./eslint/eslint");
+const { LegacyESLint } = require("./eslint/legacy-eslint");
 const { Linter } = require("./linter");
 const { RuleTester } = require("./rule-tester");
-const { SourceCode } = require("./source-code");
+const { SourceCode } = require("./languages/js/source-code");
 
 //-----------------------------------------------------------------------------
@@ -24,20 +24,16 @@
  * @param {Object} [options] The options object
  * @param {boolean} [options.useFlatConfig] Whether or not to use a flat config
- * @param {string} [options.cwd] The current working directory
  * @returns {Promise<ESLint|LegacyESLint>} The ESLint constructor
  */
-async function loadESLint({ useFlatConfig, cwd = process.cwd() } = {}) {
+async function loadESLint({ useFlatConfig } = {}) {
 
     /*
-     * Note: The v9.x version of this function doesn't have a cwd option
-     * because it's not used. It's only used in the v8.x version of this
-     * function.
+     * Note: The v8.x version of this function also accepted a `cwd` option, but
+     * it is not used in this implementation so we silently ignore it.
      */
 
-    const shouldESLintUseFlatConfig = typeof useFlatConfig === "boolean"
-        ? useFlatConfig
-        : await shouldUseFlatConfig({ cwd });
+    const shouldESLintUseFlatConfig = useFlatConfig ?? (await shouldUseFlatConfig());
 
-    return shouldESLintUseFlatConfig ? FlatESLint : ESLint;
+    return shouldESLintUseFlatConfig ? ESLint : LegacyESLint;
 }
 
diff --git a/lib/linter/apply-disable-directives.js b/lib/linter/apply-disable-directives.js
index v8.57.0..v9.10.0 100644
--- a/lib/linter/apply-disable-directives.js
+++ b/lib/linter/apply-disable-directives.js
@@ -11,4 +11,7 @@
 
 /** @typedef {import("../shared/types").LintMessage} LintMessage */
+/** @typedef {import("@eslint/core").Language} Language */
+/** @typedef {import("@eslint/core").Position} Position */
+/** @typedef {import("@eslint/core").RulesConfig} RulesConfig */
 
 //------------------------------------------------------------------------------
@@ -17,9 +20,14 @@
 
 const escapeRegExp = require("escape-string-regexp");
+const {
+    Legacy: {
+        ConfigOps
+    }
+} = require("@eslint/eslintrc/universal");
 
 /**
  * Compares the locations of two objects in a source file
- * @param {{line: number, column: number}} itemA The first object
- * @param {{line: number, column: number}} itemB The second object
+ * @param {Position} itemA The first object
+ * @param {Position} itemB The second object
  * @returns {number} A value less than 1 if itemA appears before itemB in the source file, greater than 1 if
  * itemA appears after itemB in the source file, or 0 if itemA and itemB have the same location.
@@ -34,14 +42,14 @@
  * @returns {Directive[][]} Directives grouped by their parent comment.
  */
-function groupByParentComment(directives) {
+function groupByParentDirective(directives) {
     const groups = new Map();
 
     for (const directive of directives) {
-        const { unprocessedDirective: { parentComment } } = directive;
+        const { unprocessedDirective: { parentDirective } } = directive;
 
-        if (groups.has(parentComment)) {
-            groups.get(parentComment).push(directive);
+        if (groups.has(parentDirective)) {
+            groups.get(parentDirective).push(directive);
         } else {
-            groups.set(parentComment, [directive]);
+            groups.set(parentDirective, [directive]);
         }
     }
@@ -53,20 +61,12 @@
  * Creates removal details for a set of directives within the same comment.
  * @param {Directive[]} directives Unused directives to be removed.
- * @param {Token} commentToken The backing Comment token.
+ * @param {{node: Token, value: string}} parentDirective Data about the backing directive.
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
  * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems.
  */
-function createIndividualDirectivesRemoval(directives, commentToken) {
+function createIndividualDirectivesRemoval(directives, parentDirective, sourceCode) {
 
     /*
-     * `commentToken.value` starts right after `//` or `/*`.
-     * All calculated offsets will be relative to this index.
-     */
-    const commentValueStart = commentToken.range[0] + "//".length;
-
-    // Find where the list of rules starts. `\S+` matches with the directive name (e.g. `eslint-disable-line`)
-    const listStartOffset = /^\s*\S+\s+/u.exec(commentToken.value)[0].length;
-
-    /*
-     * Get the list text without any surrounding whitespace. In order to preserve the original
+     * Get the list of the rules text without any surrounding whitespace. In order to preserve the original
      * formatting, we don't want to change that whitespace.
      *
@@ -74,9 +74,9 @@
      *                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      */
-    const listText = commentToken.value
-        .slice(listStartOffset) // remove directive name and all whitespace before the list
-        .split(/\s-{2,}\s/u)[0] // remove `-- comment`, if it exists
-        .trimEnd(); // remove all whitespace after the list
+    const listText = parentDirective.value.trim();
 
+    // Calculate where it starts in the source code text
+    const listStart = sourceCode.text.indexOf(listText, sourceCode.getRange(parentDirective.node)[0]);
+
     /*
      * We can assume that `listText` contains multiple elements.
@@ -91,11 +91,11 @@
         const match = regex.exec(listText);
         const matchedText = match[0];
-        const matchStartOffset = listStartOffset + match.index;
-        const matchEndOffset = matchStartOffset + matchedText.length;
+        const matchStart = listStart + match.index;
+        const matchEnd = matchStart + matchedText.length;
 
         const firstIndexOfComma = matchedText.indexOf(",");
         const lastIndexOfComma = matchedText.lastIndexOf(",");
 
-        let removalStartOffset, removalEndOffset;
+        let removalStart, removalEnd;
 
         if (firstIndexOfComma !== lastIndexOfComma) {
@@ -113,6 +113,6 @@
              *                                     ^^^^^^^^^^^
              */
-            removalStartOffset = matchStartOffset + firstIndexOfComma;
-            removalEndOffset = matchStartOffset + lastIndexOfComma;
+            removalStart = matchStart + firstIndexOfComma;
+            removalEnd = matchStart + lastIndexOfComma;
 
         } else {
@@ -136,6 +136,6 @@
              *                                               ^^^^^^^^^^^^^
              */
-            removalStartOffset = matchStartOffset;
-            removalEndOffset = matchEndOffset;
+            removalStart = matchStart;
+            removalEnd = matchEnd;
         }
 
@@ -144,6 +144,6 @@
             fix: {
                 range: [
-                    commentValueStart + removalStartOffset,
-                    commentValueStart + removalEndOffset
+                    removalStart,
+                    removalEnd
                 ],
                 text: ""
@@ -155,11 +155,12 @@
 
 /**
- * Creates a description of deleting an entire unused disable comment.
+ * Creates a description of deleting an entire unused disable directive.
  * @param {Directive[]} directives Unused directives to be removed.
- * @param {Token} commentToken The backing Comment token.
- * @returns {{ description, fix, unprocessedDirective }} Details for later creation of an output Problem.
+ * @param {Token} node The backing Comment token.
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
+ * @returns {{ description, fix, unprocessedDirective }} Details for later creation of an output problem.
  */
-function createCommentRemoval(directives, commentToken) {
-    const { range } = commentToken;
+function createDirectiveRemoval(directives, node, sourceCode) {
+    const range = sourceCode.getRange(node);
     const ruleIds = directives.filter(directive => directive.ruleId).map(directive => `'${directive.ruleId}'`);
 
@@ -167,5 +168,5 @@
         description: ruleIds.length <= 2
             ? ruleIds.join(" or ")
-            : `${ruleIds.slice(0, ruleIds.length - 1).join(", ")}, or ${ruleIds[ruleIds.length - 1]}`,
+            : `${ruleIds.slice(0, ruleIds.length - 1).join(", ")}, or ${ruleIds.at(-1)}`,
         fix: {
             range,
@@ -179,13 +180,14 @@
  * Parses details from directives to create output Problems.
  * @param {Iterable<Directive>} allDirectives Unused directives to be removed.
+ * @param {SourceCode} sourceCode The source code object for the file being linted.
  * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems.
  */
-function processUnusedDirectives(allDirectives) {
-    const directiveGroups = groupByParentComment(allDirectives);
+function processUnusedDirectives(allDirectives, sourceCode) {
+    const directiveGroups = groupByParentDirective(allDirectives);
 
     return directiveGroups.flatMap(
         directives => {
-            const { parentComment } = directives[0].unprocessedDirective;
-            const remainingRuleIds = new Set(parentComment.ruleIds);
+            const { parentDirective } = directives[0].unprocessedDirective;
+            const remainingRuleIds = new Set(parentDirective.ruleIds);
 
             for (const directive of directives) {
@@ -194,6 +196,6 @@
 
             return remainingRuleIds.size
-                ? createIndividualDirectivesRemoval(directives, parentComment.commentToken)
-                : [createCommentRemoval(directives, parentComment.commentToken)];
+                ? createIndividualDirectivesRemoval(directives, parentDirective, sourceCode)
+                : [createDirectiveRemoval(directives, parentDirective.node, sourceCode)];
         }
     );
@@ -302,4 +304,5 @@
     const problems = [];
     const usedDisableDirectives = new Set();
+    const { sourceCode } = options;
 
     for (const problem of options.problems) {
@@ -338,5 +341,5 @@
             } else {
                 problem.suppressions = suppressions;
-                usedDisableDirectives.add(disableDirectivesForProblem[disableDirectivesForProblem.length - 1]);
+                usedDisableDirectives.add(disableDirectivesForProblem.at(-1));
             }
         }
@@ -346,9 +349,9 @@
 
     const unusedDisableDirectivesToReport = options.directives
-        .filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive));
+        .filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive) && !options.rulesToIgnore.has(directive.ruleId));
 
 
     const unusedEnableDirectivesToReport = new Set(
-        options.directives.filter(directive => directive.unprocessedDirective.type === "enable")
+        options.directives.filter(directive => directive.unprocessedDirective.type === "enable" && !options.rulesToIgnore.has(directive.ruleId))
     );
 
@@ -363,10 +366,12 @@
     }
 
-    const processed = processUnusedDirectives(unusedDisableDirectivesToReport)
-        .concat(processUnusedDirectives(unusedEnableDirectivesToReport));
+    const processed = processUnusedDirectives(unusedDisableDirectivesToReport, sourceCode)
+        .concat(processUnusedDirectives(unusedEnableDirectivesToReport, sourceCode));
+    const columnOffset = options.language.columnStart === 1 ? 0 : 1;
+    const lineOffset = options.language.lineStart === 1 ? 0 : 1;
 
     const unusedDirectives = processed
         .map(({ description, fix, unprocessedDirective }) => {
-            const { parentComment, type, line, column } = unprocessedDirective;
+            const { parentDirective, type, line, column } = unprocessedDirective;
 
             let message;
@@ -381,9 +386,12 @@
                     : "Unused eslint-disable directive (no problems were reported).";
             }
+
+            const loc = sourceCode.getLoc(parentDirective.node);
+
             return {
                 ruleId: null,
                 message,
-                line: type === "disable-next-line" ? parentComment.commentToken.loc.start.line : line,
-                column: type === "disable-next-line" ? parentComment.commentToken.loc.start.column + 1 : column,
+                line: type === "disable-next-line" ? loc.start.line + lineOffset : line,
+                column: type === "disable-next-line" ? loc.start.column + columnOffset : column,
                 severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2,
                 nodeType: null,
@@ -399,4 +407,6 @@
  * of reported problems, adds the suppression information to the problems.
  * @param {Object} options Information about directives and problems
+ * @param {Language} options.language The language being linted.
+ * @param {SourceCode} options.sourceCode The source code object for the file being linted.
  * @param {{
  *      type: ("disable"|"enable"|"disable-line"|"disable-next-line"),
@@ -411,9 +421,11 @@
  * A list of problems reported by rules, sorted by increasing location in the file, with one-based columns.
  * @param {"off" | "warn" | "error"} options.reportUnusedDisableDirectives If `"warn"` or `"error"`, adds additional problems for unused directives
+ * @param {RulesConfig} options.configuredRules The rules configuration.
+ * @param {Function} options.ruleFilter A predicate function to filter which rules should be executed.
  * @param {boolean} options.disableFixes If true, it doesn't make `fix` properties.
  * @returns {{ruleId: (string|null), line: number, column: number, suppressions?: {kind: string, justification: string}}[]}
  * An object with a list of reported problems, the suppressed of which contain the suppression information.
  */
-module.exports = ({ directives, disableFixes, problems, reportUnusedDisableDirectives = "off" }) => {
+module.exports = ({ language, sourceCode, directives, disableFixes, problems, configuredRules, ruleFilter, reportUnusedDisableDirectives = "off" }) => {
     const blockDirectives = directives
         .filter(directive => directive.type === "disable" || directive.type === "enable")
@@ -444,15 +456,40 @@
     }).sort(compareLocations);
 
+    // This determines a list of rules that are not being run by the given ruleFilter, if present.
+    const rulesToIgnore = configuredRules && ruleFilter
+        ? new Set(Object.keys(configuredRules).filter(ruleId => {
+            const severity = ConfigOps.getRuleSeverity(configuredRules[ruleId]);
+
+            // Ignore for disabled rules.
+            if (severity === 0) {
+                return false;
+            }
+
+            return !ruleFilter({ severity, ruleId });
+        }))
+        : new Set();
+
+    // If no ruleId is supplied that means this directive is applied to all rules, so we can't determine if it's unused if any rules are filtered out.
+    if (rulesToIgnore.size > 0) {
+        rulesToIgnore.add(null);
+    }
+
     const blockDirectivesResult = applyDirectives({
+        language,
+        sourceCode,
         problems,
         directives: blockDirectives,
         disableFixes,
-        reportUnusedDisableDirectives
+        reportUnusedDisableDirectives,
+        rulesToIgnore
     });
     const lineDirectivesResult = applyDirectives({
+        language,
+        sourceCode,
         problems: blockDirectivesResult.problems,
         directives: lineDirectives,
         disableFixes,
-        reportUnusedDisableDirectives
+        reportUnusedDisableDirectives,
+        rulesToIgnore
     });
 
diff --git a/lib/rules/array-bracket-newline.js b/lib/rules/array-bracket-newline.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/array-bracket-newline.js
+++ b/lib/rules/array-bracket-newline.js
@@ -75,5 +75,5 @@
             let consistent = false;
             let multiline = false;
-            let minItems = 0;
+            let minItems;
 
             if (option) {
diff --git a/lib/rules/array-bracket-spacing.js b/lib/rules/array-bracket-spacing.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/array-bracket-spacing.js
+++ b/lib/rules/array-bracket-spacing.js
@@ -200,5 +200,5 @@
                 penultimate = sourceCode.getTokenBefore(last),
                 firstElement = node.elements[0],
-                lastElement = node.elements[node.elements.length - 1];
+                lastElement = node.elements.at(-1);
 
             const openingBracketMustBeSpaced =
diff --git a/lib/rules/utils/ast-utils.js b/lib/rules/utils/ast-utils.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/utils/ast-utils.js
+++ b/lib/rules/utils/ast-utils.js
@@ -20,4 +20,6 @@
     shebangPattern
 } = require("../../shared/ast-utils");
+const globals = require("../../../conf/globals");
+const { LATEST_ECMA_VERSION } = require("../../../conf/ecma-version");
 
 //------------------------------------------------------------------------------
@@ -48,4 +50,10 @@
 
 /**
+ * All builtin global variables defined in the latest ECMAScript specification.
+ * @type {Record<string,boolean>} Key is the name of the variable. Value is `true` if the variable is considered writable, `false` otherwise.
+ */
+const ECMASCRIPT_GLOBALS = globals[`es${LATEST_ECMA_VERSION}`];
+
+/**
  * Checks reference if is non initializer and writable.
  * @param {Reference} reference A reference to check.
@@ -970,5 +978,5 @@
 
         case "SequenceExpression":
-            return isConstant(scope, node.expressions[node.expressions.length - 1], inBooleanPosition);
+            return isConstant(scope, node.expressions.at(-1), inBooleanPosition);
         case "SpreadElement":
             return isConstant(scope, node.argument, inBooleanPosition);
@@ -1035,9 +1043,10 @@
 /**
  * Determines whether an opening parenthesis `(`, bracket `[` or backtick ``` ` ``` needs to be preceded by a semicolon.
- * This opening parenthesis or bracket should be at the start of an `ExpressionStatement` or at the start of the body of an `ArrowFunctionExpression`.
+ * This opening parenthesis or bracket should be at the start of an `ExpressionStatement`, a `MethodDefinition` or at
+ * the start of the body of an `ArrowFunctionExpression`.
  * @type {(sourceCode: SourceCode, node: ASTNode) => boolean}
  * @param {SourceCode} sourceCode The source code object.
  * @param {ASTNode} node A node at the position where an opening parenthesis or bracket will be inserted.
- * @returns {boolean} Whether a semicolon is required before the opening parenthesis or braket.
+ * @returns {boolean} Whether a semicolon is required before the opening parenthesis or bracket.
  */
 let needsPrecedingSemicolon;
@@ -1099,5 +1108,5 @@
         if (isClosingBraceToken(prevToken)) {
             return (
-                prevNode.type === "BlockStatement" && prevNode.parent.type === "FunctionExpression" ||
+                prevNode.type === "BlockStatement" && prevNode.parent.type === "FunctionExpression" && prevNode.parent.parent.type !== "MethodDefinition" ||
                 prevNode.type === "ClassBody" && prevNode.parent.type === "ClassExpression" ||
                 prevNode.type === "ObjectExpression"
@@ -1134,4 +1143,5 @@
     SHEBANG_MATCHER: shebangPattern,
     STATEMENT_LIST_PARENTS,
+    ECMASCRIPT_GLOBALS,
 
     /**
@@ -1232,5 +1242,5 @@
      */
     isSurroundedBy(val, character) {
-        return val[0] === character && val[val.length - 1] === character;
+        return val[0] === character && val.at(-1) === character;
     },
 
@@ -1910,6 +1920,6 @@
     getFunctionHeadLoc(node, sourceCode) {
         const parent = node.parent;
-        let start = null;
-        let end = null;
+        let start;
+        let end;
 
         if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") {
@@ -2056,5 +2066,5 @@
                 const exprs = node.expressions;
 
-                return exprs.length !== 0 && module.exports.couldBeError(exprs[exprs.length - 1]);
+                return exprs.length !== 0 && module.exports.couldBeError(exprs.at(-1));
             }
 
@@ -2120,7 +2130,7 @@
             const comments = tokens.comments;
 
-            leftToken = tokens[tokens.length - 1];
+            leftToken = tokens.at(-1);
             if (comments.length) {
-                const lastComment = comments[comments.length - 1];
+                const lastComment = comments.at(-1);
 
                 if (!leftToken || lastComment.range[0] > leftToken.range[0]) {
diff --git a/lib/source-code/token-store/backward-token-comment-cursor.js b/lib/source-code/token-store/backward-token-comment-cursor.js
deleted file mode 100644
index v8.57.0..v9.10.0 
--- a/lib/source-code/token-store/backward-token-comment-cursor.js
+++ b/lib/source-code/token-store/backward-token-comment-cursor.js
@@ -1,57 +0,0 @@
-/**
- * @fileoverview Define the cursor which iterates tokens and comments in reverse.
- * @author Toru Nagashima
- */
-"use strict";
-
-//------------------------------------------------------------------------------
-// Requirements
-//------------------------------------------------------------------------------
-
-const Cursor = require("./cursor");
-const utils = require("./utils");
-
-//------------------------------------------------------------------------------
-// Exports
-//------------------------------------------------------------------------------
-
-/**
- * The cursor which iterates tokens and comments in reverse.
- */
-module.exports = class BackwardTokenCommentCursor extends Cursor {
-
-    /**
-     * Initializes this cursor.
-     * @param {Token[]} tokens The array of tokens.
-     * @param {Comment[]} comments The array of comments.
-     * @param {Object} indexMap The map from locations to indices in `tokens`.
-     * @param {number} startLoc The start location of the iteration range.
-     * @param {number} endLoc The end location of the iteration range.
-     */
-    constructor(tokens, comments, indexMap, startLoc, endLoc) {
-        super();
-        this.tokens = tokens;
-        this.comments = comments;
-        this.tokenIndex = utils.getLastIndex(tokens, indexMap, endLoc);
-        this.commentIndex = utils.search(comments, endLoc) - 1;
-        this.border = startLoc;
-    }
-
-    /** @inheritdoc */
-    moveNext() {
-        const token = (this.tokenIndex >= 0) ? this.tokens[this.tokenIndex] : null;
-        const comment = (this.commentIndex >= 0) ? this.comments[this.commentIndex] : null;
-
-        if (token && (!comment || token.range[1] > comment.range[1])) {
-            this.current = token;
-            this.tokenIndex -= 1;
-        } else if (comment) {
-            this.current = comment;
-            this.commentIndex -= 1;
-        } else {
-            this.current = null;
-        }
-
-        return Boolean(this.current) && (this.border === -1 || this.current.range[0] >= this.border);
-    }
-};
\ No newline at end of file
diff --git a/lib/source-code/token-store/backward-token-cursor.js b/lib/source-code/token-store/backward-token-cursor.js
deleted file mode 100644
index v8.57.0..v9.10.0 
--- a/lib/source-code/token-store/backward-token-cursor.js
+++ b/lib/source-code/token-store/backward-token-cursor.js
@@ -1,58 +0,0 @@
-/**
- * @fileoverview Define the cursor which iterates tokens only in reverse.
- * @author Toru Nagashima
- */
-"use strict";
-
-//------------------------------------------------------------------------------
-// Requirements
-//------------------------------------------------------------------------------
-
-const Cursor = require("./cursor");
-const utils = require("./utils");
-
-//------------------------------------------------------------------------------
-// Exports
-//------------------------------------------------------------------------------
-
-/**
- * The cursor which iterates tokens only in reverse.
- */
-module.exports = class BackwardTokenCursor extends Cursor {
-
-    /**
-     * Initializes this cursor.
-     * @param {Token[]} tokens The array of tokens.
-     * @param {Comment[]} comments The array of comments.
-     * @param {Object} indexMap The map from locations to indices in `tokens`.
-     * @param {number} startLoc The start location of the iteration range.
-     * @param {number} endLoc The end location of the iteration range.
-     */
-    constructor(tokens, comments, indexMap, startLoc, endLoc) {
-        super();
-        this.tokens = tokens;
-        this.index = utils.getLastIndex(tokens, indexMap, endLoc);
-        this.indexEnd = utils.getFirstIndex(tokens, indexMap, startLoc);
-    }
-
-    /** @inheritdoc */
-    moveNext() {
-        if (this.index >= this.indexEnd) {
-            this.current = this.tokens[this.index];
-            this.index -= 1;
-            return true;
-        }
-        return false;
-    }
-
-    /*
-     *
-     * Shorthand for performance.
-     *
-     */
-
-    /** @inheritdoc */
-    getOneToken() {
-        return (this.index >= this.indexEnd) ? this.tokens[this.index] : null;
-    }
-};
\ No newline at end of file
diff --git a/lib/rules/block-scoped-var.js b/lib/rules/block-scoped-var.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/block-scoped-var.js
+++ b/lib/rules/block-scoped-var.js
@@ -80,5 +80,5 @@
 
             // Defines a predicate to check whether or not a given reference is outside of valid scope.
-            const scopeRange = stack[stack.length - 1];
+            const scopeRange = stack.at(-1);
 
             /**
diff --git a/lib/rules/callback-return.js b/lib/rules/callback-return.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/callback-return.js
+++ b/lib/rules/callback-return.js
@@ -148,5 +148,5 @@
 
                     // find the last item in the block
-                    const lastItem = closestBlock.body[closestBlock.body.length - 1];
+                    const lastItem = closestBlock.body.at(-1);
 
                     // if the callback is the last thing in a block that might be ok
@@ -169,5 +169,5 @@
 
                         // but only if the callback is immediately before
-                        if (isCallbackExpression(node, closestBlock.body[closestBlock.body.length - 2])) {
+                        if (isCallbackExpression(node, closestBlock.body.at(-2))) {
                             return;
                         }
diff --git a/lib/rules/camelcase.js b/lib/rules/camelcase.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/camelcase.js
+++ b/lib/rules/camelcase.js
@@ -48,9 +48,7 @@
                     allow: {
                         type: "array",
-                        items: [
-                            {
-                                type: "string"
-                            }
-                        ],
+                        items: {
+                            type: "string"
+                        },
                         minItems: 0,
                         uniqueItems: true
diff --git a/lib/rules/capitalized-comments.js b/lib/rules/capitalized-comments.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/capitalized-comments.js
+++ b/lib/rules/capitalized-comments.js
@@ -9,5 +9,4 @@
 //------------------------------------------------------------------------------
 
-const LETTER_PATTERN = require("./utils/patterns/letters");
 const astUtils = require("./utils/ast-utils");
 
@@ -18,5 +17,6 @@
 const DEFAULT_IGNORE_PATTERN = astUtils.COMMENTS_IGNORE_PATTERN,
     WHITESPACE = /\s/gu,
-    MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/u; // TODO: Combine w/ max-len pattern?
+    MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/u, // TODO: Combine w/ max-len pattern?
+    LETTER_PATTERN = /\p{L}/u;
 
 /*
@@ -234,5 +234,6 @@
             }
 
-            const firstWordChar = commentWordCharsOnly[0];
+            // Get the first Unicode character (1 or 2 code units).
+            const [firstWordChar] = commentWordCharsOnly;
 
             if (!LETTER_PATTERN.test(firstWordChar)) {
@@ -274,10 +275,12 @@
                     fix(fixer) {
                         const match = comment.value.match(LETTER_PATTERN);
+                        const char = match[0];
 
+                        // Offset match.index by 2 to account for the first 2 characters that start the comment (// or /*)
+                        const charIndex = comment.range[0] + match.index + 2;
+
                         return fixer.replaceTextRange(
-
-                            // Offset match.index by 2 to account for the first 2 characters that start the comment (// or /*)
-                            [comment.range[0] + match.index + 2, comment.range[0] + match.index + 3],
-                            capitalize === "always" ? match[0].toLocaleUpperCase() : match[0].toLocaleLowerCase()
+                            [charIndex, charIndex + char.length],
+                            capitalize === "always" ? char.toLocaleUpperCase() : char.toLocaleLowerCase()
                         );
                     }
diff --git a/lib/cli-engine/formatters/checkstyle.js b/lib/cli-engine/formatters/checkstyle.js
deleted file mode 100644
index v8.57.0..v9.10.0 
--- a/lib/cli-engine/formatters/checkstyle.js
+++ b/lib/cli-engine/formatters/checkstyle.js
@@ -1,60 +0,0 @@
-/**
- * @fileoverview CheckStyle XML reporter
- * @author Ian Christian Myers
- */
-"use strict";
-
-const xmlEscape = require("../xml-escape");
-
-//------------------------------------------------------------------------------
-// Helper Functions
-//------------------------------------------------------------------------------
-
-/**
- * Returns the severity of warning or error
- * @param {Object} message message object to examine
- * @returns {string} severity level
- * @private
- */
-function getMessageType(message) {
-    if (message.fatal || message.severity === 2) {
-        return "error";
-    }
-    return "warning";
-
-}
-
-//------------------------------------------------------------------------------
-// Public Interface
-//------------------------------------------------------------------------------
-
-module.exports = function(results) {
-
-    let output = "";
-
-    output += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
-    output += "<checkstyle version=\"4.3\">";
-
-    results.forEach(result => {
-        const messages = result.messages;
-
-        output += `<file name="${xmlEscape(result.filePath)}">`;
-
-        messages.forEach(message => {
-            output += [
-                `<error line="${xmlEscape(message.line || 0)}"`,
-                `column="${xmlEscape(message.column || 0)}"`,
-                `severity="${xmlEscape(getMessageType(message))}"`,
-                `message="${xmlEscape(message.message)}${message.ruleId ? ` (${message.ruleId})` : ""}"`,
-                `source="${message.ruleId ? xmlEscape(`eslint.rules.${message.ruleId}`) : ""}" />`
-            ].join(" ");
-        });
-
-        output += "</file>";
-
-    });
-
-    output += "</checkstyle>";
-
-    return output;
-};
\ No newline at end of file
diff --git a/lib/cli-engine/cli-engine.js b/lib/cli-engine/cli-engine.js
index v8.57.0..v9.10.0 100644
--- a/lib/cli-engine/cli-engine.js
+++ b/lib/cli-engine/cli-engine.js
@@ -16,6 +16,6 @@
 //------------------------------------------------------------------------------
 
-const fs = require("fs");
-const path = require("path");
+const fs = require("node:fs");
+const path = require("node:path");
 const defaultOptions = require("../../conf/default-cli-options");
 const pkg = require("../../package.json");
@@ -42,4 +42,15 @@
 
 const debug = require("debug")("eslint:cli-engine");
+const removedFormatters = new Set([
+    "checkstyle",
+    "codeframe",
+    "compact",
+    "jslint-xml",
+    "junit",
+    "table",
+    "tap",
+    "unix",
+    "visualstudio"
+]);
 const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
 
@@ -640,5 +651,5 @@
         const lintResultCache =
             options.cache ? new LintResultCache(cacheFilePath, options.cacheStrategy) : null;
-        const linter = new Linter({ cwd: options.cwd });
+        const linter = new Linter({ cwd: options.cwd, configType: "eslintrc" });
 
         /** @type {ConfigArray[]} */
@@ -722,5 +733,5 @@
      */
     static outputFixes(report) {
-        report.results.filter(result => Object.prototype.hasOwnProperty.call(result, "output")).forEach(result => {
+        report.results.filter(result => Object.hasOwn(result, "output")).forEach(result => {
             fs.writeFileSync(result.filePath, result.output);
         });
@@ -1048,5 +1059,5 @@
                 return require(formatterPath);
             } catch (ex) {
-                if (format === "table" || format === "codeframe") {
+                if (removedFormatters.has(format)) {
                     ex.message = `The ${format} formatter is no longer part of core ESLint. Install it manually with \`npm install -D eslint-formatter-${format}\``;
                 } else {
diff --git a/lib/cli.js b/lib/cli.js
index v8.57.0..v9.10.0 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -16,9 +16,9 @@
 //------------------------------------------------------------------------------
 
-const fs = require("fs"),
-    path = require("path"),
-    { promisify } = require("util"),
-    { ESLint } = require("./eslint"),
-    { FlatESLint, shouldUseFlatConfig } = require("./eslint/flat-eslint"),
+const fs = require("node:fs"),
+    path = require("node:path"),
+    { promisify } = require("node:util"),
+    { LegacyESLint } = require("./eslint"),
+    { ESLint, shouldUseFlatConfig, locateConfigFileToUse } = require("./eslint/eslint"),
     createCLIOptions = require("./options"),
     log = require("./shared/logging"),
@@ -27,5 +27,4 @@
 const { Legacy: { naming } } = require("@eslint/eslintrc");
 const { ModuleImporter } = require("@humanwhocodes/module-importer");
-
 const debug = require("debug")("eslint:cli");
 
@@ -38,4 +37,5 @@
 /** @typedef {import("./eslint/eslint").LintResult} LintResult */
 /** @typedef {import("./options").ParsedCLIOptions} ParsedCLIOptions */
+/** @typedef {import("./shared/types").Plugin} Plugin */
 /** @typedef {import("./shared/types").ResultsMeta} ResultsMeta */
 
@@ -49,4 +49,30 @@
 
 /**
+ * Loads plugins with the specified names.
+ * @param {{ "import": (name: string) => Promise<any> }} importer An object with an `import` method called once for each plugin.
+ * @param {string[]} pluginNames The names of the plugins to be loaded, with or without the "eslint-plugin-" prefix.
+ * @returns {Promise<Record<string, Plugin>>} A mapping of plugin short names to implementations.
+ */
+async function loadPlugins(importer, pluginNames) {
+    const plugins = {};
+
+    await Promise.all(pluginNames.map(async pluginName => {
+
+        const longName = naming.normalizePackageName(pluginName, "eslint-plugin");
+        const module = await importer.import(longName);
+
+        if (!("default" in module)) {
+            throw new Error(`"${longName}" cannot be used with the \`--plugin\` option because its default module does not provide a \`default\` export`);
+        }
+
+        const shortName = naming.getShorthandName(pluginName, "eslint-plugin");
+
+        plugins[shortName] = module.default;
+    }));
+
+    return plugins;
+}
+
+/**
  * Predicate function for whether or not to apply fixes in quiet mode.
  * If a message is a warning, do not apply a fix.
@@ -60,4 +86,14 @@
 
 /**
+ * Predicate function for whether or not to run a rule in quiet mode.
+ * If a rule is set to warning, do not run it.
+ * @param {{ ruleId: string; severity: number; }} rule The rule id and severity.
+ * @returns {boolean} True if the lint rule should run, false otherwise.
+ */
+function quietRuleFilter(rule) {
+    return rule.severity === 2;
+}
+
+/**
  * Translates the CLI options into the options expected by the ESLint constructor.
  * @param {ParsedCLIOptions} cliOptions The CLI options to translate.
@@ -81,4 +117,5 @@
     fixDryRun,
     fixType,
+    flag,
     global,
     ignore,
@@ -95,5 +132,8 @@
     rule,
     rulesdir,
-    warnIgnored
+    stats,
+    warnIgnored,
+    passOnNoPatterns,
+    maxWarnings
 }, configType) {
 
@@ -141,15 +181,5 @@
 
         if (plugin) {
-            const plugins = {};
-
-            for (const pluginName of plugin) {
-
-                const shortName = naming.getShorthandName(pluginName, "eslint-plugin");
-                const longName = naming.normalizePackageName(pluginName, "eslint-plugin");
-
-                plugins[shortName] = await importer.import(longName);
-            }
-
-            overrideConfig[0].plugins = plugins;
+            overrideConfig[0].plugins = await loadPlugins(importer, plugin);
         }
 
@@ -188,10 +218,19 @@
         ignore,
         overrideConfig,
-        overrideConfigFile
+        overrideConfigFile,
+        passOnNoPatterns
     };
 
     if (configType === "flat") {
         options.ignorePatterns = ignorePattern;
+        options.stats = stats;
         options.warnIgnored = warnIgnored;
+        options.flags = flag;
+
+        /*
+         * For performance reasons rules not marked as 'error' are filtered out in quiet mode. As maxWarnings
+         * requires rules set to 'warn' to be run, we only filter out 'warn' rules if maxWarnings is not specified.
+         */
+        options.ruleFilter = quiet && maxWarnings === -1 ? quietRuleFilter : () => true;
     } else {
         options.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
@@ -267,23 +306,21 @@
     const output = await formatter.format(results, resultsMeta);
 
-    if (output) {
-        if (outputFile) {
-            const filePath = path.resolve(process.cwd(), outputFile);
+    if (outputFile) {
+        const filePath = path.resolve(process.cwd(), outputFile);
 
-            if (await isDirectory(filePath)) {
-                log.error("Cannot write to output file path, it is a directory: %s", outputFile);
-                return false;
-            }
+        if (await isDirectory(filePath)) {
+            log.error("Cannot write to output file path, it is a directory: %s", outputFile);
+            return false;
+        }
 
-            try {
-                await mkdir(path.dirname(filePath), { recursive: true });
-                await writeFile(filePath, output);
-            } catch (ex) {
-                log.error("There was a problem writing the output file:\n%s", ex);
-                return false;
-            }
-        } else {
-            log.info(output);
+        try {
+            await mkdir(path.dirname(filePath), { recursive: true });
+            await writeFile(filePath, output);
+        } catch (ex) {
+            log.error("There was a problem writing the output file:\n%s", ex);
+            return false;
         }
+    } else if (output) {
+        log.info(output);
     }
 
@@ -302,11 +339,33 @@
 
     /**
+     * Calculates the command string for the --inspect-config operation.
+     * @param {string} configFile The path to the config file to inspect.
+     * @param {boolean} hasUnstableTSConfigFlag `true` if the `unstable_ts_config` flag is enabled, `false` if it's not.
+     * @returns {Promise<string>} The command string to execute.
+     */
+    async calculateInspectConfigFlags(configFile, hasUnstableTSConfigFlag) {
+
+        // find the config file
+        const {
+            configFilePath,
+            basePath,
+            error
+        } = await locateConfigFileToUse({ cwd: process.cwd(), configFile }, hasUnstableTSConfigFlag);
+
+        if (error) {
+            throw error;
+        }
+
+        return ["--config", configFilePath, "--basePath", basePath];
+    },
+
+    /**
      * Executes the CLI based on an array of arguments that is passed in.
      * @param {string|Array|Object} args The arguments to process.
      * @param {string} [text] The text to lint (used for TTY).
-     * @param {boolean} [allowFlatConfig] Whether or not to allow flat config.
+     * @param {boolean} [allowFlatConfig=true] Whether or not to allow flat config.
      * @returns {Promise<number>} The exit code for the operation.
      */
-    async execute(args, text, allowFlatConfig) {
+    async execute(args, text, allowFlatConfig = true) {
         if (Array.isArray(args)) {
             debug("CLI args: %o", args.slice(2));
@@ -324,4 +383,8 @@
         debug("Using flat config?", usingFlatConfig);
 
+        if (allowFlatConfig && !usingFlatConfig) {
+            process.emitWarning("You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details.", "ESLintRCWarning");
+        }
+
         const CLIOptions = createCLIOptions(usingFlatConfig);
 
@@ -377,6 +440,6 @@
 
             const engine = usingFlatConfig
-                ? new FlatESLint(await translateOptions(options, "flat"))
-                : new ESLint(await translateOptions(options));
+                ? new ESLint(await translateOptions(options, "flat"))
+                : new LegacyESLint(await translateOptions(options));
             const fileConfig =
                 await engine.calculateConfigForFile(options.printConfig);
@@ -386,4 +449,22 @@
         }
 
+        if (options.inspectConfig) {
+
+            log.info("You can also run this command directly using 'npx @eslint/config-inspector@latest' in the same directory as your configuration file.");
+
+            try {
+                const flatOptions = await translateOptions(options, "flat");
+                const spawn = require("cross-spawn");
+                const flags = await cli.calculateInspectConfigFlags(flatOptions.overrideConfigFile, flatOptions.flags ? flatOptions.flags.includes("unstable_ts_config") : false);
+
+                spawn.sync("npx", ["@eslint/config-inspector@latest", ...flags], { encoding: "utf8", stdio: "inherit" });
+            } catch (error) {
+                log.error(error);
+                return 2;
+            }
+
+            return 0;
+        }
+
         debug(`Running on ${useStdin ? "text" : "files"}`);
 
@@ -406,7 +487,7 @@
         }
 
-        const ActiveESLint = usingFlatConfig ? FlatESLint : ESLint;
-
-        const engine = new ActiveESLint(await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc"));
+        const ActiveESLint = usingFlatConfig ? ESLint : LegacyESLint;
+        const eslintOptions = await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc");
+        const engine = new ActiveESLint(eslintOptions);
         let results;
 
diff --git a/lib/linter/code-path-analysis/code-path-analyzer.js b/lib/linter/code-path-analysis/code-path-analyzer.js
index v8.57.0..v9.10.0 100644
--- a/lib/linter/code-path-analysis/code-path-analyzer.js
+++ b/lib/linter/code-path-analysis/code-path-analyzer.js
@@ -10,5 +10,5 @@
 //------------------------------------------------------------------------------
 
-const assert = require("assert"),
+const assert = require("node:assert"),
     { breakableTypePattern } = require("../../shared/ast-utils"),
     CodePath = require("./code-path"),
@@ -223,5 +223,4 @@
 
             debug.dump(`${eventName} ${headSegment.id}`);
-
             CodePathSegment.markUsed(headSegment);
             analyzer.emitter.emit(
diff --git a/lib/linter/code-path-analysis/code-path.js b/lib/linter/code-path-analysis/code-path.js
index v8.57.0..v9.10.0 100644
--- a/lib/linter/code-path-analysis/code-path.js
+++ b/lib/linter/code-path-analysis/code-path.js
@@ -127,18 +127,4 @@
 
     /**
-     * Tracks the traversal of the code path through each segment. This array
-     * starts empty and segments are added or removed as the code path is
-     * traversed. This array always ends up empty at the end of a code path
-     * traversal. The `CodePathState` uses this to track its progress through
-     * the code path.
-     * This is a passthrough to the underlying `CodePathState`.
-     * @type {CodePathSegment[]}
-     * @deprecated
-     */
-    get currentSegments() {
-        return this.internal.currentSegments;
-    }
-
-    /**
      * Traverses all segments in this code path.
      *
@@ -181,7 +167,7 @@
 
         // set up initial location information
-        let record = null;
-        let index = 0;
-        let end = 0;
+        let record;
+        let index;
+        let end;
         let segment = null;
 
@@ -192,6 +178,6 @@
         const stack = [[startSegment, 0]];
 
-        // tracks the last skipped segment during traversal
-        let skippedSegment = null;
+        // segments that have been skipped during traversal
+        const skipped = new Set();
 
         // indicates if we exited early from the traversal
@@ -208,9 +194,5 @@
              */
             skip() {
-                if (stack.length <= 1) {
-                    broken = true;
-                } else {
-                    skippedSegment = stack[stack.length - 2][0];
-                }
+                skipped.add(segment);
             },
 
@@ -237,4 +219,16 @@
         }
 
+        /**
+         * Checks if a given previous segment has been skipped.
+         * @param {CodePathSegment} prevSegment A previous segment to check.
+         * @returns {boolean} `true` if the segment has been skipped.
+         */
+        function isSkipped(prevSegment) {
+            return (
+                skipped.has(prevSegment) ||
+                segment.isLoopedPrevSegment(prevSegment)
+            );
+        }
+
         // the traversal
         while (stack.length > 0) {
@@ -252,5 +246,5 @@
              * record as we traverse.
              */
-            record = stack[stack.length - 1];
+            record = stack.at(-1);
             segment = record[0];
             index = record[1];
@@ -273,15 +267,19 @@
                 }
 
-                // Reset the skipping flag if all branches have been skipped.
-                if (skippedSegment && segment.prevSegments.includes(skippedSegment)) {
-                    skippedSegment = null;
-                }
                 visited.add(segment);
 
+
+                // Skips the segment if all previous segments have been skipped.
+                const shouldSkip = (
+                    skipped.size > 0 &&
+                    segment.prevSegments.length > 0 &&
+                    segment.prevSegments.every(isSkipped)
+                );
+
                 /*
                  * If the most recent segment hasn't been skipped, then we call
                  * the callback, passing in the segment and the controller.
                  */
-                if (!skippedSegment) {
+                if (!shouldSkip) {
                     resolvedCallback.call(this, segment, controller);
 
@@ -299,4 +297,8 @@
                         break;
                     }
+                } else {
+
+                    // If the most recent segment has been skipped, then mark it as skipped.
+                    skipped.add(segment);
                 }
             }
diff --git a/lib/rules/comma-dangle.js b/lib/rules/comma-dangle.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/comma-dangle.js
+++ b/lib/rules/comma-dangle.js
@@ -155,5 +155,5 @@
              */
             function last(array) {
-                return array[array.length - 1];
+                return array.at(-1);
             }
 
diff --git a/lib/rules/comma-style.js b/lib/rules/comma-style.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/comma-style.js
+++ b/lib/rules/comma-style.js
@@ -67,5 +67,5 @@
         };
 
-        if (context.options.length === 2 && Object.prototype.hasOwnProperty.call(context.options[1], "exceptions")) {
+        if (context.options.length === 2 && Object.hasOwn(context.options[1], "exceptions")) {
             const keys = Object.keys(context.options[1].exceptions);
 
@@ -219,5 +219,5 @@
                         previousItemToken = tokenAfterItem
                             ? sourceCode.getTokenBefore(tokenAfterItem)
-                            : sourceCode.ast.tokens[sourceCode.ast.tokens.length - 1];
+                            : sourceCode.ast.tokens.at(-1);
                     } else {
                         previousItemToken = currentItemToken;
diff --git a/lib/cli-engine/formatters/compact.js b/lib/cli-engine/formatters/compact.js
deleted file mode 100644
index v8.57.0..v9.10.0 
--- a/lib/cli-engine/formatters/compact.js
+++ b/lib/cli-engine/formatters/compact.js
@@ -1,60 +0,0 @@
-/**
- * @fileoverview Compact reporter
- * @author Nicholas C. Zakas
- */
-"use strict";
-
-//------------------------------------------------------------------------------
-// Helper Functions
-//------------------------------------------------------------------------------
-
-/**
- * Returns the severity of warning or error
- * @param {Object} message message object to examine
- * @returns {string} severity level
- * @private
- */
-function getMessageType(message) {
-    if (message.fatal || message.severity === 2) {
-        return "Error";
-    }
-    return "Warning";
-
-}
-
-
-//------------------------------------------------------------------------------
-// Public Interface
-//------------------------------------------------------------------------------
-
-module.exports = function(results) {
-
-    let output = "",
-        total = 0;
-
-    results.forEach(result => {
-
-        const messages = result.messages;
-
-        total += messages.length;
-
-        messages.forEach(message => {
-
-            output += `${result.filePath}: `;
-            output += `line ${message.line || 0}`;
-            output += `, col ${message.column || 0}`;
-            output += `, ${getMessageType(message)}`;
-            output += ` - ${message.message}`;
-            output += message.ruleId ? ` (${message.ruleId})` : "";
-            output += "\n";
-
-        });
-
-    });
-
-    if (total > 0) {
-        output += `\n${total} problem${total !== 1 ? "s" : ""}`;
-    }
-
-    return output;
-};
\ No newline at end of file
diff --git a/lib/rules/complexity.js b/lib/rules/complexity.js
index v8.57.0..v9.10.0 100644
--- a/lib/rules/complexity.js
+++ b/lib/rules/complexity.js
@@ -65,5 +65,5 @@
         if (
             typeof option === "object" &&
-            (Object.prototype.hasOwnProperty.call(option, "maximum") || Object.prototype.hasOwnProperty.call(option, "max"))
+            (Object.hasOwn(option, "maximum") || Object.hasOwn(option, "max"))
         ) {
             THRESHOLD = option.maximum || option.max;
@@ -110,4 +110,5 @@
             WhileStatement: increaseComplexity,
             DoWhileStatement: increaseComplexity,
+            AssignmentPattern: increaseComplexity,
 
             // Avoid `default`
@@ -121,4 +122,16 @@
             },
 
+            MemberExpression(node) {
+                if (node.optional === true) {
+                    increaseComplexity();
+                }
+            },
+
+            CallExpression(node) {
+                if (node.optional === true) {
+                    increaseComplexity();
+                }
+            },
+
             onCodePathEnd(codePath, node) {
                 const complexity = complexities.pop();
diff --git a/lib/linter/config-comment-parser.js b/lib/linter/config-comment-parser.js
deleted file mode 100644
index v8.57.0..v9.10.0 
--- a/lib/linter/config-comment-parser.js
+++ b/lib/linter/config-comment-parser.js
@@ -1,185 +0,0 @@
-/**
- * @fileoverview Config Comment Parser
- * @author Nicholas C. Zakas
- */
-
-/* eslint class-methods-use-this: off -- Methods desired on instance */
-"use strict";
-
-//------------------------------------------------------------------------------
-// Requirements
-//------------------------------------------------------------------------------
-
-const levn = require("levn"),
-    {
-        Legacy: {
-            ConfigOps
-        }
-    } = require("@eslint/eslintrc/universal"),
-    {
-        directivesPattern
-    } = require("../shared/directives");
-
-const debug = require("debug")("eslint:config-comment-parser");
-
-//------------------------------------------------------------------------------
-// Typedefs
-//------------------------------------------------------------------------------
-
-/** @typedef {import("../shared/types").LintMessage} LintMessage */
-
-//------------------------------------------------------------------------------
-// Public Interface
-//------------------------------------------------------------------------------
-
-/**
- * Object to parse ESLint configuration comments inside JavaScript files.
- * @name ConfigCommentParser
- */
-module.exports = class ConfigCommentParser {
-
-    /**
-     * Parses a list of "name:string_value" or/and "name" options divided by comma or
-     * whitespace. Used for "global" and "exported" comments.
-     * @param {string} string The string to parse.
-     * @param {Comment} comment The comment node which has the string.
-     * @returns {Object} Result map object of names and string values, or null values if no value was provided
-     */
-    parseStringConfig(string, comment) {
-        debug("Parsing String config");
-
-        const items = {};
-
-        // Collapse whitespace around `:` and `,` to make parsing easier
-        const trimmedString = string.replace(/\s*([:,])\s*/gu, "$1");
-
-        trimmedString.split(/\s|,+/u).forEach(name => {
-            if (!name) {
-                return;
-            }
-
-            // value defaults to null (if not provided), e.g: "foo" => ["foo", null]
-            const [key, value = null] = name.split(":");
-
-            items[key] = { value, comment };
-        });
-        return items;
-    }
-
-    /**
-     * Parses a JSON-like config.
-     * @param {string} string The string to parse.
-     * @param {Object} location Start line and column of comments for potential error message.
-     * @returns {({success: true, config: Object}|{success: false, error: LintMessage})} Result map object
-     */
-    parseJsonConfig(string, location) {
-        debug("Parsing JSON config");
-
-        let items = {};
-
-        // Parses a JSON-like comment by the same way as parsing CLI option.
-        try {
-            items = levn.parse("Object", string) || {};
-
-            // Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc*/`.
-            // Also, commaless notations have invalid severity:
-            //     "no-alert: 2 no-console: 2" --> {"no-alert": "2 no-console: 2"}
-            // Should ignore that case as well.
-            if (ConfigOps.isEverySeverityValid(items)) {
-                return {
-                    success: true,
-                    config: items
-                };
-            }
-        } catch {
-
-            debug("Levn parsing failed; falling back to manual parsing.");
-
-            // ignore to parse the string by a fallback.
-        }
-
-        /*
-         * Optionator cannot parse commaless notations.
-         * But we are supporting that. So this is a fallback for that.
-         */
-        items = {};
-        const normalizedString = string.replace(/([-a-zA-Z0-9/]+):/gu, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/u, "$1,");
-
-        try {
-            items = JSON.parse(`{${normalizedString}}`);
-        } catch (ex) {
-            debug("Manual parsing failed.");
-
-            return {
-                success: false,
-                error: {
-                    ruleId: null,
-                    fatal: true,
-                    severity: 2,
-                    message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`,
-                    line: location.start.line,
-                    column: location.start.column + 1,
-                    nodeType: null
-                }
-            };
-
-        }
-
-        return {
-            success: true,
-            config: items
-        };
-    }
-
-    /**
-     * Parses a config of values separated by comma.
-     * @param {string} string The string to parse.
-     * @returns {Object} Result map of values and true values
-     */
-    parseListConfig(string) {
-        debug("Parsing list config");
-
-        const items = {};
-
-        string.split(",").forEach(name => {
-            const trimmedName = name.trim().replace(/^(?<quote>['"]?)(?<ruleId>.*)\k<quote>$/us, "$<ruleId>");
-
-            if (trimmedName) {
-                items[trimmedName] = true;
-            }
-        });
-        return items;
-    }
-
-    /**
-     * Extract the directive and the justification from a given directive comment and trim them.
-     * @param {string} value The comment text to extract.
-     * @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
-     */
-    extractDirectiveComment(value) {
-        const match = /\s-{2,}\s/u.exec(value);
-
-        if (!match) {
-            return { directivePart: value.trim(), justificationPart: "" };
-        }
-
-        const directive = value.slice(0, match.index).trim();
-        const justification = value.slice(match.index + match[0].length).trim();
-
-        return { directivePart: directive, justificationPart: justification };
-    }
-
-    /**
-     * Parses a directive comment into directive text and value.
-     * @param {Comment} comment The comment node with the directive to be parsed.
-     * @returns {{directiveText: string, directiveValue: string}} The directive text and value.
-     */
-    parseDirective(comment) {
-        const { directivePart } = this.extractDirectiveComment(comment.value);
-        const match = directivesPattern.exec(directivePart);
-        const directiveText = match[1];
-        const directiveValue = directivePart.slice(match.index + directiveText.length);
-
-        return { directiveText, directiveValue };
-    }
-};
\ No newline at end of file
diff --git a/conf/config-schema.js b/conf/config-schema.js
deleted file mode 100644
index v8.57.0..v9.10.0 
--- a/conf/config-schema.js
+++ b/conf/config-schema.js
@@ -1,93 +0,0 @@
-/*
- * STOP!!! DO NOT MODIFY.
- *
- * This file is part of the ongoing work to move the eslintrc-style config
- * system into the @eslint/eslintrc package. This file needs to remain
- * unchanged in order for this work to proceed.
- *
- * If you think you need to change this file, please contact @nzakas first.
- *
- * Thanks in advance for your cooperation.
- */
-
-/**
- * @fileoverview Defines a schema for configs.
- * @author Sylvan Mably
- */
-
-"use strict";
-
-const baseConfigProperties = {
-    $schema: { type: "string" },
-    env: { type: "object" },
-    extends: { $ref: "#/definitions/stringOrStrings" },
-    globals: { type: "object" },
-    overrides: {
-        type: "array",
-        items: { $ref: "#/definitions/overrideConfig" },
-        additionalItems: false
-    },
-    parser: { type: ["string", "null"] },
-    parserOptions: { type: "object" },
-    plugins: { type: "array" },
-    processor: { type: "string" },
-    rules: { type: "object" },
-    settings: { type: "object" },
-    noInlineConfig: { type: "boolean" },
-    reportUnusedDisableDirectives: { type: "boolean" },
-
-    ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
-};
-
-const configSchema = {
-    definitions: {
-        stringOrStrings: {
-            oneOf: [
-                { type: "string" },
-                {
-                    type: "array",
-                    items: { type: "string" },
-                    additionalItems: false
-                }
-            ]
-        },
-        stringOrStringsRequired: {
-            oneOf: [
-                { type: "string" },
-                {
-                    type: "array",
-                    items: { type: "string" },
-                    additionalItems: false,
-                    minItems: 1
-                }
-            ]
-        },
-
-        // Config at top-level.
-        objectConfig: {
-            type: "object",
-            properties: {
-                root: { type: "boolean" },
-                ignorePatterns: { $ref: "#/definitions/stringOrStrings" },
-                ...baseConfigProperties
-            },
-            additionalProperties: false
-        },
-
-        // Config in `overrides`.
-        overrideConfig: {
-            type: "object",
-            properties: {
-                excludedFiles: { $ref: "#/definitions/stringOrStrings" },
-                files: { $ref: "#/definitions/stringOrStringsRequired" },
-                ...baseConfigProperties
-            },
-            required: ["files"],
-            additionalProperties: false
-        }
-    },
-
-    $ref: "#/definitions/objectConfig"
-};
-
-module.exports = configSchema;
\ No newline at end of file
diff --git a/lib/shared/config-validator.js b/lib/shared/config-validator.js
deleted file mode 100644
index v8.57.0..v9.10.0 
--- a/lib/shared/config-validator.js
+++ b/lib/shared/config-validator.js
@@ -1,347 +0,0 @@
-/*
- * STOP!!! DO NOT MODIFY.
- *
- * This file is part of the ongoing work to move the eslintrc-style config
- * system into the @eslint/eslintrc package. This file needs to remain
- * unchanged in order for this work to proceed.
- *
- * If you think you need to change this file, please contact @nzakas first.
- *
- * Thanks in advance for your cooperation.
- */
-
-/**
- * @fileoverview Validates configs.
- * @author Brandon Mills
- */
-
-"use strict";
-
-//------------------------------------------------------------------------------
-// Requirements
-//------------------------------------------------------------------------------
-
-const
-    util = require("util"),
-    configSchema = require("../../conf/config-schema"),
-    BuiltInRules = require("../rules"),
-    {
-        Legacy: {
-            ConfigOps,
-            environments: BuiltInEnvironments
-        }
-    } = require("@eslint/eslintrc"),
-    { emitDeprecationWarning } = require("./deprecation-warnings");
-
-const ajv = require("./ajv")();
-const ruleValidators = new WeakMap();
-const noop = Function.prototype;
-
-//------------------------------------------------------------------------------
-// Private
-//------------------------------------------------------------------------------
-let validateSchema;
-const severityMap = {
-    error: 2,
-    warn: 1,
-    off: 0
-};
-
-/**
- * Gets a complete options schema for a rule.
- * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object
- * @returns {Object} JSON Schema for the rule's options.
- */
-function getRuleOptionsSchema(rule) {
-    if (!rule) {
-        return null;
-    }
-
-    const schema = rule.schema || rule.meta && rule.meta.schema;
-
-    // Given a tuple of schemas, insert warning level at the beginning
-    if (Array.isArray(schema)) {
-        if (schema.length) {
-            return {
-                type: "array",
-                items: schema,
-                minItems: 0,
-                maxItems: schema.length
-            };
-        }
-        return {
-            type: "array",
-            minItems: 0,
-            maxItems: 0
-        };
-
-    }
-
-    // Given a full schema, leave it alone
-    return schema || null;
-}
-
-/**
- * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.
- * @param {options} options The given options for the rule.
- * @throws {Error} Wrong severity value.
- * @returns {number|string} The rule's severity value
- */
-function validateRuleSeverity(options) {
-    const severity = Array.isArray(options) ? options[0] : options;
-    const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity;
-
-    if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {
-        return normSeverity;
-    }
-
-    throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`);
-
-}
-
-/**
- * V

(too long so truncated)

Size Files
2.9 MB → 3.1 MB (+245.1 KB 🟡) 408 → 416 (+8 🟡)
Command details
npm diff --diff=eslint@8.57.0 --diff=eslint@9.10.0 --diff-unified=2

See also the npm diff document.

Reported by ybiquitous/npm-diff-action@v1.6.0 (Node.js 22.8.0 and npm 10.8.3)

@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/eslint-9.10.0 branch 3 times, most recently from 896e77a to 3fd9f46 Compare September 16, 2024 02:26
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/eslint-9.10.0 branch 2 times, most recently from 7fad0ba to 6673701 Compare September 16, 2024 02:28
Bumps [eslint](https://github.com/eslint/eslint) from 8.57.0 to 9.10.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v8.57.0...v9.10.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/eslint-9.10.0 branch from 6673701 to f3b468a Compare September 16, 2024 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants