eslint 9.4.0 → 9.5.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.
Files changed (32) hide show
  1. package/README.md +2 -2
  2. package/lib/api.js +1 -1
  3. package/lib/config/default-config.js +5 -0
  4. package/lib/config/flat-config-array.js +71 -8
  5. package/lib/config/flat-config-schema.js +46 -62
  6. package/lib/eslint/eslint-helpers.js +27 -17
  7. package/lib/eslint/eslint.js +14 -10
  8. package/lib/languages/js/index.js +247 -0
  9. package/lib/{source-code → languages/js/source-code}/source-code.js +38 -18
  10. package/lib/languages/js/validate-language-options.js +181 -0
  11. package/lib/linter/apply-disable-directives.js +8 -3
  12. package/lib/linter/linter.js +122 -121
  13. package/lib/linter/report-translator.js +14 -7
  14. package/lib/linter/vfile.js +104 -0
  15. package/lib/rule-tester/rule-tester.js +5 -2
  16. package/lib/rules/no-sparse-arrays.js +26 -3
  17. package/messages/all-matched-files-ignored.js +21 -0
  18. package/package.json +11 -11
  19. /package/lib/{source-code → languages/js/source-code}/index.js +0 -0
  20. /package/lib/{source-code → languages/js/source-code}/token-store/backward-token-comment-cursor.js +0 -0
  21. /package/lib/{source-code → languages/js/source-code}/token-store/backward-token-cursor.js +0 -0
  22. /package/lib/{source-code → languages/js/source-code}/token-store/cursor.js +0 -0
  23. /package/lib/{source-code → languages/js/source-code}/token-store/cursors.js +0 -0
  24. /package/lib/{source-code → languages/js/source-code}/token-store/decorative-cursor.js +0 -0
  25. /package/lib/{source-code → languages/js/source-code}/token-store/filter-cursor.js +0 -0
  26. /package/lib/{source-code → languages/js/source-code}/token-store/forward-token-comment-cursor.js +0 -0
  27. /package/lib/{source-code → languages/js/source-code}/token-store/forward-token-cursor.js +0 -0
  28. /package/lib/{source-code → languages/js/source-code}/token-store/index.js +0 -0
  29. /package/lib/{source-code → languages/js/source-code}/token-store/limit-cursor.js +0 -0
  30. /package/lib/{source-code → languages/js/source-code}/token-store/padded-token-cursor.js +0 -0
  31. /package/lib/{source-code → languages/js/source-code}/token-store/skip-cursor.js +0 -0
  32. /package/lib/{source-code → languages/js/source-code}/token-store/utils.js +0 -0
@@ -4,6 +4,8 @@
4
4
  */
5
5
  "use strict";
6
6
 
7
+ const astUtils = require("./utils/ast-utils");
8
+
7
9
  //------------------------------------------------------------------------------
8
10
  // Rule Definition
9
11
  //------------------------------------------------------------------------------
@@ -36,11 +38,32 @@ module.exports = {
36
38
  return {
37
39
 
38
40
  ArrayExpression(node) {
41
+ if (!node.elements.includes(null)) {
42
+ return;
43
+ }
44
+
45
+ const { sourceCode } = context;
46
+ let commaToken;
47
+
48
+ for (const [index, element] of node.elements.entries()) {
49
+ if (index === node.elements.length - 1 && element) {
50
+ return;
51
+ }
52
+
53
+ commaToken = sourceCode.getTokenAfter(
54
+ element ?? commaToken ?? sourceCode.getFirstToken(node),
55
+ astUtils.isCommaToken
56
+ );
39
57
 
40
- const emptySpot = node.elements.includes(null);
58
+ if (element) {
59
+ continue;
60
+ }
41
61
 
42
- if (emptySpot) {
43
- context.report({ node, messageId: "unexpectedSparseArray" });
62
+ context.report({
63
+ node,
64
+ loc: commaToken.loc,
65
+ messageId: "unexpectedSparseArray"
66
+ });
44
67
  }
45
68
  }
46
69
 
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ module.exports = function(it) {
4
+ const { pattern } = it;
5
+
6
+ return `
7
+ You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored.
8
+
9
+ If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint.
10
+
11
+ If you do want to lint these files, explicitly list one or more of the files from this glob that you'd like to lint to see more details about why they are ignored.
12
+
13
+ * If the file is ignored because of a matching ignore pattern, check global ignores in your config file.
14
+ https://eslint.org/docs/latest/use/configure/ignore
15
+
16
+ * If the file is ignored because no matching configuration was supplied, check file patterns in your config file.
17
+ https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions
18
+
19
+ * If the file is ignored because it is located outside of the base path, change the location of your config file to be in a parent directory.
20
+ `.trimStart();
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "9.4.0",
3
+ "version": "9.5.0",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "bin": {
@@ -62,15 +62,15 @@
62
62
  "messages"
63
63
  ],
64
64
  "repository": "eslint/eslint",
65
- "funding": "https://opencollective.com/eslint",
65
+ "funding": "https://eslint.org/donate",
66
66
  "homepage": "https://eslint.org",
67
67
  "bugs": "https://github.com/eslint/eslint/issues/",
68
68
  "dependencies": {
69
69
  "@eslint-community/eslint-utils": "^4.2.0",
70
70
  "@eslint-community/regexpp": "^4.6.1",
71
- "@eslint/config-array": "^0.15.1",
71
+ "@eslint/config-array": "^0.16.0",
72
72
  "@eslint/eslintrc": "^3.1.0",
73
- "@eslint/js": "9.4.0",
73
+ "@eslint/js": "9.5.0",
74
74
  "@humanwhocodes/module-importer": "^1.0.1",
75
75
  "@humanwhocodes/retry": "^0.3.0",
76
76
  "@nodelib/fs.walk": "^1.2.8",
@@ -82,7 +82,7 @@
82
82
  "eslint-scope": "^8.0.1",
83
83
  "eslint-visitor-keys": "^4.0.0",
84
84
  "espree": "^10.0.1",
85
- "esquery": "^1.4.2",
85
+ "esquery": "^1.5.0",
86
86
  "esutils": "^2.0.2",
87
87
  "fast-deep-equal": "^3.1.3",
88
88
  "file-entry-cache": "^8.0.0",
@@ -107,11 +107,11 @@
107
107
  "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
108
108
  "@types/estree": "^1.0.5",
109
109
  "@types/node": "^20.11.5",
110
- "@wdio/browser-runner": "^8.14.6",
111
- "@wdio/cli": "^8.14.6",
112
- "@wdio/concise-reporter": "^8.14.0",
113
- "@wdio/globals": "^8.14.6",
114
- "@wdio/mocha-framework": "^8.14.0",
110
+ "@wdio/browser-runner": "^8.38.3",
111
+ "@wdio/cli": "^8.38.2",
112
+ "@wdio/concise-reporter": "^8.38.2",
113
+ "@wdio/globals": "^8.38.2",
114
+ "@wdio/mocha-framework": "^8.38.2",
115
115
  "babel-loader": "^8.0.5",
116
116
  "c8": "^7.12.0",
117
117
  "chai": "^4.0.1",
@@ -142,7 +142,7 @@
142
142
  "markdown-it": "^12.2.0",
143
143
  "markdown-it-container": "^3.0.0",
144
144
  "markdownlint": "^0.34.0",
145
- "markdownlint-cli": "^0.40.0",
145
+ "markdownlint-cli": "^0.41.0",
146
146
  "marked": "^4.0.8",
147
147
  "metascraper": "^5.25.7",
148
148
  "metascraper-description": "^5.25.7",