eslint 9.0.0-alpha.0 → 9.0.0-alpha.2

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 (89) hide show
  1. package/README.md +6 -1
  2. package/conf/ecma-version.js +16 -0
  3. package/lib/cli-engine/cli-engine.js +1 -1
  4. package/lib/cli-engine/lint-result-cache.js +2 -2
  5. package/lib/cli.js +14 -16
  6. package/lib/eslint/eslint.js +7 -0
  7. package/lib/linter/apply-disable-directives.js +2 -2
  8. package/lib/linter/code-path-analysis/code-path.js +32 -30
  9. package/lib/linter/code-path-analysis/fork-context.js +1 -1
  10. package/lib/linter/config-comment-parser.js +7 -10
  11. package/lib/linter/linter.js +105 -4
  12. package/lib/linter/report-translator.js +2 -2
  13. package/lib/linter/source-code-fixer.js +1 -1
  14. package/lib/rule-tester/rule-tester.js +45 -26
  15. package/lib/rules/array-bracket-newline.js +1 -1
  16. package/lib/rules/array-bracket-spacing.js +1 -1
  17. package/lib/rules/block-scoped-var.js +1 -1
  18. package/lib/rules/callback-return.js +2 -2
  19. package/lib/rules/comma-dangle.js +1 -1
  20. package/lib/rules/comma-style.js +2 -2
  21. package/lib/rules/complexity.js +1 -1
  22. package/lib/rules/constructor-super.js +1 -1
  23. package/lib/rules/default-case.js +1 -1
  24. package/lib/rules/eol-last.js +2 -2
  25. package/lib/rules/function-paren-newline.js +2 -2
  26. package/lib/rules/indent-legacy.js +5 -5
  27. package/lib/rules/indent.js +5 -5
  28. package/lib/rules/index.js +1 -0
  29. package/lib/rules/key-spacing.js +2 -2
  30. package/lib/rules/line-comment-position.js +1 -1
  31. package/lib/rules/lines-around-directive.js +2 -2
  32. package/lib/rules/max-depth.js +1 -1
  33. package/lib/rules/max-len.js +3 -3
  34. package/lib/rules/max-lines.js +3 -3
  35. package/lib/rules/max-nested-callbacks.js +1 -1
  36. package/lib/rules/max-params.js +1 -1
  37. package/lib/rules/max-statements.js +1 -1
  38. package/lib/rules/multiline-comment-style.js +7 -7
  39. package/lib/rules/new-cap.js +1 -1
  40. package/lib/rules/newline-after-var.js +1 -1
  41. package/lib/rules/newline-before-return.js +1 -1
  42. package/lib/rules/no-constant-binary-expression.js +5 -5
  43. package/lib/rules/no-constructor-return.js +1 -1
  44. package/lib/rules/no-dupe-class-members.js +2 -2
  45. package/lib/rules/no-else-return.js +1 -1
  46. package/lib/rules/no-empty-function.js +2 -2
  47. package/lib/rules/no-fallthrough.js +1 -1
  48. package/lib/rules/no-implicit-coercion.js +51 -25
  49. package/lib/rules/no-inner-declarations.js +22 -1
  50. package/lib/rules/no-invalid-this.js +1 -1
  51. package/lib/rules/no-lone-blocks.js +2 -2
  52. package/lib/rules/no-loss-of-precision.js +1 -1
  53. package/lib/rules/no-misleading-character-class.js +174 -65
  54. package/lib/rules/no-multiple-empty-lines.js +1 -1
  55. package/lib/rules/no-restricted-globals.js +1 -1
  56. package/lib/rules/no-restricted-imports.js +54 -44
  57. package/lib/rules/no-restricted-modules.js +2 -2
  58. package/lib/rules/no-return-await.js +1 -1
  59. package/lib/rules/no-this-before-super.js +17 -4
  60. package/lib/rules/no-trailing-spaces.js +2 -3
  61. package/lib/rules/no-unneeded-ternary.js +1 -1
  62. package/lib/rules/no-unsafe-optional-chaining.js +1 -1
  63. package/lib/rules/no-unused-vars.js +6 -8
  64. package/lib/rules/no-useless-assignment.js +566 -0
  65. package/lib/rules/no-useless-backreference.js +1 -1
  66. package/lib/rules/object-curly-spacing.js +3 -3
  67. package/lib/rules/object-property-newline.js +1 -1
  68. package/lib/rules/one-var.js +5 -5
  69. package/lib/rules/padded-blocks.js +7 -7
  70. package/lib/rules/prefer-arrow-callback.js +3 -3
  71. package/lib/rules/prefer-reflect.js +1 -1
  72. package/lib/rules/prefer-regex-literals.js +1 -1
  73. package/lib/rules/prefer-template.js +1 -1
  74. package/lib/rules/radix.js +2 -2
  75. package/lib/rules/semi-style.js +1 -1
  76. package/lib/rules/sort-imports.js +1 -1
  77. package/lib/rules/sort-keys.js +1 -1
  78. package/lib/rules/sort-vars.js +1 -1
  79. package/lib/rules/space-unary-ops.js +1 -1
  80. package/lib/rules/strict.js +1 -1
  81. package/lib/rules/utils/ast-utils.js +7 -7
  82. package/lib/rules/yield-star-spacing.js +1 -1
  83. package/lib/shared/serialization.js +55 -0
  84. package/lib/source-code/source-code.js +4 -4
  85. package/lib/source-code/token-store/index.js +2 -2
  86. package/package.json +7 -7
  87. package/conf/config-schema.js +0 -93
  88. package/lib/shared/config-validator.js +0 -380
  89. package/lib/shared/relative-module-resolver.js +0 -50
@@ -84,18 +84,18 @@ module.exports = {
84
84
  options.switches = shouldHavePadding;
85
85
  options.classes = shouldHavePadding;
86
86
  } else {
87
- if (Object.prototype.hasOwnProperty.call(typeOptions, "blocks")) {
87
+ if (Object.hasOwn(typeOptions, "blocks")) {
88
88
  options.blocks = typeOptions.blocks === "always";
89
89
  }
90
- if (Object.prototype.hasOwnProperty.call(typeOptions, "switches")) {
90
+ if (Object.hasOwn(typeOptions, "switches")) {
91
91
  options.switches = typeOptions.switches === "always";
92
92
  }
93
- if (Object.prototype.hasOwnProperty.call(typeOptions, "classes")) {
93
+ if (Object.hasOwn(typeOptions, "classes")) {
94
94
  options.classes = typeOptions.classes === "always";
95
95
  }
96
96
  }
97
97
 
98
- if (Object.prototype.hasOwnProperty.call(exceptOptions, "allowSingleLineBlocks")) {
98
+ if (Object.hasOwn(exceptOptions, "allowSingleLineBlocks")) {
99
99
  options.allowSingleLineBlocks = exceptOptions.allowSingleLineBlocks === true;
100
100
  }
101
101
 
@@ -277,7 +277,7 @@ module.exports = {
277
277
 
278
278
  const rule = {};
279
279
 
280
- if (Object.prototype.hasOwnProperty.call(options, "switches")) {
280
+ if (Object.hasOwn(options, "switches")) {
281
281
  rule.SwitchStatement = function(node) {
282
282
  if (node.cases.length === 0) {
283
283
  return;
@@ -286,7 +286,7 @@ module.exports = {
286
286
  };
287
287
  }
288
288
 
289
- if (Object.prototype.hasOwnProperty.call(options, "blocks")) {
289
+ if (Object.hasOwn(options, "blocks")) {
290
290
  rule.BlockStatement = function(node) {
291
291
  if (node.body.length === 0) {
292
292
  return;
@@ -296,7 +296,7 @@ module.exports = {
296
296
  rule.StaticBlock = rule.BlockStatement;
297
297
  }
298
298
 
299
- if (Object.prototype.hasOwnProperty.call(options, "classes")) {
299
+ if (Object.hasOwn(options, "classes")) {
300
300
  rule.ClassBody = function(node) {
301
301
  if (node.body.length === 0) {
302
302
  return;
@@ -220,7 +220,7 @@ module.exports = {
220
220
 
221
221
  // If there are below, it cannot replace with arrow functions merely.
222
222
  ThisExpression() {
223
- const info = stack[stack.length - 1];
223
+ const info = stack.at(-1);
224
224
 
225
225
  if (info) {
226
226
  info.this = true;
@@ -228,7 +228,7 @@ module.exports = {
228
228
  },
229
229
 
230
230
  Super() {
231
- const info = stack[stack.length - 1];
231
+ const info = stack.at(-1);
232
232
 
233
233
  if (info) {
234
234
  info.super = true;
@@ -236,7 +236,7 @@ module.exports = {
236
236
  },
237
237
 
238
238
  MetaProperty(node) {
239
- const info = stack[stack.length - 1];
239
+ const info = stack.at(-1);
240
240
 
241
241
  if (info && checkMetaProperty(node, "new", "target")) {
242
242
  info.meta = true;
@@ -105,7 +105,7 @@ module.exports = {
105
105
  CallExpression(node) {
106
106
  const methodName = (node.callee.property || {}).name;
107
107
  const isReflectCall = (node.callee.object || {}).name === "Reflect";
108
- const hasReflectSubstitute = Object.prototype.hasOwnProperty.call(reflectSubstitutes, methodName);
108
+ const hasReflectSubstitute = Object.hasOwn(reflectSubstitutes, methodName);
109
109
  const userConfiguredException = exceptions.includes(methodName);
110
110
 
111
111
  if (hasReflectSubstitute && !isReflectCall && !userConfiguredException) {
@@ -34,7 +34,7 @@ function isStringLiteral(node) {
34
34
  * @returns {boolean} True if the node is a regex literal.
35
35
  */
36
36
  function isRegexLiteral(node) {
37
- return node.type === "Literal" && Object.prototype.hasOwnProperty.call(node, "regex");
37
+ return node.type === "Literal" && Object.hasOwn(node, "regex");
38
38
  }
39
39
 
40
40
  const validPrecedingTokens = new Set([
@@ -113,7 +113,7 @@ function endsWithTemplateCurly(node) {
113
113
  return startsWithTemplateCurly(node.right);
114
114
  }
115
115
  if (node.type === "TemplateLiteral") {
116
- return node.expressions.length && node.quasis.length && node.quasis[node.quasis.length - 1].range[0] === node.quasis[node.quasis.length - 1].range[1];
116
+ return node.expressions.length && node.quasis.length && node.quasis.at(-1).range[0] === node.quasis.at(-1).range[1];
117
117
  }
118
118
  return node.type !== "Literal" || typeof node.value !== "string";
119
119
  }
@@ -133,8 +133,8 @@ module.exports = {
133
133
  messageId: "addRadixParameter10",
134
134
  fix(fixer) {
135
135
  const tokens = sourceCode.getTokens(node);
136
- const lastToken = tokens[tokens.length - 1]; // Parenthesis.
137
- const secondToLastToken = tokens[tokens.length - 2]; // May or may not be a comma.
136
+ const lastToken = tokens.at(-1); // Parenthesis.
137
+ const secondToLastToken = tokens.at(-2); // May or may not be a comma.
138
138
  const hasTrailingComma = secondToLastToken.type === "Punctuator" && secondToLastToken.value === ",";
139
139
 
140
140
  return fixer.insertTextBefore(lastToken, hasTrailingComma ? " 10," : ", 10");
@@ -65,7 +65,7 @@ function isLastChild(node) {
65
65
  }
66
66
  const nodeList = getChildren(node.parent);
67
67
 
68
- return nodeList !== null && nodeList[nodeList.length - 1] === node; // before `}` or etc.
68
+ return nodeList !== null && nodeList.at(-1) === node; // before `}` or etc.
69
69
  }
70
70
 
71
71
  /** @type {import('../shared/types').Rule} */
@@ -208,7 +208,7 @@ module.exports = {
208
208
  }
209
209
 
210
210
  return fixer.replaceTextRange(
211
- [importSpecifiers[0].range[0], importSpecifiers[importSpecifiers.length - 1].range[1]],
211
+ [importSpecifiers[0].range[0], importSpecifiers.at(-1).range[1]],
212
212
  importSpecifiers
213
213
 
214
214
  // Clone the importSpecifiers array to avoid mutating it
@@ -185,7 +185,7 @@ module.exports = {
185
185
  });
186
186
 
187
187
  // check blank line between the current node and the last token
188
- if (!isBlankLineBetweenNodes && (node.loc.start.line - tokens[tokens.length - 1].loc.end.line > 1)) {
188
+ if (!isBlankLineBetweenNodes && (node.loc.start.line - tokens.at(-1).loc.end.line > 1)) {
189
189
  isBlankLineBetweenNodes = true;
190
190
  }
191
191
 
@@ -66,7 +66,7 @@ module.exports = {
66
66
  return null;
67
67
  }
68
68
  return fixer.replaceTextRange(
69
- [idDeclarations[0].range[0], idDeclarations[idDeclarations.length - 1].range[1]],
69
+ [idDeclarations[0].range[0], idDeclarations.at(-1).range[1]],
70
70
  idDeclarations
71
71
 
72
72
  // Clone the idDeclarations array to avoid mutating it
@@ -87,7 +87,7 @@ module.exports = {
87
87
  * @returns {boolean} Whether or not an override has been provided for the operator
88
88
  */
89
89
  function overrideExistsForOperator(operator) {
90
- return options.overrides && Object.prototype.hasOwnProperty.call(options.overrides, operator);
90
+ return options.overrides && Object.hasOwn(options.overrides, operator);
91
91
  }
92
92
 
93
93
  /**
@@ -173,7 +173,7 @@ module.exports = {
173
173
  function enterFunctionInFunctionMode(node, useStrictDirectives) {
174
174
  const isInClass = classScopes.length > 0,
175
175
  isParentGlobal = scopes.length === 0 && classScopes.length === 0,
176
- isParentStrict = scopes.length > 0 && scopes[scopes.length - 1],
176
+ isParentStrict = scopes.length > 0 && scopes.at(-1),
177
177
  isStrict = useStrictDirectives.length > 0;
178
178
 
179
179
  if (isStrict) {
@@ -969,7 +969,7 @@ function isConstant(scope, node, inBooleanPosition) {
969
969
  return false;
970
970
 
971
971
  case "SequenceExpression":
972
- return isConstant(scope, node.expressions[node.expressions.length - 1], inBooleanPosition);
972
+ return isConstant(scope, node.expressions.at(-1), inBooleanPosition);
973
973
  case "SpreadElement":
974
974
  return isConstant(scope, node.argument, inBooleanPosition);
975
975
  case "CallExpression":
@@ -1231,7 +1231,7 @@ module.exports = {
1231
1231
  * @private
1232
1232
  */
1233
1233
  isSurroundedBy(val, character) {
1234
- return val[0] === character && val[val.length - 1] === character;
1234
+ return val[0] === character && val.at(-1) === character;
1235
1235
  },
1236
1236
 
1237
1237
  /**
@@ -1909,8 +1909,8 @@ module.exports = {
1909
1909
  */
1910
1910
  getFunctionHeadLoc(node, sourceCode) {
1911
1911
  const parent = node.parent;
1912
- let start = null;
1913
- let end = null;
1912
+ let start;
1913
+ let end;
1914
1914
 
1915
1915
  if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") {
1916
1916
  start = parent.loc.start;
@@ -2055,7 +2055,7 @@ module.exports = {
2055
2055
  case "SequenceExpression": {
2056
2056
  const exprs = node.expressions;
2057
2057
 
2058
- return exprs.length !== 0 && module.exports.couldBeError(exprs[exprs.length - 1]);
2058
+ return exprs.length !== 0 && module.exports.couldBeError(exprs.at(-1));
2059
2059
  }
2060
2060
 
2061
2061
  case "LogicalExpression":
@@ -2119,9 +2119,9 @@ module.exports = {
2119
2119
 
2120
2120
  const comments = tokens.comments;
2121
2121
 
2122
- leftToken = tokens[tokens.length - 1];
2122
+ leftToken = tokens.at(-1);
2123
2123
  if (comments.length) {
2124
- const lastComment = comments[comments.length - 1];
2124
+ const lastComment = comments.at(-1);
2125
2125
 
2126
2126
  if (!leftToken || lastComment.range[0] > leftToken.range[0]) {
2127
2127
  leftToken = lastComment;
@@ -79,7 +79,7 @@ module.exports = {
79
79
  const after = leftToken.value === "*";
80
80
  const spaceRequired = mode[side];
81
81
  const node = after ? leftToken : rightToken;
82
- let messageId = "";
82
+ let messageId;
83
83
 
84
84
  if (spaceRequired) {
85
85
  messageId = side === "before" ? "missingBefore" : "missingAfter";
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @fileoverview Serialization utils.
3
+ * @author Bryan Mishkin
4
+ */
5
+
6
+ "use strict";
7
+
8
+ /**
9
+ * Check if a value is a primitive or plain object created by the Object constructor.
10
+ * @param {any} val the value to check
11
+ * @returns {boolean} true if so
12
+ * @private
13
+ */
14
+ function isSerializablePrimitiveOrPlainObject(val) {
15
+ return (
16
+ val === null ||
17
+ typeof val === "string" ||
18
+ typeof val === "boolean" ||
19
+ typeof val === "number" ||
20
+ (typeof val === "object" && val.constructor === Object) ||
21
+ Array.isArray(val)
22
+ );
23
+ }
24
+
25
+ /**
26
+ * Check if a value is serializable.
27
+ * Functions or objects like RegExp cannot be serialized by JSON.stringify().
28
+ * Inspired by: https://stackoverflow.com/questions/30579940/reliable-way-to-check-if-objects-is-serializable-in-javascript
29
+ * @param {any} val the value
30
+ * @returns {boolean} true if the value is serializable
31
+ */
32
+ function isSerializable(val) {
33
+ if (!isSerializablePrimitiveOrPlainObject(val)) {
34
+ return false;
35
+ }
36
+ if (typeof val === "object") {
37
+ for (const property in val) {
38
+ if (Object.hasOwn(val, property)) {
39
+ if (!isSerializablePrimitiveOrPlainObject(val[property])) {
40
+ return false;
41
+ }
42
+ if (typeof val[property] === "object") {
43
+ if (!isSerializable(val[property])) {
44
+ return false;
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ return true;
51
+ }
52
+
53
+ module.exports = {
54
+ isSerializable
55
+ };
@@ -415,10 +415,10 @@ class SourceCode extends TokenStore {
415
415
  * and uses match.index to get the correct line start indices.
416
416
  */
417
417
  while ((match = lineEndingPattern.exec(this.text))) {
418
- this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1], match.index));
418
+ this.lines.push(this.text.slice(this.lineStartIndices.at(-1), match.index));
419
419
  this.lineStartIndices.push(match.index + match[0].length);
420
420
  }
421
- this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1]));
421
+ this.lines.push(this.text.slice(this.lineStartIndices.at(-1)));
422
422
 
423
423
  // don't allow further modification of this object
424
424
  Object.freeze(this);
@@ -623,14 +623,14 @@ class SourceCode extends TokenStore {
623
623
  * See getIndexFromLoc for the motivation for this special case.
624
624
  */
625
625
  if (index === this.text.length) {
626
- return { line: this.lines.length, column: this.lines[this.lines.length - 1].length };
626
+ return { line: this.lines.length, column: this.lines.at(-1).length };
627
627
  }
628
628
 
629
629
  /*
630
630
  * To figure out which line index is on, determine the last place at which index could
631
631
  * be inserted into lineStartIndices to keep the list sorted.
632
632
  */
633
- const lineNumber = index >= this.lineStartIndices[this.lineStartIndices.length - 1]
633
+ const lineNumber = index >= this.lineStartIndices.at(-1)
634
634
  ? this.lineStartIndices.length
635
635
  : this.lineStartIndices.findIndex(el => index < el);
636
636
 
@@ -37,8 +37,8 @@ function createIndexMap(tokens, comments) {
37
37
  const map = Object.create(null);
38
38
  let tokenIndex = 0;
39
39
  let commentIndex = 0;
40
- let nextStart = 0;
41
- let range = null;
40
+ let nextStart;
41
+ let range;
42
42
 
43
43
  while (tokenIndex < tokens.length || commentIndex < comments.length) {
44
44
  nextStart = (commentIndex < comments.length) ? comments[commentIndex].range[0] : Number.MAX_SAFE_INTEGER;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "9.0.0-alpha.0",
3
+ "version": "9.0.0-alpha.2",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "bin": {
@@ -66,8 +66,8 @@
66
66
  "@eslint-community/eslint-utils": "^4.2.0",
67
67
  "@eslint-community/regexpp": "^4.6.1",
68
68
  "@eslint/eslintrc": "^3.0.0",
69
- "@eslint/js": "9.0.0-alpha.0",
70
- "@humanwhocodes/config-array": "^0.11.13",
69
+ "@eslint/js": "9.0.0-alpha.2",
70
+ "@humanwhocodes/config-array": "^0.11.14",
71
71
  "@humanwhocodes/module-importer": "^1.0.1",
72
72
  "@nodelib/fs.walk": "^1.2.8",
73
73
  "ajv": "^6.12.4",
@@ -75,9 +75,9 @@
75
75
  "cross-spawn": "^7.0.2",
76
76
  "debug": "^4.3.2",
77
77
  "escape-string-regexp": "^4.0.0",
78
- "eslint-scope": "^7.2.2",
78
+ "eslint-scope": "^8.0.0",
79
79
  "eslint-visitor-keys": "^3.4.3",
80
- "espree": "^9.6.1",
80
+ "espree": "^10.0.0",
81
81
  "esquery": "^1.4.2",
82
82
  "esutils": "^2.0.2",
83
83
  "fast-deep-equal": "^3.1.3",
@@ -127,7 +127,7 @@
127
127
  "esprima": "^4.0.1",
128
128
  "fast-glob": "^3.2.11",
129
129
  "fs-teardown": "^0.1.3",
130
- "glob": "^7.1.6",
130
+ "glob": "^10.0.0",
131
131
  "got": "^11.8.3",
132
132
  "gray-matter": "^4.0.3",
133
133
  "js-yaml": "^4.1.0",
@@ -135,7 +135,7 @@
135
135
  "load-perf": "^0.2.0",
136
136
  "markdown-it": "^12.2.0",
137
137
  "markdown-it-container": "^3.0.0",
138
- "markdownlint": "^0.32.0",
138
+ "markdownlint": "^0.33.0",
139
139
  "markdownlint-cli": "^0.38.0",
140
140
  "marked": "^4.0.8",
141
141
  "memfs": "^3.0.1",
@@ -1,93 +0,0 @@
1
- /*
2
- * STOP!!! DO NOT MODIFY.
3
- *
4
- * This file is part of the ongoing work to move the eslintrc-style config
5
- * system into the @eslint/eslintrc package. This file needs to remain
6
- * unchanged in order for this work to proceed.
7
- *
8
- * If you think you need to change this file, please contact @nzakas first.
9
- *
10
- * Thanks in advance for your cooperation.
11
- */
12
-
13
- /**
14
- * @fileoverview Defines a schema for configs.
15
- * @author Sylvan Mably
16
- */
17
-
18
- "use strict";
19
-
20
- const baseConfigProperties = {
21
- $schema: { type: "string" },
22
- env: { type: "object" },
23
- extends: { $ref: "#/definitions/stringOrStrings" },
24
- globals: { type: "object" },
25
- overrides: {
26
- type: "array",
27
- items: { $ref: "#/definitions/overrideConfig" },
28
- additionalItems: false
29
- },
30
- parser: { type: ["string", "null"] },
31
- parserOptions: { type: "object" },
32
- plugins: { type: "array" },
33
- processor: { type: "string" },
34
- rules: { type: "object" },
35
- settings: { type: "object" },
36
- noInlineConfig: { type: "boolean" },
37
- reportUnusedDisableDirectives: { type: "boolean" },
38
-
39
- ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
40
- };
41
-
42
- const configSchema = {
43
- definitions: {
44
- stringOrStrings: {
45
- oneOf: [
46
- { type: "string" },
47
- {
48
- type: "array",
49
- items: { type: "string" },
50
- additionalItems: false
51
- }
52
- ]
53
- },
54
- stringOrStringsRequired: {
55
- oneOf: [
56
- { type: "string" },
57
- {
58
- type: "array",
59
- items: { type: "string" },
60
- additionalItems: false,
61
- minItems: 1
62
- }
63
- ]
64
- },
65
-
66
- // Config at top-level.
67
- objectConfig: {
68
- type: "object",
69
- properties: {
70
- root: { type: "boolean" },
71
- ignorePatterns: { $ref: "#/definitions/stringOrStrings" },
72
- ...baseConfigProperties
73
- },
74
- additionalProperties: false
75
- },
76
-
77
- // Config in `overrides`.
78
- overrideConfig: {
79
- type: "object",
80
- properties: {
81
- excludedFiles: { $ref: "#/definitions/stringOrStrings" },
82
- files: { $ref: "#/definitions/stringOrStringsRequired" },
83
- ...baseConfigProperties
84
- },
85
- required: ["files"],
86
- additionalProperties: false
87
- }
88
- },
89
-
90
- $ref: "#/definitions/objectConfig"
91
- };
92
-
93
- module.exports = configSchema;