eslint 10.0.0-beta.0 → 10.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -340,7 +340,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
340
340
  to get your logo on our READMEs and [website](https://eslint.org/sponsors).
341
341
 
342
342
  <h3>Platinum Sponsors</h3>
343
- <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
343
+ <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a></p><h3>Gold Sponsors</h3>
344
344
  <p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
345
345
  <p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/2d6c3b6/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
346
346
  <p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://www.crawljobs.com/"><img src="https://images.opencollective.com/crawljobs-poland/fa43a17/logo.png" alt="CrawlJobs" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.n-ix.com/"><img src="https://images.opencollective.com/n-ix-ltd/575a7a5/logo.png" alt="N-iX Ltd" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
@@ -249,7 +249,6 @@ module.exports = {
249
249
  {
250
250
  loc: true,
251
251
  range: true,
252
- raw: true,
253
252
  tokens: true,
254
253
  comment: true,
255
254
  eslintVisitorKeys: true,
@@ -54,10 +54,7 @@ const { FileReport, updateLocationInformation } = require("./file-report");
54
54
 
55
55
  /** @import { Language, LanguageOptions, RuleConfig, RuleDefinition } from "@eslint/core" */
56
56
 
57
- /** @typedef {import("../types").Linter.Config} Config */
58
- /** @typedef {import("../types").ESLint.ConfigData} ConfigData */
59
- /** @typedef {import("../types").ESLint.Environment} Environment */
60
- /** @typedef {import("../types").Linter.GlobalConf} GlobalConf */
57
+ /** @typedef {import("../types").Linter.Config} ConfigObject */
61
58
  /** @typedef {import("../types").Linter.LanguageOptions} JSLanguageOptions */
62
59
  /** @typedef {import("../types").Linter.LintMessage} LintMessage */
63
60
  /** @typedef {import("../types").Linter.Parser} Parser */
@@ -87,7 +84,7 @@ const { FileReport, updateLocationInformation } = require("./file-report");
87
84
  /**
88
85
  * The private data for `Linter` instance.
89
86
  * @typedef {Object} LinterInternalSlots
90
- * @property {ConfigArray|null} lastConfigArray The `ConfigArray` instance that the last `verify()` call used.
87
+ * @property {FlatConfigArray|null} lastConfigArray The `ConfigArray` instance that the last `verify()` call used.
91
88
  * @property {SourceCode|null} lastSourceCode The `SourceCode` instance that the last `verify()` call used.
92
89
  * @property {SuppressedLintMessage[]} lastSuppressedMessages The `SuppressedLintMessage[]` instance that the last `verify()` call produced.
93
90
  * @property {{ passes: TimePass[]; }} times The times spent on applying a rule to a file (see `stats` option).
@@ -349,7 +346,7 @@ function normalizeFilename(filename) {
349
346
  * Normalizes the possible options for `linter.verify` and `linter.verifyAndFix` to a
350
347
  * consistent shape.
351
348
  * @param {VerifyOptions} providedOptions Options
352
- * @param {Config|ConfigData} config Config.
349
+ * @param {Config} config Config.
353
350
  * @returns {Required<VerifyOptions> & InternalOptions} Normalized options
354
351
  */
355
352
  function normalizeVerifyOptions(providedOptions, config) {
@@ -823,7 +820,7 @@ class Linter {
823
820
  /**
824
821
  * Verifies the text against the rules specified by the second argument.
825
822
  * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object.
826
- * @param {ConfigData|ConfigArray} config An ESLintConfig instance to configure everything.
823
+ * @param {ConfigObject|ConfigObject[]} config The ESLint config object or array to use.
827
824
  * @param {(string|(VerifyOptions&ProcessorOptions))} [filenameOrOptions] The optional filename of the file being checked.
828
825
  * If this is not set, the filename will default to '<input>' in the rule context. If
829
826
  * an object, then it has "filename", "allowInlineConfig", and some properties.
@@ -1467,12 +1464,12 @@ class Linter {
1467
1464
  * Performs multiple autofix passes over the text until as many fixes as possible
1468
1465
  * have been applied.
1469
1466
  * @param {string} text The source text to apply fixes to.
1470
- * @param {ConfigData|ConfigArray|FlatConfigArray} config The ESLint config object to use.
1471
- * @param {VerifyOptions&ProcessorOptions&FixOptions} options The ESLint options object to use.
1467
+ * @param {ConfigObject|ConfigObject[]} config The ESLint config object or array to use.
1468
+ * @param {string|(VerifyOptions&ProcessorOptions&FixOptions)} [filenameOrOptions] The filename or ESLint options object to use.
1472
1469
  * @returns {{fixed:boolean,messages:LintMessage[],output:string}} The result of the fix operation as returned from the
1473
1470
  * SourceCodeFixer.
1474
1471
  */
1475
- verifyAndFix(text, config, options) {
1472
+ verifyAndFix(text, config, filenameOrOptions) {
1476
1473
  let messages,
1477
1474
  fixedResult,
1478
1475
  fixed = false,
@@ -1480,10 +1477,14 @@ class Linter {
1480
1477
  currentText = text,
1481
1478
  secondPreviousText,
1482
1479
  previousText;
1480
+ const options =
1481
+ typeof filenameOrOptions === "string"
1482
+ ? { filename: filenameOrOptions }
1483
+ : filenameOrOptions || {};
1483
1484
  const debugTextDescription =
1484
- (options && options.filename) || `${text.slice(0, 10)}...`;
1485
+ options.filename || `${text.slice(0, 10)}...`;
1485
1486
  const shouldFix =
1486
- options && typeof options.fix !== "undefined" ? options.fix : true;
1487
+ typeof options.fix !== "undefined" ? options.fix : true;
1487
1488
  const stats = options?.stats;
1488
1489
 
1489
1490
  const slots = internalSlotsMap.get(this);
@@ -1575,7 +1576,7 @@ class Linter {
1575
1576
  `Circular fixes detected after pass ${passNumber}. Exiting fix loop.`,
1576
1577
  );
1577
1578
  slots.warningService.emitCircularFixesWarning(
1578
- options?.filename ?? "text",
1579
+ options.filename ?? "text",
1579
1580
  );
1580
1581
  break;
1581
1582
  }
@@ -1610,13 +1611,4 @@ class Linter {
1610
1611
 
1611
1612
  module.exports = {
1612
1613
  Linter,
1613
-
1614
- /**
1615
- * Get the internal slots of a given Linter instance for tests.
1616
- * @param {Linter} instance The Linter instance to get.
1617
- * @returns {LinterInternalSlots} The internal slots.
1618
- */
1619
- getLinterInternalSlots(instance) {
1620
- return internalSlotsMap.get(instance);
1621
- },
1622
1614
  };