@typescript-eslint/rule-tester 8.0.0-alpha.6 → 8.0.0-alpha.61
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/dist/RuleTester.d.ts +4 -4
- package/dist/RuleTester.d.ts.map +1 -1
- package/dist/RuleTester.js +521 -360
- package/dist/RuleTester.js.map +1 -1
- package/dist/noFormat.js +1 -2
- package/dist/noFormat.js.map +1 -1
- package/dist/types/InvalidTestCase.d.ts +2 -2
- package/dist/types/InvalidTestCase.d.ts.map +1 -1
- package/dist/types/RuleTesterConfig.d.ts +9 -15
- package/dist/types/RuleTesterConfig.d.ts.map +1 -1
- package/dist/types/ValidTestCase.d.ts +22 -16
- package/dist/types/ValidTestCase.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/SourceCodeFixer.d.ts +6 -5
- package/dist/utils/SourceCodeFixer.d.ts.map +1 -1
- package/dist/utils/SourceCodeFixer.js +1 -2
- package/dist/utils/SourceCodeFixer.js.map +1 -1
- package/dist/utils/ajv.js +1 -2
- package/dist/utils/ajv.js.map +1 -1
- package/dist/utils/cloneDeeplyExcludesParent.js +2 -3
- package/dist/utils/cloneDeeplyExcludesParent.js.map +1 -1
- package/dist/utils/config-validator.d.ts.map +1 -1
- package/dist/utils/config-validator.js +3 -49
- package/dist/utils/config-validator.js.map +1 -1
- package/dist/utils/dependencyConstraints.d.ts.map +1 -1
- package/dist/utils/dependencyConstraints.js +4 -3
- package/dist/utils/dependencyConstraints.js.map +1 -1
- package/dist/utils/deprecation-warnings.js +1 -2
- package/dist/utils/deprecation-warnings.js.map +1 -1
- package/dist/utils/flat-config-schema.d.ts +66 -0
- package/dist/utils/flat-config-schema.d.ts.map +1 -0
- package/dist/utils/flat-config-schema.js +455 -0
- package/dist/utils/flat-config-schema.js.map +1 -0
- package/dist/utils/freezeDeeply.js +2 -3
- package/dist/utils/freezeDeeply.js.map +1 -1
- package/dist/utils/getRuleOptionsSchema.js +1 -2
- package/dist/utils/getRuleOptionsSchema.js.map +1 -1
- package/dist/utils/hasOwnProperty.d.ts.map +1 -1
- package/dist/utils/hasOwnProperty.js +1 -1
- package/dist/utils/hasOwnProperty.js.map +1 -1
- package/dist/utils/interpolate.d.ts +4 -0
- package/dist/utils/interpolate.d.ts.map +1 -1
- package/dist/utils/interpolate.js +10 -3
- package/dist/utils/interpolate.js.map +1 -1
- package/dist/utils/isReadonlyArray.js +1 -2
- package/dist/utils/isReadonlyArray.js.map +1 -1
- package/dist/utils/omitCustomConfigProperties.d.ts +3 -0
- package/dist/utils/omitCustomConfigProperties.d.ts.map +1 -0
- package/dist/utils/omitCustomConfigProperties.js +10 -0
- package/dist/utils/omitCustomConfigProperties.js.map +1 -0
- package/dist/utils/serialization.d.ts +7 -0
- package/dist/utils/serialization.d.ts.map +1 -0
- package/dist/utils/serialization.js +43 -0
- package/dist/utils/serialization.js.map +1 -0
- package/dist/utils/severity.d.ts +14 -0
- package/dist/utils/severity.d.ts.map +1 -0
- package/dist/utils/severity.js +40 -0
- package/dist/utils/severity.js.map +1 -0
- package/dist/utils/validationHelpers.d.ts +1 -13
- package/dist/utils/validationHelpers.d.ts.map +1 -1
- package/dist/utils/validationHelpers.js +6 -35
- package/dist/utils/validationHelpers.js.map +1 -1
- package/package.json +12 -6
- package/dist/utils/config-schema.d.ts +0 -3
- package/dist/utils/config-schema.d.ts.map +0 -1
- package/dist/utils/config-schema.js +0 -87
- package/dist/utils/config-schema.js.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Processor, SharedConfig } from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
interface ObjectPropertySchema<T = unknown> {
|
|
3
|
+
merge: string | ((a: T, b: T) => T);
|
|
4
|
+
validate: string | ((value: unknown) => asserts value is T);
|
|
5
|
+
}
|
|
6
|
+
export type ObjectLike = Record<string, unknown>;
|
|
7
|
+
type ConfigRules = Record<string, SharedConfig.RuleLevelAndOptions>;
|
|
8
|
+
export declare const flatConfigSchema: {
|
|
9
|
+
settings: {
|
|
10
|
+
merge<First extends ObjectLike, Second extends ObjectLike>(first?: First, second?: Second): First & Second;
|
|
11
|
+
validate: string;
|
|
12
|
+
};
|
|
13
|
+
linterOptions: {
|
|
14
|
+
schema: {
|
|
15
|
+
noInlineConfig: {
|
|
16
|
+
merge: string;
|
|
17
|
+
validate: string;
|
|
18
|
+
};
|
|
19
|
+
reportUnusedDisableDirectives: ObjectPropertySchema<SharedConfig.RuleLevel>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
language: ObjectPropertySchema<`${string}/${string}`>;
|
|
23
|
+
languageOptions: {
|
|
24
|
+
merge(first?: ObjectLike, second?: ObjectLike): object;
|
|
25
|
+
validate: string;
|
|
26
|
+
};
|
|
27
|
+
processor: ObjectPropertySchema<Processor.LooseProcessorModule>;
|
|
28
|
+
plugins: {
|
|
29
|
+
merge(first?: ObjectLike, second?: ObjectLike): object;
|
|
30
|
+
validate(value: unknown): void;
|
|
31
|
+
};
|
|
32
|
+
rules: {
|
|
33
|
+
merge(first?: ConfigRules, second?: ConfigRules): ConfigRules;
|
|
34
|
+
validate(value: ConfigRules): void;
|
|
35
|
+
};
|
|
36
|
+
files: {
|
|
37
|
+
type: string;
|
|
38
|
+
items: {
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
defaultFilenames: {
|
|
43
|
+
type: string;
|
|
44
|
+
properties: {
|
|
45
|
+
ts: {
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
tsx: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
required: string[];
|
|
53
|
+
additionalProperties: boolean;
|
|
54
|
+
};
|
|
55
|
+
dependencyConstraints: {
|
|
56
|
+
type: string;
|
|
57
|
+
additionalProperties: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
$schema: {
|
|
62
|
+
type: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=flat-config-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flat-config-schema.d.ts","sourceRoot":"","sources":["../../src/utils/flat-config-schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACb,MAAM,oCAAoC,CAAC;AAM5C,UAAU,oBAAoB,CAAC,CAAC,GAAG,OAAO;IACxC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;CAC7D;AAkTD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA2GjD,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAC;AA+GpE,eAAO,MAAM,gBAAgB;;cAnOrB,KAAK,SAAS,UAAU,EAAE,MAAM,SAAS,UAAU,UACzC,KAAK,WACJ,MAAM,GACpB,KAAK,GAAG,MAAM;;;;;;;;;;;;;;sBASJ,UAAU,WAAe,UAAU,GAAQ,MAAM;;;;;sBAkCjD,UAAU,WAAe,UAAU,GAAQ,MAAM;wBAoB9C,OAAO,GAAG,IAAI;;;sBAqDjB,WAAW,WAAe,WAAW,GAAQ,WAAW;wBAqDrD,WAAW,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGnC,CAAC"}
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Forked from https://github.com/eslint/eslint/blob/4b23ffd6454cfb1a269430f5fe28e7d1c37b9d3e/lib/config/flat-config-schema.js
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.flatConfigSchema = void 0;
|
|
5
|
+
const severity_1 = require("./severity");
|
|
6
|
+
const ruleSeverities = new Map([
|
|
7
|
+
[0, 0],
|
|
8
|
+
['off', 0],
|
|
9
|
+
[1, 1],
|
|
10
|
+
['warn', 1],
|
|
11
|
+
[2, 2],
|
|
12
|
+
['error', 2],
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* Check if a value is a non-null object.
|
|
16
|
+
* @param value The value to check.
|
|
17
|
+
* @returns `true` if the value is a non-null object.
|
|
18
|
+
*/
|
|
19
|
+
function isNonNullObject(value) {
|
|
20
|
+
// eslint-disable-next-line eqeqeq
|
|
21
|
+
return typeof value === 'object' && value !== null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if a value is a non-null non-array object.
|
|
25
|
+
* @param value The value to check.
|
|
26
|
+
* @returns `true` if the value is a non-null non-array object.
|
|
27
|
+
*/
|
|
28
|
+
function isNonArrayObject(value) {
|
|
29
|
+
return isNonNullObject(value) && !Array.isArray(value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Deeply merges two non-array objects.
|
|
33
|
+
* @param first The base object.
|
|
34
|
+
* @param second The overrides object.
|
|
35
|
+
* @param mergeMap Maps the combination of first and second arguments to a merged result.
|
|
36
|
+
* @returns An object with properties from both first and second.
|
|
37
|
+
*/
|
|
38
|
+
function deepMerge(first, second, mergeMap = new Map()) {
|
|
39
|
+
let secondMergeMap = mergeMap.get(first);
|
|
40
|
+
if (secondMergeMap) {
|
|
41
|
+
const result = secondMergeMap.get(second);
|
|
42
|
+
if (result) {
|
|
43
|
+
// If this combination of first and second arguments has been already visited, return the previously created result.
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
secondMergeMap = new Map();
|
|
49
|
+
mergeMap.set(first, secondMergeMap);
|
|
50
|
+
}
|
|
51
|
+
/*
|
|
52
|
+
* First create a result object where properties from the second object
|
|
53
|
+
* overwrite properties from the first. This sets up a baseline to use
|
|
54
|
+
* later rather than needing to inspect and change every property
|
|
55
|
+
* individually.
|
|
56
|
+
*/
|
|
57
|
+
const result = {
|
|
58
|
+
...first,
|
|
59
|
+
...second,
|
|
60
|
+
};
|
|
61
|
+
delete result.__proto__; // don't merge own property "__proto__"
|
|
62
|
+
// Store the pending result for this combination of first and second arguments.
|
|
63
|
+
secondMergeMap.set(second, result);
|
|
64
|
+
for (const key of Object.keys(second)) {
|
|
65
|
+
// avoid hairy edge case
|
|
66
|
+
if (key === '__proto__' ||
|
|
67
|
+
!Object.prototype.propertyIsEnumerable.call(first, key)) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const firstValue = first[key];
|
|
71
|
+
const secondValue = second[key];
|
|
72
|
+
if (isNonArrayObject(firstValue) && isNonArrayObject(secondValue)) {
|
|
73
|
+
result[key] = deepMerge(
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
75
|
+
firstValue,
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
77
|
+
secondValue, mergeMap);
|
|
78
|
+
}
|
|
79
|
+
else if (secondValue === undefined) {
|
|
80
|
+
result[key] = firstValue;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Normalizes the rule options config for a given rule by ensuring that
|
|
87
|
+
* it is an array and that the first item is 0, 1, or 2.
|
|
88
|
+
* @param ruleOptions The rule options config.
|
|
89
|
+
* @returns An array of rule options.
|
|
90
|
+
*/
|
|
91
|
+
function normalizeRuleOptions(ruleOptions) {
|
|
92
|
+
const finalOptions = Array.isArray(ruleOptions)
|
|
93
|
+
? ruleOptions.slice(0)
|
|
94
|
+
: [ruleOptions];
|
|
95
|
+
finalOptions[0] = ruleSeverities.get(finalOptions[0]);
|
|
96
|
+
return structuredClone(finalOptions);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Determines if an object has any methods.
|
|
100
|
+
* @param object The object to check.
|
|
101
|
+
* @returns `true` if the object has any methods.
|
|
102
|
+
*/
|
|
103
|
+
function hasMethod(object) {
|
|
104
|
+
for (const key of Object.keys(object)) {
|
|
105
|
+
if (typeof object[key] === 'function') {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The error type when a rule's options are configured with an invalid type.
|
|
113
|
+
*/
|
|
114
|
+
class InvalidRuleOptionsError extends Error {
|
|
115
|
+
messageTemplate;
|
|
116
|
+
messageData;
|
|
117
|
+
constructor(ruleId, value) {
|
|
118
|
+
super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`);
|
|
119
|
+
this.messageTemplate = 'invalid-rule-options';
|
|
120
|
+
this.messageData = { ruleId, value };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Validates that a value is a valid rule options entry.
|
|
125
|
+
* @param ruleId Rule name being configured.
|
|
126
|
+
* @param value The value to check.
|
|
127
|
+
* @throws {InvalidRuleOptionsError} If the value isn't a valid rule options.
|
|
128
|
+
*/
|
|
129
|
+
function assertIsRuleOptions(ruleId, value) {
|
|
130
|
+
if (typeof value !== 'string' &&
|
|
131
|
+
typeof value !== 'number' &&
|
|
132
|
+
!Array.isArray(value)) {
|
|
133
|
+
throw new InvalidRuleOptionsError(ruleId, value);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The error type when a rule's severity is invalid.
|
|
138
|
+
*/
|
|
139
|
+
class InvalidRuleSeverityError extends Error {
|
|
140
|
+
messageTemplate;
|
|
141
|
+
messageData;
|
|
142
|
+
constructor(ruleId, value) {
|
|
143
|
+
super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`);
|
|
144
|
+
this.messageTemplate = 'invalid-rule-severity';
|
|
145
|
+
this.messageData = { ruleId, value };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Validates that a value is valid rule severity.
|
|
150
|
+
* @param ruleId Rule name being configured.
|
|
151
|
+
* @param value The value to check.
|
|
152
|
+
* @throws {InvalidRuleSeverityError} If the value isn't a valid rule severity.
|
|
153
|
+
*/
|
|
154
|
+
function assertIsRuleSeverity(ruleId, value) {
|
|
155
|
+
const severity = ruleSeverities.get(value);
|
|
156
|
+
if (severity === undefined) {
|
|
157
|
+
throw new InvalidRuleSeverityError(ruleId, value);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Validates that a given string is the form pluginName/objectName.
|
|
162
|
+
* @param value The string to check.
|
|
163
|
+
*/
|
|
164
|
+
function assertIsPluginMemberName(value) {
|
|
165
|
+
if (typeof value !== 'string' ||
|
|
166
|
+
!/[@a-z0-9-_$]+(?:\/(?:[a-z0-9-_$]+))+$/iu.test(value)) {
|
|
167
|
+
throw new TypeError(
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
169
|
+
`Expected string in the form "pluginName/objectName" but found "${value}".`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Validates that a value is an object.
|
|
174
|
+
* @param value The value to check.
|
|
175
|
+
*/
|
|
176
|
+
function assertIsObject(value) {
|
|
177
|
+
if (!isNonNullObject(value)) {
|
|
178
|
+
throw new TypeError('Expected an object.');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The error type when there's an eslintrc-style options in a flat config.
|
|
183
|
+
*/
|
|
184
|
+
class IncompatibleKeyError extends Error {
|
|
185
|
+
messageTemplate;
|
|
186
|
+
messageData;
|
|
187
|
+
/**
|
|
188
|
+
* @param key The invalid key.
|
|
189
|
+
*/
|
|
190
|
+
constructor(key) {
|
|
191
|
+
super('This appears to be in eslintrc format rather than flat config format.');
|
|
192
|
+
this.messageTemplate = 'eslintrc-incompat';
|
|
193
|
+
this.messageData = { key };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The error type when there's an eslintrc-style plugins array found.
|
|
198
|
+
*/
|
|
199
|
+
class IncompatiblePluginsError extends Error {
|
|
200
|
+
messageTemplate;
|
|
201
|
+
messageData;
|
|
202
|
+
constructor(plugins) {
|
|
203
|
+
super('This appears to be in eslintrc format (array of strings) rather than flat config format (object).');
|
|
204
|
+
this.messageTemplate = 'eslintrc-plugins';
|
|
205
|
+
this.messageData = { plugins };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const booleanSchema = {
|
|
209
|
+
merge: 'replace',
|
|
210
|
+
validate: 'boolean',
|
|
211
|
+
};
|
|
212
|
+
const ALLOWED_SEVERITIES = new Set(['error', 'warn', 'off', 2, 1, 0]);
|
|
213
|
+
const disableDirectiveSeveritySchema = {
|
|
214
|
+
merge(first, second) {
|
|
215
|
+
const value = second ?? first;
|
|
216
|
+
if (typeof value === 'boolean') {
|
|
217
|
+
return value ? 'warn' : 'off';
|
|
218
|
+
}
|
|
219
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
220
|
+
return (0, severity_1.normalizeSeverityToNumber)(value);
|
|
221
|
+
},
|
|
222
|
+
validate(value) {
|
|
223
|
+
if (!(ALLOWED_SEVERITIES.has(value) ||
|
|
224
|
+
typeof value === 'boolean')) {
|
|
225
|
+
throw new TypeError('Expected one of: "error", "warn", "off", 0, 1, 2, or a boolean.');
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
const deepObjectAssignSchema = {
|
|
230
|
+
merge(first = {}, second = {}) {
|
|
231
|
+
return deepMerge(first, second);
|
|
232
|
+
},
|
|
233
|
+
validate: 'object',
|
|
234
|
+
};
|
|
235
|
+
const languageOptionsSchema = {
|
|
236
|
+
merge(first = {}, second = {}) {
|
|
237
|
+
const result = deepMerge(first, second);
|
|
238
|
+
for (const [key, value] of Object.entries(result)) {
|
|
239
|
+
/*
|
|
240
|
+
* Special case: Because the `parser` property is an object, it should
|
|
241
|
+
* not be deep merged. Instead, it should be replaced if it exists in
|
|
242
|
+
* the second object. To make this more generic, we just check for
|
|
243
|
+
* objects with methods and replace them if they exist in the second
|
|
244
|
+
* object.
|
|
245
|
+
*/
|
|
246
|
+
if (isNonArrayObject(value)) {
|
|
247
|
+
if (hasMethod(value)) {
|
|
248
|
+
result[key] = second[key] ?? first[key];
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
// for other objects, make sure we aren't reusing the same object
|
|
252
|
+
result[key] = { ...result[key] };
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return result;
|
|
257
|
+
},
|
|
258
|
+
validate: 'object',
|
|
259
|
+
};
|
|
260
|
+
const languageSchema = {
|
|
261
|
+
merge: 'replace',
|
|
262
|
+
validate: assertIsPluginMemberName,
|
|
263
|
+
};
|
|
264
|
+
const pluginsSchema = {
|
|
265
|
+
merge(first = {}, second = {}) {
|
|
266
|
+
const keys = new Set([...Object.keys(first), ...Object.keys(second)]);
|
|
267
|
+
const result = {};
|
|
268
|
+
// manually validate that plugins are not redefined
|
|
269
|
+
for (const key of keys) {
|
|
270
|
+
// avoid hairy edge case
|
|
271
|
+
if (key === '__proto__') {
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (key in first && key in second && first[key] !== second[key]) {
|
|
275
|
+
throw new TypeError(`Cannot redefine plugin "${key}".`);
|
|
276
|
+
}
|
|
277
|
+
result[key] = second[key] || first[key];
|
|
278
|
+
}
|
|
279
|
+
return result;
|
|
280
|
+
},
|
|
281
|
+
validate(value) {
|
|
282
|
+
// first check the value to be sure it's an object
|
|
283
|
+
if (value == null || typeof value !== 'object') {
|
|
284
|
+
throw new TypeError('Expected an object.');
|
|
285
|
+
}
|
|
286
|
+
// make sure it's not an array, which would mean eslintrc-style is used
|
|
287
|
+
if (Array.isArray(value)) {
|
|
288
|
+
throw new IncompatiblePluginsError(value);
|
|
289
|
+
}
|
|
290
|
+
// second check the keys to make sure they are objects
|
|
291
|
+
for (const key of Object.keys(value)) {
|
|
292
|
+
// avoid hairy edge case
|
|
293
|
+
if (key === '__proto__') {
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (value[key] == null ||
|
|
297
|
+
typeof value[key] !== 'object') {
|
|
298
|
+
throw new TypeError(`Key "${key}": Expected an object.`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
const processorSchema = {
|
|
304
|
+
merge: 'replace',
|
|
305
|
+
validate(value) {
|
|
306
|
+
if (typeof value === 'string') {
|
|
307
|
+
assertIsPluginMemberName(value);
|
|
308
|
+
}
|
|
309
|
+
else if (value && typeof value === 'object') {
|
|
310
|
+
if (typeof value.preprocess !==
|
|
311
|
+
'function' ||
|
|
312
|
+
typeof value.postprocess !==
|
|
313
|
+
'function') {
|
|
314
|
+
throw new TypeError('Object must have a preprocess() and a postprocess() method.');
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
throw new TypeError('Expected an object or a string.');
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
const rulesSchema = {
|
|
323
|
+
merge(first = {}, second = {}) {
|
|
324
|
+
const result = {
|
|
325
|
+
...first,
|
|
326
|
+
...second,
|
|
327
|
+
};
|
|
328
|
+
for (const ruleId of Object.keys(result)) {
|
|
329
|
+
try {
|
|
330
|
+
// avoid hairy edge case
|
|
331
|
+
if (ruleId === '__proto__') {
|
|
332
|
+
delete result.__proto__;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
result[ruleId] = normalizeRuleOptions(result[ruleId]);
|
|
336
|
+
/*
|
|
337
|
+
* If either rule config is missing, then the correct
|
|
338
|
+
* config is already present and we just need to normalize
|
|
339
|
+
* the severity.
|
|
340
|
+
*/
|
|
341
|
+
if (!(ruleId in first) || !(ruleId in second)) {
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
const firstRuleOptions = normalizeRuleOptions(first[ruleId]);
|
|
345
|
+
const secondRuleOptions = normalizeRuleOptions(second[ruleId]);
|
|
346
|
+
/*
|
|
347
|
+
* If the second rule config only has a severity (length of 1),
|
|
348
|
+
* then use that severity and keep the rest of the options from
|
|
349
|
+
* the first rule config.
|
|
350
|
+
*/
|
|
351
|
+
if (secondRuleOptions.length === 1) {
|
|
352
|
+
result[ruleId] = [secondRuleOptions[0], ...firstRuleOptions.slice(1)];
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
/*
|
|
356
|
+
* In any other situation, then the second rule config takes
|
|
357
|
+
* precedence. That means the value at `result[ruleId]` is
|
|
358
|
+
* already correct and no further work is necessary.
|
|
359
|
+
*/
|
|
360
|
+
}
|
|
361
|
+
catch (ex) {
|
|
362
|
+
throw new Error(`Key "${ruleId}": ${ex.message}`, {
|
|
363
|
+
cause: ex,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return result;
|
|
368
|
+
},
|
|
369
|
+
validate(value) {
|
|
370
|
+
assertIsObject(value);
|
|
371
|
+
/*
|
|
372
|
+
* We are not checking the rule schema here because there is no
|
|
373
|
+
* guarantee that the rule definition is present at this point. Instead
|
|
374
|
+
* we wait and check the rule schema during the finalization step
|
|
375
|
+
* of calculating a config.
|
|
376
|
+
*/
|
|
377
|
+
for (const ruleId of Object.keys(value)) {
|
|
378
|
+
// avoid hairy edge case
|
|
379
|
+
if (ruleId === '__proto__') {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const ruleOptions = value[ruleId];
|
|
383
|
+
assertIsRuleOptions(ruleId, ruleOptions);
|
|
384
|
+
if (Array.isArray(ruleOptions)) {
|
|
385
|
+
assertIsRuleSeverity(ruleId, ruleOptions[0]);
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
assertIsRuleSeverity(ruleId, ruleOptions);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* Creates a schema that always throws an error. Useful for warning
|
|
395
|
+
* about eslintrc-style keys.
|
|
396
|
+
* @param key The eslintrc key to create a schema for.
|
|
397
|
+
*/
|
|
398
|
+
function createEslintrcErrorSchema(key) {
|
|
399
|
+
return {
|
|
400
|
+
merge: 'replace',
|
|
401
|
+
validate() {
|
|
402
|
+
throw new IncompatibleKeyError(key);
|
|
403
|
+
},
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
const eslintrcKeys = [
|
|
407
|
+
'env',
|
|
408
|
+
'extends',
|
|
409
|
+
'globals',
|
|
410
|
+
'ignorePatterns',
|
|
411
|
+
'noInlineConfig',
|
|
412
|
+
'overrides',
|
|
413
|
+
'parser',
|
|
414
|
+
'parserOptions',
|
|
415
|
+
'reportUnusedDisableDirectives',
|
|
416
|
+
'root',
|
|
417
|
+
];
|
|
418
|
+
exports.flatConfigSchema = {
|
|
419
|
+
$schema: { type: 'string' },
|
|
420
|
+
// Original ESLint schemas from flat-config-schema.js
|
|
421
|
+
// eslintrc-style keys that should always error
|
|
422
|
+
...Object.fromEntries(eslintrcKeys.map(key => [key, createEslintrcErrorSchema(key)])),
|
|
423
|
+
// flat config keys
|
|
424
|
+
settings: deepObjectAssignSchema,
|
|
425
|
+
linterOptions: {
|
|
426
|
+
schema: {
|
|
427
|
+
noInlineConfig: booleanSchema,
|
|
428
|
+
reportUnusedDisableDirectives: disableDirectiveSeveritySchema,
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
language: languageSchema,
|
|
432
|
+
languageOptions: languageOptionsSchema,
|
|
433
|
+
processor: processorSchema,
|
|
434
|
+
plugins: pluginsSchema,
|
|
435
|
+
rules: rulesSchema,
|
|
436
|
+
// not in ESLint source, but seemingly relevant?
|
|
437
|
+
files: { type: 'array', items: { type: 'string' } },
|
|
438
|
+
// @typescript-eslint/rule-tester extensions
|
|
439
|
+
defaultFilenames: {
|
|
440
|
+
type: 'object',
|
|
441
|
+
properties: {
|
|
442
|
+
ts: { type: 'string' },
|
|
443
|
+
tsx: { type: 'string' },
|
|
444
|
+
},
|
|
445
|
+
required: ['ts', 'tsx'],
|
|
446
|
+
additionalProperties: false,
|
|
447
|
+
},
|
|
448
|
+
dependencyConstraints: {
|
|
449
|
+
type: 'object',
|
|
450
|
+
additionalProperties: {
|
|
451
|
+
type: 'string',
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
};
|
|
455
|
+
//# sourceMappingURL=flat-config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flat-config-schema.js","sourceRoot":"","sources":["../../src/utils/flat-config-schema.ts"],"names":[],"mappings":";AAAA,8HAA8H;;;AAO9H,yCAAuD;AASvD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAgD;IAC5E,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,KAAK,EAAE,CAAC,CAAC;IACV,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,MAAM,EAAE,CAAC,CAAC;IACX,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,OAAO,EAAE,CAAC,CAAC;CACb,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,kCAAkC;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;GAMG;AACH,SAAS,SAAS,CAChB,KAAY,EACZ,MAAc,EACd,WAAW,IAAI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ezes a given value deeply.
|
|
6
6
|
*/
|
|
@@ -11,7 +11,7 @@ function freezeDeeply(x) {
|
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
13
|
for (const key in x) {
|
|
14
|
-
if (key !== 'parent' && Object.
|
|
14
|
+
if (key !== 'parent' && Object.hasOwn(x, key)) {
|
|
15
15
|
freezeDeeply(x[key]);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -19,5 +19,4 @@ function freezeDeeply(x) {
|
|
|
19
19
|
Object.freeze(x);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.freezeDeeply = freezeDeeply;
|
|
23
22
|
//# sourceMappingURL=freezeDeeply.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freezeDeeply.js","sourceRoot":"","sources":["../../src/utils/freezeDeeply.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"freezeDeeply.js","sourceRoot":"","sources":["../../src/utils/freezeDeeply.ts"],"names":[],"mappings":";;AAGA,oCAaC;AAhBD;;GAEG;AACH,SAAgB,YAAY,CAAC,CAAU;IACrC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QACvC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACrB,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;gBACpB,IAAI,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;oBAC9C,YAAY,CAAE,CAA6B,CAAC,GAAG,CAAC,CAAC,CAAC;gBACpD,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/shared/config-validator.js#LL50-L82C2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getRuleOptionsSchema =
|
|
4
|
+
exports.getRuleOptionsSchema = getRuleOptionsSchema;
|
|
5
5
|
const isReadonlyArray_1 = require("./isReadonlyArray");
|
|
6
6
|
/**
|
|
7
7
|
* Gets a complete options schema for a rule.
|
|
@@ -29,5 +29,4 @@ function getRuleOptionsSchema(rule) {
|
|
|
29
29
|
// Given a full schema, leave it alone
|
|
30
30
|
return schema ?? null;
|
|
31
31
|
}
|
|
32
|
-
exports.getRuleOptionsSchema = getRuleOptionsSchema;
|
|
33
32
|
//# sourceMappingURL=getRuleOptionsSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRuleOptionsSchema.js","sourceRoot":"","sources":["../../src/utils/getRuleOptionsSchema.ts"],"names":[],"mappings":";AAAA,uIAAuI
|
|
1
|
+
{"version":3,"file":"getRuleOptionsSchema.js","sourceRoot":"","sources":["../../src/utils/getRuleOptionsSchema.ts"],"names":[],"mappings":";AAAA,uIAAuI;;AAYvI,oDAwBC;AA/BD,uDAAoD;AAEpD;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,IAA4B;IAE5B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;IAEjC,kEAAkE;IAClE,IAAI,IAAA,iCAAe,EAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,MAAuB;gBAC9B,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,MAAM,CAAC,MAAM;aACxB,CAAC;QACJ,CAAC;QACD,OAAO;YACL,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;SACZ,CAAC;IACJ,CAAC;IAED,sCAAsC;IACtC,OAAO,MAAM,IAAI,IAAI,CAAC;AACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasOwnProperty.d.ts","sourceRoot":"","sources":["../../src/utils/hasOwnProperty.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"hasOwnProperty.d.ts","sourceRoot":"","sources":["../../src/utils/hasOwnProperty.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,EAAoB,CAC7C,GAAkB,SAAN,MAAM,EAClB,CAAmB,SAAT,MAAM,GAAG,EAEnB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,CAAC,KACH,GAAG,IAAI,GAAG,GAAG,GAAG,GAAQ,IAAD,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAE,CAAC"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hasOwnProperty = void 0;
|
|
4
4
|
// typed so that TS can remove optionality
|
|
5
|
-
exports.hasOwnProperty =
|
|
5
|
+
exports.hasOwnProperty = Object.hasOwn;
|
|
6
6
|
//# sourceMappingURL=hasOwnProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasOwnProperty.js","sourceRoot":"","sources":["../../src/utils/hasOwnProperty.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC7B,QAAA,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"hasOwnProperty.js","sourceRoot":"","sources":["../../src/utils/hasOwnProperty.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC7B,QAAA,cAAc,GAAG,MAAM,CAAC,MAMO,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { ReportDescriptorMessageData } from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a global expression matching placeholders in messages.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getPlaceholderMatcher(): RegExp;
|
|
2
6
|
export declare function interpolate(text: string, data: ReportDescriptorMessageData | undefined): string;
|
|
3
7
|
//# sourceMappingURL=interpolate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../../src/utils/interpolate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEtF,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,2BAA2B,GAAG,SAAS,GAC5C,MAAM,
|
|
1
|
+
{"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../../src/utils/interpolate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEtF;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,2BAA2B,GAAG,SAAS,GAC5C,MAAM,CAkBR"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/linter/interpolate.js
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.getPlaceholderMatcher = getPlaceholderMatcher;
|
|
5
|
+
exports.interpolate = interpolate;
|
|
6
|
+
/**
|
|
7
|
+
* Returns a global expression matching placeholders in messages.
|
|
8
|
+
*/
|
|
9
|
+
function getPlaceholderMatcher() {
|
|
10
|
+
return /\{\{([^{}]+?)\}\}/gu;
|
|
11
|
+
}
|
|
5
12
|
function interpolate(text, data) {
|
|
6
13
|
if (!data) {
|
|
7
14
|
return text;
|
|
8
15
|
}
|
|
16
|
+
const matcher = getPlaceholderMatcher();
|
|
9
17
|
// Substitution content for any {{ }} markers.
|
|
10
|
-
return text.replace(
|
|
18
|
+
return text.replace(matcher, (fullMatch, termWithWhitespace) => {
|
|
11
19
|
const term = termWithWhitespace.trim();
|
|
12
20
|
if (term in data) {
|
|
13
21
|
return String(data[term]);
|
|
@@ -16,5 +24,4 @@ function interpolate(text, data) {
|
|
|
16
24
|
return fullMatch;
|
|
17
25
|
});
|
|
18
26
|
}
|
|
19
|
-
exports.interpolate = interpolate;
|
|
20
27
|
//# sourceMappingURL=interpolate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolate.js","sourceRoot":"","sources":["../../src/utils/interpolate.ts"],"names":[],"mappings":";AAAA,uHAAuH
|
|
1
|
+
{"version":3,"file":"interpolate.js","sourceRoot":"","sources":["../../src/utils/interpolate.ts"],"names":[],"mappings":";AAAA,uHAAuH;;AAOvH,sDAEC;AAED,kCAqBC;AA5BD;;GAEG;AACH,SAAgB,qBAAqB;IACnC,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,SAAgB,WAAW,CACzB,IAAY,EACZ,IAA6C;IAE7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;IAExC,8CAA8C;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,kBAA0B,EAAE,EAAE;QACrE,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAEvC,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5B,CAAC;QAED,2EAA2E;QAC3E,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}
|