@typescript-eslint/rule-tester 6.0.0-alpha.158

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 (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/_ts4.2/dist/RuleTester.d.ts +46 -0
  4. package/_ts4.2/dist/TestFramework.d.ts +66 -0
  5. package/_ts4.2/dist/index.d.ts +5 -0
  6. package/_ts4.2/dist/noFormat.d.ts +6 -0
  7. package/_ts4.2/dist/types/DependencyConstraint.d.ts +14 -0
  8. package/_ts4.2/dist/types/InvalidTestCase.d.ts +68 -0
  9. package/_ts4.2/dist/types/RuleTesterConfig.d.ts +26 -0
  10. package/_ts4.2/dist/types/ValidTestCase.d.ts +53 -0
  11. package/_ts4.2/dist/types/index.d.ts +19 -0
  12. package/_ts4.2/dist/utils/SourceCodeFixer.d.ts +16 -0
  13. package/_ts4.2/dist/utils/ajv.d.ts +3 -0
  14. package/_ts4.2/dist/utils/cloneDeeplyExcludesParent.d.ts +6 -0
  15. package/_ts4.2/dist/utils/config-schema.d.ts +3 -0
  16. package/_ts4.2/dist/utils/config-validator.d.ts +12 -0
  17. package/_ts4.2/dist/utils/dependencyConstraints.d.ts +3 -0
  18. package/_ts4.2/dist/utils/deprecation-warnings.d.ts +13 -0
  19. package/_ts4.2/dist/utils/freezeDeeply.d.ts +5 -0
  20. package/_ts4.2/dist/utils/getRuleOptionsSchema.d.ts +9 -0
  21. package/_ts4.2/dist/utils/hasOwnProperty.d.ts +4 -0
  22. package/_ts4.2/dist/utils/interpolate.d.ts +3 -0
  23. package/_ts4.2/dist/utils/isReadonlyArray.d.ts +2 -0
  24. package/_ts4.2/dist/utils/validationHelpers.d.ts +43 -0
  25. package/dist/RuleTester.d.ts +46 -0
  26. package/dist/RuleTester.d.ts.map +1 -0
  27. package/dist/RuleTester.js +658 -0
  28. package/dist/RuleTester.js.map +1 -0
  29. package/dist/TestFramework.d.ts +66 -0
  30. package/dist/TestFramework.d.ts.map +1 -0
  31. package/dist/TestFramework.js +148 -0
  32. package/dist/TestFramework.js.map +1 -0
  33. package/dist/index.d.ts +5 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +8 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/noFormat.d.ts +6 -0
  38. package/dist/noFormat.d.ts.map +1 -0
  39. package/dist/noFormat.js +12 -0
  40. package/dist/noFormat.js.map +1 -0
  41. package/dist/types/DependencyConstraint.d.ts +14 -0
  42. package/dist/types/DependencyConstraint.d.ts.map +1 -0
  43. package/dist/types/DependencyConstraint.js +3 -0
  44. package/dist/types/DependencyConstraint.js.map +1 -0
  45. package/dist/types/InvalidTestCase.d.ts +68 -0
  46. package/dist/types/InvalidTestCase.d.ts.map +1 -0
  47. package/dist/types/InvalidTestCase.js +3 -0
  48. package/dist/types/InvalidTestCase.js.map +1 -0
  49. package/dist/types/RuleTesterConfig.d.ts +26 -0
  50. package/dist/types/RuleTesterConfig.d.ts.map +1 -0
  51. package/dist/types/RuleTesterConfig.js +3 -0
  52. package/dist/types/RuleTesterConfig.js.map +1 -0
  53. package/dist/types/ValidTestCase.d.ts +53 -0
  54. package/dist/types/ValidTestCase.d.ts.map +1 -0
  55. package/dist/types/ValidTestCase.js +3 -0
  56. package/dist/types/ValidTestCase.js.map +1 -0
  57. package/dist/types/index.d.ts +19 -0
  58. package/dist/types/index.d.ts.map +1 -0
  59. package/dist/types/index.js +3 -0
  60. package/dist/types/index.js.map +1 -0
  61. package/dist/utils/SourceCodeFixer.d.ts +16 -0
  62. package/dist/utils/SourceCodeFixer.d.ts.map +1 -0
  63. package/dist/utils/SourceCodeFixer.js +93 -0
  64. package/dist/utils/SourceCodeFixer.js.map +1 -0
  65. package/dist/utils/ajv.d.ts +3 -0
  66. package/dist/utils/ajv.d.ts.map +1 -0
  67. package/dist/utils/ajv.js +26 -0
  68. package/dist/utils/ajv.js.map +1 -0
  69. package/dist/utils/cloneDeeplyExcludesParent.d.ts +6 -0
  70. package/dist/utils/cloneDeeplyExcludesParent.d.ts.map +1 -0
  71. package/dist/utils/cloneDeeplyExcludesParent.js +24 -0
  72. package/dist/utils/cloneDeeplyExcludesParent.js.map +1 -0
  73. package/dist/utils/config-schema.d.ts +3 -0
  74. package/dist/utils/config-schema.d.ts.map +1 -0
  75. package/dist/utils/config-schema.js +87 -0
  76. package/dist/utils/config-schema.js.map +1 -0
  77. package/dist/utils/config-validator.d.ts +12 -0
  78. package/dist/utils/config-validator.d.ts.map +1 -0
  79. package/dist/utils/config-validator.js +208 -0
  80. package/dist/utils/config-validator.js.map +1 -0
  81. package/dist/utils/dependencyConstraints.d.ts +3 -0
  82. package/dist/utils/dependencyConstraints.d.ts.map +1 -0
  83. package/dist/utils/dependencyConstraints.js +53 -0
  84. package/dist/utils/dependencyConstraints.js.map +1 -0
  85. package/dist/utils/deprecation-warnings.d.ts +13 -0
  86. package/dist/utils/deprecation-warnings.d.ts.map +1 -0
  87. package/dist/utils/deprecation-warnings.js +32 -0
  88. package/dist/utils/deprecation-warnings.js.map +1 -0
  89. package/dist/utils/freezeDeeply.d.ts +5 -0
  90. package/dist/utils/freezeDeeply.d.ts.map +1 -0
  91. package/dist/utils/freezeDeeply.js +23 -0
  92. package/dist/utils/freezeDeeply.js.map +1 -0
  93. package/dist/utils/getRuleOptionsSchema.d.ts +9 -0
  94. package/dist/utils/getRuleOptionsSchema.d.ts.map +1 -0
  95. package/dist/utils/getRuleOptionsSchema.js +33 -0
  96. package/dist/utils/getRuleOptionsSchema.js.map +1 -0
  97. package/dist/utils/hasOwnProperty.d.ts +2 -0
  98. package/dist/utils/hasOwnProperty.d.ts.map +1 -0
  99. package/dist/utils/hasOwnProperty.js +6 -0
  100. package/dist/utils/hasOwnProperty.js.map +1 -0
  101. package/dist/utils/interpolate.d.ts +3 -0
  102. package/dist/utils/interpolate.d.ts.map +1 -0
  103. package/dist/utils/interpolate.js +20 -0
  104. package/dist/utils/interpolate.js.map +1 -0
  105. package/dist/utils/isReadonlyArray.d.ts +2 -0
  106. package/dist/utils/isReadonlyArray.d.ts.map +1 -0
  107. package/dist/utils/isReadonlyArray.js +9 -0
  108. package/dist/utils/isReadonlyArray.js.map +1 -0
  109. package/dist/utils/validationHelpers.d.ts +29 -0
  110. package/dist/utils/validationHelpers.d.ts.map +1 -0
  111. package/dist/utils/validationHelpers.js +158 -0
  112. package/dist/utils/validationHelpers.js.map +1 -0
  113. package/package.json +83 -0
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ // Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/linter/source-code-fixer.js
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.applyFixes = void 0;
5
+ const hasOwnProperty_1 = require("./hasOwnProperty");
6
+ const BOM = '\uFEFF';
7
+ /**
8
+ * Compares items in a messages array by range.
9
+ * @returns -1 if a comes before b, 1 if a comes after b, 0 if equal.
10
+ */
11
+ function compareMessagesByFixRange(a, b) {
12
+ return a.fix.range[0] - b.fix.range[0] || a.fix.range[1] - b.fix.range[1];
13
+ }
14
+ /**
15
+ * Compares items in a messages array by line and column.
16
+ * @returns -1 if a comes before b, 1 if a comes after b, 0 if equal.
17
+ */
18
+ function compareMessagesByLocation(a, b) {
19
+ // @ts-expect-error -- it's not possible for suggestions to reach this location
20
+ return a.line - b.line || a.column - b.column;
21
+ }
22
+ /**
23
+ * Applies the fixes specified by the messages to the given text. Tries to be
24
+ * smart about the fixes and won't apply fixes over the same area in the text.
25
+ * @param sourceText The text to apply the changes to.
26
+ * @param messages The array of messages reported by ESLint.
27
+ * @returns {Object} An object containing the fixed text and any unfixed messages.
28
+ */
29
+ function applyFixes(sourceText, messages) {
30
+ // clone the array
31
+ const remainingMessages = [];
32
+ const fixes = [];
33
+ const bom = sourceText.startsWith(BOM) ? BOM : '';
34
+ const text = bom ? sourceText.slice(1) : sourceText;
35
+ let lastPos = Number.NEGATIVE_INFINITY;
36
+ let output = bom;
37
+ /**
38
+ * Try to use the 'fix' from a problem.
39
+ * @param {Message} problem The message object to apply fixes from
40
+ * @returns {boolean} Whether fix was successfully applied
41
+ */
42
+ function attemptFix(problem) {
43
+ const fix = problem.fix;
44
+ const start = fix.range[0];
45
+ const end = fix.range[1];
46
+ // Remain it as a problem if it's overlapped or it's a negative range
47
+ if (lastPos >= start || start > end) {
48
+ remainingMessages.push(problem);
49
+ return false;
50
+ }
51
+ // Remove BOM.
52
+ if ((start < 0 && end >= 0) || (start === 0 && fix.text.startsWith(BOM))) {
53
+ output = '';
54
+ }
55
+ // Make output to this fix.
56
+ output += text.slice(Math.max(0, lastPos), Math.max(0, start));
57
+ output += fix.text;
58
+ lastPos = end;
59
+ return true;
60
+ }
61
+ messages.forEach(problem => {
62
+ if ((0, hasOwnProperty_1.hasOwnProperty)(problem, 'fix')) {
63
+ fixes.push(problem);
64
+ }
65
+ else {
66
+ remainingMessages.push(problem);
67
+ }
68
+ });
69
+ if (fixes.length) {
70
+ let fixesWereApplied = false;
71
+ for (const problem of fixes.sort(compareMessagesByFixRange)) {
72
+ attemptFix(problem);
73
+ /*
74
+ * The only time attemptFix will fail is if a previous fix was
75
+ * applied which conflicts with it. So we can mark this as true.
76
+ */
77
+ fixesWereApplied = true;
78
+ }
79
+ output += text.slice(Math.max(0, lastPos));
80
+ return {
81
+ fixed: fixesWereApplied,
82
+ messages: remainingMessages.sort(compareMessagesByLocation),
83
+ output,
84
+ };
85
+ }
86
+ return {
87
+ fixed: false,
88
+ messages,
89
+ output: bom + text,
90
+ };
91
+ }
92
+ exports.applyFixes = applyFixes;
93
+ //# sourceMappingURL=SourceCodeFixer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourceCodeFixer.js","sourceRoot":"","sources":["../../src/utils/SourceCodeFixer.ts"],"names":[],"mappings":";AAAA,6HAA6H;;;AAI7H,qDAAkD;AAKlD,MAAM,GAAG,GAAG,QAAQ,CAAC;AAErB;;;GAGG;AACH,SAAS,yBAAyB,CAChC,C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AAC,yBAAyB,CAAC;YAC3D,MAAM;SACP,CAAC;KACH;IAED,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,QAAQ;QACR,MAAM,EAAE,GAAG,GAAG,IAAI;KACnB,CAAC;AACJ,CAAC;AA9ED,gCA8EC"}
@@ -0,0 +1,3 @@
1
+ import Ajv from 'ajv';
2
+ export declare function ajvBuilder(additionalOptions?: {}): Ajv.Ajv;
3
+ //# sourceMappingURL=ajv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../src/utils/ajv.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,wBAAgB,UAAU,CAAC,iBAAiB,KAAK,GAAG,GAAG,CAAC,GAAG,CAiB1D"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ // Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/shared/ajv.js
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ajvBuilder = void 0;
8
+ const ajv_1 = __importDefault(require("ajv"));
9
+ const json_schema_draft_04_json_1 = __importDefault(require("ajv/lib/refs/json-schema-draft-04.json"));
10
+ function ajvBuilder(additionalOptions = {}) {
11
+ const ajv = new ajv_1.default({
12
+ meta: false,
13
+ useDefaults: true,
14
+ validateSchema: false,
15
+ missingRefs: 'ignore',
16
+ verbose: true,
17
+ schemaId: 'auto',
18
+ ...additionalOptions,
19
+ });
20
+ ajv.addMetaSchema(json_schema_draft_04_json_1.default);
21
+ // @ts-expect-error -- this is an untyped part of the ajv API
22
+ ajv._opts.defaultMeta = json_schema_draft_04_json_1.default.id;
23
+ return ajv;
24
+ }
25
+ exports.ajvBuilder = ajvBuilder;
26
+ //# sourceMappingURL=ajv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../src/utils/ajv.ts"],"names":[],"mappings":";AAAA,+GAA+G;;;;;;AAE/G,8CAAsB;AACtB,uGAAgE;AAEhE,SAAgB,UAAU,CAAC,iBAAiB,GAAG,EAAE;IAC/C,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC;QAClB,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,KAAK;QACrB,WAAW,EAAE,QAAQ;QACrB,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,MAAM;QAChB,GAAG,iBAAiB;KACrB,CAAC,CAAC;IAEH,GAAG,CAAC,aAAa,CAAC,mCAAU,CAAC,CAAC;IAE9B,6DAA6D;IAC7D,GAAG,CAAC,KAAK,CAAC,WAAW,GAAG,mCAAU,CAAC,EAAE,CAAC;IAEtC,OAAO,GAAG,CAAC;AACb,CAAC;AAjBD,gCAiBC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Clones a given value deeply.
3
+ * Note: This ignores `parent` property.
4
+ */
5
+ export declare function cloneDeeplyExcludesParent<T>(x: T): T;
6
+ //# sourceMappingURL=cloneDeeplyExcludesParent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloneDeeplyExcludesParent.d.ts","sourceRoot":"","sources":["../../src/utils/cloneDeeplyExcludesParent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAkBpD"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cloneDeeplyExcludesParent = void 0;
4
+ /**
5
+ * Clones a given value deeply.
6
+ * Note: This ignores `parent` property.
7
+ */
8
+ function cloneDeeplyExcludesParent(x) {
9
+ if (typeof x === 'object' && x != null) {
10
+ if (Array.isArray(x)) {
11
+ return x.map(cloneDeeplyExcludesParent);
12
+ }
13
+ const retv = {};
14
+ for (const key in x) {
15
+ if (key !== 'parent' && Object.prototype.hasOwnProperty.call(x, key)) {
16
+ retv[key] = cloneDeeplyExcludesParent(x[key]);
17
+ }
18
+ }
19
+ return retv;
20
+ }
21
+ return x;
22
+ }
23
+ exports.cloneDeeplyExcludesParent = cloneDeeplyExcludesParent;
24
+ //# sourceMappingURL=cloneDeeplyExcludesParent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloneDeeplyExcludesParent.js","sourceRoot":"","sources":["../../src/utils/cloneDeeplyExcludesParent.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,yBAAyB,CAAI,CAAI;IAC/C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,IAAI,EAAE;QACtC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACpB,OAAO,CAAC,CAAC,GAAG,CAAC,yBAAyB,CAAM,CAAC;SAC9C;QAED,MAAM,IAAI,GAAG,EAAc,CAAC;QAE5B,KAAK,MAAM,GAAG,IAAI,CAAC,EAAE;YACnB,IAAI,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;gBACpE,IAAI,CAAC,GAAG,CAAC,GAAG,yBAAyB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;aAC/C;SACF;QAED,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAlBD,8DAkBC"}
@@ -0,0 +1,3 @@
1
+ import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema';
2
+ export declare const configSchema: JSONSchema4;
3
+ //# sourceMappingURL=config-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../src/utils/config-schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAuCxE,eAAO,MAAM,YAAY,EAAE,WAiD1B,CAAC"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ // Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/conf/config-schema.js
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.configSchema = void 0;
5
+ const baseConfigProperties = {
6
+ $schema: { type: 'string' },
7
+ defaultFilenames: {
8
+ type: 'object',
9
+ properties: {
10
+ ts: { type: 'string' },
11
+ tsx: { type: 'string' },
12
+ },
13
+ required: ['ts', 'tsx'],
14
+ additionalProperties: false,
15
+ },
16
+ dependencyConstraints: {
17
+ type: 'object',
18
+ additionalProperties: {
19
+ type: 'string',
20
+ },
21
+ },
22
+ env: { type: 'object' },
23
+ extends: { $ref: '#/definitions/stringOrStrings' },
24
+ globals: { type: 'object' },
25
+ noInlineConfig: { type: 'boolean' },
26
+ overrides: {
27
+ type: 'array',
28
+ items: { $ref: '#/definitions/overrideConfig' },
29
+ additionalItems: false,
30
+ },
31
+ parser: { type: ['string', 'null'] },
32
+ parserOptions: { type: 'object' },
33
+ plugins: { type: 'array' },
34
+ processor: { type: 'string' },
35
+ reportUnusedDisableDirectives: { type: 'boolean' },
36
+ rules: { type: 'object' },
37
+ settings: { type: 'object' },
38
+ ecmaFeatures: { type: 'object' }, // deprecated; logs a warning when used
39
+ };
40
+ exports.configSchema = {
41
+ definitions: {
42
+ stringOrStrings: {
43
+ oneOf: [
44
+ { type: 'string' },
45
+ {
46
+ type: 'array',
47
+ items: { type: 'string' },
48
+ additionalItems: false,
49
+ },
50
+ ],
51
+ },
52
+ stringOrStringsRequired: {
53
+ oneOf: [
54
+ { type: 'string' },
55
+ {
56
+ type: 'array',
57
+ items: { type: 'string' },
58
+ additionalItems: false,
59
+ minItems: 1,
60
+ },
61
+ ],
62
+ },
63
+ // Config at top-level.
64
+ objectConfig: {
65
+ type: 'object',
66
+ properties: {
67
+ root: { type: 'boolean' },
68
+ ignorePatterns: { $ref: '#/definitions/stringOrStrings' },
69
+ ...baseConfigProperties,
70
+ },
71
+ additionalProperties: false,
72
+ },
73
+ // Config in `overrides`.
74
+ overrideConfig: {
75
+ type: 'object',
76
+ properties: {
77
+ excludedFiles: { $ref: '#/definitions/stringOrStrings' },
78
+ files: { $ref: '#/definitions/stringOrStringsRequired' },
79
+ ...baseConfigProperties,
80
+ },
81
+ required: ['files'],
82
+ additionalProperties: false,
83
+ },
84
+ },
85
+ $ref: '#/definitions/objectConfig',
86
+ };
87
+ //# sourceMappingURL=config-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../../src/utils/config-schema.ts"],"names":[],"mappings":";AAAA,mHAAmH;;;AAInH,MAAM,oBAAoB,GAAgC;IACxD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC3B,gBAAgB,EAAE;QAChB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACtB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACxB;QACD,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;QACvB,oBAAoB,EAAE,KAAK;KAC5B;IACD,qBAAqB,EAAE;QACrB,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE;YACpB,IAAI,EAAE,QAAQ;SACf;KACF;IACD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IACvB,OAAO,EAAE,EAAE,IAAI,EAAE,+BAA+B,EAAE;IAClD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC3B,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IACnC,SAAS,EAAE;QACT,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,EAAE,IAAI,EAAE,8BAA8B,EAAE;QAC/C,eAAe,EAAE,KAAK;KACvB;IACD,MAAM,EAAE,EAAE,IAAI,EAAE,C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BACxD,KAAK,EAAE,EAAE,IAAI,EAAE,uCAAuC,EAAE;gBACxD,GAAG,oBAAoB;aACxB;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;YACnB,oBAAoB,EAAE,KAAK;SAC5B;KACF;IAED,IAAI,EAAE,4BAA4B;CACnC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { AnyRuleModule } from '@typescript-eslint/utils/ts-eslint';
2
+ import type { TesterConfigWithDefaults } from '../types';
3
+ type GetAdditionalRule = (ruleId: string) => AnyRuleModule | null;
4
+ /**
5
+ * Validates an entire config object.
6
+ * @param config The config object to validate.
7
+ * @param source The name of the configuration source to report in any errors.
8
+ * @param getAdditionalRule A map from strings to loaded rules.
9
+ */
10
+ export declare function validate(config: TesterConfigWithDefaults, source: string, getAdditionalRule: GetAdditionalRule): void;
11
+ export {};
12
+ //# sourceMappingURL=config-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-validator.d.ts","sourceRoot":"","sources":["../../src/utils/config-validator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,oCAAoC,CAAC;AAQhF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAOzD,KAAK,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,aAAa,GAAG,IAAI,CAAC;AAsPlE;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,wBAAwB,EAChC,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,GACnC,IAAI,CAWN"}
@@ -0,0 +1,208 @@
1
+ "use strict";
2
+ // Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/shared/config-validator.js
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.validate = void 0;
8
+ const node_util_1 = __importDefault(require("node:util"));
9
+ const eslintrc_1 = require("@eslint/eslintrc");
10
+ const use_at_your_own_risk_1 = require("eslint/use-at-your-own-risk");
11
+ const ajv_1 = require("./ajv");
12
+ const config_schema_1 = require("./config-schema");
13
+ const deprecation_warnings_1 = require("./deprecation-warnings");
14
+ const getRuleOptionsSchema_1 = require("./getRuleOptionsSchema");
15
+ const hasOwnProperty_1 = require("./hasOwnProperty");
16
+ const { ConfigOps, environments: BuiltInEnvironments } = eslintrc_1.Legacy;
17
+ const ajv = (0, ajv_1.ajvBuilder)();
18
+ const ruleValidators = new WeakMap();
19
+ let validateSchema;
20
+ const severityMap = {
21
+ error: 2,
22
+ warn: 1,
23
+ off: 0,
24
+ };
25
+ /**
26
+ * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.
27
+ * @param options The given options for the rule.
28
+ * @throws {Error} Wrong severity value.
29
+ */
30
+ function validateRuleSeverity(options) {
31
+ const severity = Array.isArray(options) ? options[0] : options;
32
+ const normSeverity = typeof severity === 'string'
33
+ ? severityMap[severity.toLowerCase()]
34
+ : severity;
35
+ if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {
36
+ return normSeverity;
37
+ }
38
+ throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${node_util_1.default
39
+ .inspect(severity)
40
+ .replace(/'/gu, '"')
41
+ .replace(/\n/gu, '')}').\n`);
42
+ }
43
+ /**
44
+ * Validates the non-severity options passed to a rule, based on its schema.
45
+ * @param rule The rule to validate
46
+ * @param localOptions The options for the rule, excluding severity
47
+ * @throws {Error} Any rule validation errors.
48
+ */
49
+ function validateRuleSchema(rule, localOptions) {
50
+ if (!ruleValidators.has(rule)) {
51
+ const schema = (0, getRuleOptionsSchema_1.getRuleOptionsSchema)(rule);
52
+ if (schema) {
53
+ ruleValidators.set(rule, ajv.compile(schema));
54
+ }
55
+ }
56
+ const validateRule = ruleValidators.get(rule);
57
+ if (validateRule) {
58
+ validateRule(localOptions);
59
+ if (validateRule.errors) {
60
+ throw new Error(validateRule.errors
61
+ .map(error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`)
62
+ .join(''));
63
+ }
64
+ }
65
+ }
66
+ /**
67
+ * Validates a rule's options against its schema.
68
+ * @param rule The rule that the config is being validated for
69
+ * @param ruleId The rule's unique name.
70
+ * @param {Array|number} options The given options for the rule.
71
+ * @param source The name of the configuration source to report in any errors. If null or undefined,
72
+ * no source is prepended to the message.
73
+ * @throws {Error} Upon any bad rule configuration.
74
+ */
75
+ function validateRuleOptions(rule, ruleId, options, source = null) {
76
+ try {
77
+ const severity = validateRuleSeverity(options);
78
+ if (severity !== 0) {
79
+ validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);
80
+ }
81
+ }
82
+ catch (err) {
83
+ const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
84
+ if (typeof source === 'string') {
85
+ throw new Error(`${source}:\n\t${enhancedMessage}`);
86
+ }
87
+ else {
88
+ throw new Error(enhancedMessage);
89
+ }
90
+ }
91
+ }
92
+ /**
93
+ * Validates an environment object
94
+ * @param environment The environment config object to validate.
95
+ * @param source The name of the configuration source to report in any errors.
96
+ */
97
+ function validateEnvironment(environment, source) {
98
+ // not having an environment is ok
99
+ if (!environment) {
100
+ return;
101
+ }
102
+ Object.keys(environment).forEach(id => {
103
+ const env = BuiltInEnvironments.get(id) ?? null;
104
+ if (!env) {
105
+ const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`;
106
+ throw new Error(message);
107
+ }
108
+ });
109
+ }
110
+ /**
111
+ * Validates a rules config object
112
+ * @param rulesConfig The rules config object to validate.
113
+ * @param source The name of the configuration source to report in any errors.
114
+ * @param getAdditionalRule A map from strings to loaded rules
115
+ */
116
+ function validateRules(rulesConfig, source, getAdditionalRule) {
117
+ if (!rulesConfig) {
118
+ return;
119
+ }
120
+ Object.keys(rulesConfig).forEach(id => {
121
+ const rule = getAdditionalRule(id) ?? use_at_your_own_risk_1.builtinRules.get(id) ?? null;
122
+ if (rule == null) {
123
+ return;
124
+ }
125
+ validateRuleOptions(rule, id, rulesConfig[id], source);
126
+ });
127
+ }
128
+ /**
129
+ * Validates a `globals` section of a config file
130
+ * @param globalsConfig The `globals` section
131
+ * @param source The name of the configuration source to report in the event of an error.
132
+ */
133
+ function validateGlobals(globalsConfig, source = null) {
134
+ if (!globalsConfig) {
135
+ return;
136
+ }
137
+ Object.entries(globalsConfig).forEach(([configuredGlobal, configuredValue]) => {
138
+ try {
139
+ ConfigOps.normalizeConfigGlobal(configuredValue);
140
+ }
141
+ catch (err) {
142
+ throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`);
143
+ }
144
+ });
145
+ }
146
+ /**
147
+ * Formats an array of schema validation errors.
148
+ */
149
+ function formatErrors(errors) {
150
+ return errors
151
+ .map(error => {
152
+ if (error.keyword === 'additionalProperties') {
153
+ const params = error.params;
154
+ const formattedPropertyPath = error.dataPath.length
155
+ ? `${error.dataPath.slice(1)}.${params.additionalProperty}`
156
+ : params.additionalProperty;
157
+ return `Unexpected top-level property "${formattedPropertyPath}"`;
158
+ }
159
+ if (error.keyword === 'type') {
160
+ const formattedField = error.dataPath.slice(1);
161
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
162
+ const formattedExpectedType = Array.isArray(error.schema)
163
+ ? error.schema.join('/')
164
+ : error.schema;
165
+ const formattedValue = JSON.stringify(error.data);
166
+ return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`;
167
+ }
168
+ const field = error.dataPath[0] === '.' ? error.dataPath.slice(1) : error.dataPath;
169
+ return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`;
170
+ })
171
+ .map(message => `\t- ${message}.\n`)
172
+ .join('');
173
+ }
174
+ /**
175
+ * Validates the top level properties of the config object.
176
+ * @param config The config object to validate.
177
+ * @param source The name of the configuration source to report in any errors.
178
+ * @throws {Error} For any config invalid per the schema.
179
+ */
180
+ function validateConfigSchema(config, source) {
181
+ validateSchema = validateSchema || ajv.compile(config_schema_1.configSchema);
182
+ if (!validateSchema(config)) {
183
+ throw new Error(`ESLint configuration in ${source} is invalid:\n${formatErrors(validateSchema.errors)}`);
184
+ }
185
+ // @ts-expect-error -- intentional deprecated check
186
+ if ((0, hasOwnProperty_1.hasOwnProperty)(config, 'ecmaFeatures')) {
187
+ (0, deprecation_warnings_1.emitDeprecationWarning)(source, 'ESLINT_LEGACY_ECMAFEATURES');
188
+ }
189
+ }
190
+ /**
191
+ * Validates an entire config object.
192
+ * @param config The config object to validate.
193
+ * @param source The name of the configuration source to report in any errors.
194
+ * @param getAdditionalRule A map from strings to loaded rules.
195
+ */
196
+ function validate(config, source, getAdditionalRule) {
197
+ validateConfigSchema(config, source);
198
+ validateRules(config.rules, source, getAdditionalRule);
199
+ validateEnvironment(config.env, source);
200
+ validateGlobals(config.globals, source);
201
+ for (const override of config.overrides ?? []) {
202
+ validateRules(override.rules, source, getAdditionalRule);
203
+ validateEnvironment(override.env, source);
204
+ validateGlobals(config.globals, source);
205
+ }
206
+ }
207
+ exports.validate = validate;
208
+ //# sourceMappingURL=config-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-validator.js","sourceRoot":"","sources":["../../src/utils/config-validator.ts"],"names":[],"mappings":";AAAA,4HAA4H;;;;;;AAE5H,0DAA6B;AAE7B,+CAA0C;AAO1C,sEAA2D;AAG3D,+BAAmC;AACnC,mDAA+C;AAC/C,iEAAgE;AAChE,iEAA8D;AAC9D,qDAAkD;AAIlD,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,EAAE,GAAG,iBAAM,CAAC;AAChE,MAAM,GAAG,GAAG,IAAA,gBAAU,GAAE,CAAC;AACzB,MAAM,cAAc,GAAG,IAAI,OAAO,EAAmC,CAAC;AAEtE,IAAI,cAAgC,CAAC;AACrC,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,C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AG,CAAC,OAAO,CAAC,4BAAY,CAAC,CAAC;IAE7D,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,2BAA2B,MAAM,iBAAiB,YAAY,CAC5D,cAAc,CAAC,MAAO,CACvB,EAAE,CACJ,CAAC;KACH;IAED,mDAAmD;IACnD,IAAI,IAAA,+BAAc,EAAC,MAAM,EAAE,cAAc,CAAC,EAAE;QAC1C,IAAA,6CAAsB,EAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;KAC9D;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CACtB,MAAgC,EAChC,MAAc,EACd,iBAAoC;IAEpC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACvD,mBAAmB,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACxC,eAAe,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAExC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE;QAC7C,aAAa,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACzD,mBAAmB,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC1C,eAAe,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACzC;AACH,CAAC;AAfD,4BAeC"}
@@ -0,0 +1,3 @@
1
+ import type { DependencyConstraint } from '../types/DependencyConstraint';
2
+ export declare function satisfiesAllDependencyConstraints(dependencyConstraints: DependencyConstraint | undefined): boolean;
3
+ //# sourceMappingURL=dependencyConstraints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencyConstraints.d.ts","sourceRoot":"","sources":["../../src/utils/dependencyConstraints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,+BAA+B,CAAC;AA0BvC,wBAAgB,iCAAiC,CAC/C,qBAAqB,EAAE,oBAAoB,GAAG,SAAS,GACtD,OAAO,CAcT"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.satisfiesAllDependencyConstraints = void 0;
27
+ const semver = __importStar(require("semver"));
28
+ const BASE_SATISFIES_OPTIONS = {
29
+ includePrerelease: true,
30
+ };
31
+ function satisfiesDependencyConstraint(packageName, constraintIn) {
32
+ const constraint = typeof constraintIn === 'string'
33
+ ? {
34
+ range: `>=${constraintIn}`,
35
+ }
36
+ : constraintIn;
37
+ return semver.satisfies(require(`${packageName}/package.json`).version, constraint.range, typeof constraint.options === 'object'
38
+ ? { ...BASE_SATISFIES_OPTIONS, ...constraint.options }
39
+ : constraint.options);
40
+ }
41
+ function satisfiesAllDependencyConstraints(dependencyConstraints) {
42
+ if (dependencyConstraints == null) {
43
+ return true;
44
+ }
45
+ for (const [packageName, constraint] of Object.entries(dependencyConstraints)) {
46
+ if (!satisfiesDependencyConstraint(packageName, constraint)) {
47
+ return false;
48
+ }
49
+ }
50
+ return true;
51
+ }
52
+ exports.satisfiesAllDependencyConstraints = satisfiesAllDependencyConstraints;
53
+ //# sourceMappingURL=dependencyConstraints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencyConstraints.js","sourceRoot":"","sources":["../../src/utils/dependencyConstraints.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAOjC,MAAM,sBAAsB,GAAwB;IAClD,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF,SAAS,6BAA6B,CACpC,WAAmB,EACnB,YAA0C;IAE1C,MAAM,UAAU,GACd,OAAO,YAAY,KAAK,QAAQ;QAC9B,CAAC,CAAC;YACE,KAAK,EAAE,KAAK,YAAY,EAAE;SAC3B;QACH,CAAC,CAAC,YAAY,CAAC;IAEnB,OAAO,MAAM,CAAC,SAAS,CACpB,OAAO,CAAC,GAAG,WAAW,eAAe,CAAyB,CAAC,OAAO,EACvE,UAAU,CAAC,KAAK,EAChB,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ;QACpC,CAAC,CAAC,EAAE,GAAG,sBAAsB,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE;QACtD,CAAC,CAAC,UAAU,CAAC,OAAO,CACvB,CAAC;AACJ,CAAC;AAED,SAAgB,iCAAiC,CAC/C,qBAAuD;IAEvD,IAAI,qBAAqB,IAAI,IAAI,EAAE;QACjC,OAAO,IAAI,CAAC;KACb;IAED,KAAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CACpD,qBAAqB,CACtB,EAAE;QACD,IAAI,CAAC,6BAA6B,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE;YAC3D,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAhBD,8EAgBC"}
@@ -0,0 +1,13 @@
1
+ declare const deprecationWarningMessages: {
2
+ readonly ESLINT_LEGACY_ECMAFEATURES: "The 'ecmaFeatures' config file property is deprecated and has no effect.";
3
+ };
4
+ /**
5
+ * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted
6
+ * for each unique file path, but repeated invocations with the same file path have no effect.
7
+ * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.
8
+ * @param source The name of the configuration source to report the warning for.
9
+ * @param errorCode The warning message to show.
10
+ */
11
+ export declare function emitDeprecationWarning(source: string, errorCode: keyof typeof deprecationWarningMessages): void;
12
+ export {};
13
+ //# sourceMappingURL=deprecation-warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecation-warnings.d.ts","sourceRoot":"","sources":["../../src/utils/deprecation-warnings.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,0BAA0B;;CAGtB,CAAC;AAIX;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,OAAO,0BAA0B,GACjD,IAAI,CAiBN"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/shared/deprecation-warnings.js
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.emitDeprecationWarning = void 0;
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ // Definitions for deprecation warnings.
10
+ const deprecationWarningMessages = {
11
+ ESLINT_LEGACY_ECMAFEATURES: "The 'ecmaFeatures' config file property is deprecated and has no effect.",
12
+ };
13
+ const sourceFileErrorCache = new Set();
14
+ /**
15
+ * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted
16
+ * for each unique file path, but repeated invocations with the same file path have no effect.
17
+ * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.
18
+ * @param source The name of the configuration source to report the warning for.
19
+ * @param errorCode The warning message to show.
20
+ */
21
+ function emitDeprecationWarning(source, errorCode) {
22
+ const cacheKey = JSON.stringify({ source, errorCode });
23
+ if (sourceFileErrorCache.has(cacheKey)) {
24
+ return;
25
+ }
26
+ sourceFileErrorCache.add(cacheKey);
27
+ const rel = node_path_1.default.relative(process.cwd(), source);
28
+ const message = deprecationWarningMessages[errorCode];
29
+ process.emitWarning(`${message} (found in "${rel}")`, 'DeprecationWarning', errorCode);
30
+ }
31
+ exports.emitDeprecationWarning = emitDeprecationWarning;
32
+ //# sourceMappingURL=deprecation-warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecation-warnings.js","sourceRoot":"","sources":["../../src/utils/deprecation-warnings.ts"],"names":[],"mappings":";AAAA,gIAAgI;;;;;;AAEhI,0DAA6B;AAE7B,wCAAwC;AACxC,MAAM,0BAA0B,GAAG;IACjC,0BAA0B,EACxB,0EAA0E;CACpE,CAAC;AAEX,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;AAE/C;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,MAAc,EACd,SAAkD;IAElD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAEvD,IAAI,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QACtC,OAAO;KACR;IAED,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEnC,MAAM,GAAG,GAAG,mBAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAEtD,OAAO,CAAC,WAAW,CACjB,GAAG,OAAO,eAAe,GAAG,IAAI,EAChC,oBAAoB,EACpB,SAAS,CACV,CAAC;AACJ,CAAC;AApBD,wDAoBC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Freezes a given value deeply.
3
+ */
4
+ export declare function freezeDeeply(x: unknown): void;
5
+ //# sourceMappingURL=freezeDeeply.d.ts.map