@zukhruf/eslint 0.3.53 → 0.3.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -188,6 +188,8 @@ export default defineConfig({
188
188
 
189
189
  The rule decides each manifest's options itself, so your options add to the shared policy and never replace it. `projects` keys are folders relative to the workspace root. Like Nx's own rule, it needs the project graph that `nx` caches; without it, the rule checks nothing. It needs `@nx/devkit`, which `@nx/eslint-plugin` installs.
190
190
 
191
+ `manifest/recommended` also has `manifest/no-truncated-description`. The npm registry keeps only the first 255 characters of a package's `description`. `npm view` and the npm search do not show the rest. The rule reports a `description` that is longer than 255 characters. It does not check a manifest with `"private": true`, because npm does not publish it. Put the key fact in the description, and put the details in the README.
192
+
191
193
  ## React Native: Hermes
192
194
 
193
195
  `@zukhruf/eslint/react-native` needs `eslint-plugin-es-x`. es-x 10 needs ESLint 10.6 or later; on ESLint 9, install `eslint-plugin-es-x@9`. `hermes/recommended` checks the code that ships in the app, and leaves tests, config files and scripts alone, because those run in Node:
@@ -216,3 +218,21 @@ npx nx run eslint:test # builds, then runs the rule and composition tests
216
218
  ```
217
219
 
218
220
  The composition tests run the real ESLint CLI on temporary workspaces. They load the built package, which is what consumers install.
221
+
222
+ ### Add a check
223
+
224
+ A check is a rule under its own key ([ADR 0001](./docs/adr/0001-one-key-per-check.md)). Before you write a visitor by hand, use the builders in `src/authoring/`:
225
+
226
+ - `importBanRule()` bans packages and their subpaths. It reports static imports, re-exports and literal dynamic imports, type-only ones included.
227
+ - `selectorRule()` reports each node that one of its esquery selectors matches. The substring operator `*=` never matches a Literal's `value`, so write a regex selector (`[value=/…/]`).
228
+ - `scopedRule()` turns a rule on only for the files that its function accepts. Build that function from `isTestFile()`, `inRoots()` and `matchesAnyGlob()` in `path-scope.ts`. A rule finds its scope from the linted file, not from a config glob ([ADR 0002](./docs/adr/0002-scope-from-the-linted-file.md)).
229
+ - `ast.ts` has the type guards for a visitor: `isAstNode()`, `isType()` and `identifierName()`.
230
+
231
+ Folders that differ from repo to repo are `roots` options. A fact about the repo is a repo setting. A rule whose options a repo extends gets an option factory ([ADR 0004](./docs/adr/0004-option-factories.md)).
232
+
233
+ 1. Put the rule in the folder of the subject that it checks, such as `src/async-values/` or `src/imports/`. The file exports the rule as its default.
234
+ 2. Put `<rule>.test.ts` next to it. Use `typescriptRuleTester()` from `src/testing/rule-tester.ts`, or `typedRuleTester(root)` when the rule reads types. Call `run()` inside a node:test `test()`.
235
+ 3. Add the rule to the `rules` map in the `config.ts` of its concept, and turn on `zukhruf/<rule>` in that concept's config. A new concept also goes into the `concepts` list in `src/plugin.ts`. The composition tests fail when not exactly one config turns on a rule, when a config sets a repo-owned rule, or when a shipped glob does not start with `**`.
236
+ 4. Add the rule to its concept's row in the Configs table. Below the table, write a paragraph that tells why the check exists.
237
+ 5. Fix the findings that the new rule reports in the other packages of this workspace, in the same commit (for example 20b34e0). The workspace lints itself with this source. When a package must keep its code, turn the rule off for those files in the root `eslint.config.mjs`, with a comment that tells why (for example 495f19d).
238
+ 6. Run `npx nx run eslint:test` and `npx nx run eslint:typecheck`.
@@ -0,0 +1,9 @@
1
+ import type { Rule } from 'eslint';
2
+ /**
3
+ * The npm registry cuts a package's `description` to 255 characters, so the
4
+ * rest never shows in `npm view` or in a search. npm does not publish a
5
+ * manifest with `"private": true`, so the rule does not check it.
6
+ */
7
+ declare const rule: Rule.RuleModule;
8
+ export default rule;
9
+ //# sourceMappingURL=no-truncated-description.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-truncated-description.d.ts","sourceRoot":"","sources":["../../src/manifest/no-truncated-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAwBnC;;;;GAIG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAiChB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { isType } from "../authoring/ast.js";
2
+ /** The npm registry stores at most this many characters of a description. */
3
+ const LIMIT = 255;
4
+ /**
5
+ * The value of the manifest's top-level `name` field. npm reads package.json
6
+ * with `JSON.parse`, so every key is a quoted string.
7
+ */
8
+ function fieldValue(manifest, name) {
9
+ const properties = manifest['properties'];
10
+ const property = Array.isArray(properties)
11
+ ? properties.find((entry) => isType(entry, 'JSONProperty') &&
12
+ isType(entry['key'], 'JSONLiteral') &&
13
+ entry['key']['value'] === name)
14
+ : undefined;
15
+ return isType(property, 'JSONProperty') ? property['value'] : undefined;
16
+ }
17
+ /**
18
+ * The npm registry cuts a package's `description` to 255 characters, so the
19
+ * rest never shows in `npm view` or in a search. npm does not publish a
20
+ * manifest with `"private": true`, so the rule does not check it.
21
+ */
22
+ const rule = {
23
+ meta: {
24
+ type: 'problem',
25
+ docs: {
26
+ description: 'Disallow a description that the npm registry cuts, in a package.json that npm can publish',
27
+ },
28
+ schema: [],
29
+ messages: {
30
+ truncated: 'The description has {{length}} characters. The npm registry stores at most {{limit}}, so it cuts the rest. Keep the key fact here and move the detail to the README.',
31
+ },
32
+ },
33
+ create(context) {
34
+ return {
35
+ 'JSONExpressionStatement > JSONObjectExpression'(manifest) {
36
+ if (!isType(manifest, 'JSONObjectExpression'))
37
+ return;
38
+ const isPrivate = fieldValue(manifest, 'private');
39
+ if (isType(isPrivate, 'JSONLiteral') && isPrivate['value'] === true) {
40
+ return;
41
+ }
42
+ const description = fieldValue(manifest, 'description');
43
+ if (!isType(description, 'JSONLiteral'))
44
+ return;
45
+ const text = description['value'];
46
+ if (typeof text !== 'string' || text.length <= LIMIT)
47
+ return;
48
+ context.report({
49
+ node: description,
50
+ messageId: 'truncated',
51
+ data: { length: String(text.length), limit: String(LIMIT) },
52
+ });
53
+ },
54
+ };
55
+ },
56
+ };
57
+ export default rule;
58
+ //# sourceMappingURL=no-truncated-description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-truncated-description.js","sourceRoot":"","sources":["../../src/manifest/no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ACT,CAAC;gBACD,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBACxD,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC;oBAAE,OAAO;gBAChD,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;gBAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK;oBAAE,OAAO;gBAC7D,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,WAAW;oBACjB,SAAS,EAAE,WAAW;oBACtB,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;iBAC5D,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -4,7 +4,8 @@ import type { Linter } from 'eslint';
4
4
  * shipped code needs. How many depends on the project's shape: a bundled app
5
5
  * declares the whole closure its workspace imports pull in, an unbundled
6
6
  * project only its own imports. Islands are checked by
7
- * `island/dependency-checks`.
7
+ * `island/dependency-checks`. A manifest that npm can publish keeps its
8
+ * description inside what the npm registry stores.
8
9
  */
9
10
  declare const plugin: {
10
11
  meta: {
@@ -13,6 +14,7 @@ declare const plugin: {
13
14
  };
14
15
  rules: {
15
16
  'dependency-checks': import("eslint").Rule.RuleModule;
17
+ 'no-truncated-description': import("eslint").Rule.RuleModule;
16
18
  };
17
19
  configs: Record<string, Linter.Config<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>[]>;
18
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/manifest/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQ7C;;;;;;GAMG;AACH,QAAA,MAAM,MAAM;;;;;;;;;CAIa,CAAC;AAY1B,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/manifest/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAS7C;;;;;;;GAOG;AACH,QAAA,MAAM,MAAM;;;;;;;;;;CAOa,CAAC;AAe1B,eAAe,MAAM,CAAC"}
@@ -1,17 +1,22 @@
1
1
  import * as jsonc from 'jsonc-eslint-parser';
2
2
  import { PACKAGE_JSON } from "../files.js";
3
3
  import dependencyChecks from "./dependency-checks.js";
4
+ import noTruncatedDescription from "./no-truncated-description.js";
4
5
  const configs = {};
5
6
  /**
6
7
  * Manifests: every project's package.json declares the npm packages its
7
8
  * shipped code needs. How many depends on the project's shape: a bundled app
8
9
  * declares the whole closure its workspace imports pull in, an unbundled
9
10
  * project only its own imports. Islands are checked by
10
- * `island/dependency-checks`.
11
+ * `island/dependency-checks`. A manifest that npm can publish keeps its
12
+ * description inside what the npm registry stores.
11
13
  */
12
14
  const plugin = {
13
15
  meta: { name: '@zukhruf/eslint/nx/manifest', namespace: 'manifest' },
14
- rules: { 'dependency-checks': dependencyChecks },
16
+ rules: {
17
+ 'dependency-checks': dependencyChecks,
18
+ 'no-truncated-description': noTruncatedDescription,
19
+ },
15
20
  configs,
16
21
  };
17
22
  configs['recommended'] = [
@@ -20,7 +25,10 @@ configs['recommended'] = [
20
25
  name: 'manifest/recommended',
21
26
  files: PACKAGE_JSON,
22
27
  languageOptions: { parser: jsonc },
23
- rules: { 'manifest/dependency-checks': 'error' },
28
+ rules: {
29
+ 'manifest/dependency-checks': 'error',
30
+ 'manifest/no-truncated-description': 'error',
31
+ },
24
32
  },
25
33
  ];
26
34
  export default plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/manifest/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,qBAAqB,C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,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;IACvE;QACE,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,YAAY;QACnB,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QAClC,KAAK,EAAE;YACL,4BAA4B,EAAE,OAAO;YACrC,mCAAmC,EAAE,OAAO;SAC7C;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"no-test-lifecycle-hooks.d.ts","sourceRoot":"","sources":["../../src/test-files/no-test-lifecycle-hooks.ts"],"names":[],"mappings":";AAEA,wBAQG"}
1
+ {"version":3,"file":"no-test-lifecycle-hooks.d.ts","sourceRoot":"","sources":["../../src/test-files/no-test-lifecycle-hooks.ts"],"names":[],"mappings":";AA+KA,wBAAgC"}
@@ -1,9 +1,132 @@
1
- import { selectorRule } from "../authoring/selector-rule.js";
2
- export default selectorRule({
3
- description: 'Disallow test lifecycle hooks; each test arranges and tears down its own state',
4
- selectors: [
5
- 'CallExpression[callee.name=/^(before|after|beforeEach|afterEach|beforeAll|afterAll)$/]',
6
- ],
7
- message: 'No test lifecycle hooks. Write self-contained AAA tests: inline arrange in each test and run teardown (cleanup, mock restore, resource stop) in a per-test try/finally.',
1
+ import { ASTUtils, ESLintUtils, } from '@typescript-eslint/utils';
2
+ import { eslintRule } from "../authoring/rule-module.js";
3
+ const HOOKS = new Set([
4
+ 'before',
5
+ 'after',
6
+ 'beforeEach',
7
+ 'afterEach',
8
+ 'beforeAll',
9
+ 'afterAll',
10
+ ]);
11
+ const NODE_TEST = /^(node:)?test$/;
12
+ const TEST_FUNCTIONS = new Set(['test', 'it']);
13
+ const MODIFIERS = new Set(['only', 'skip', 'todo']);
14
+ function importClause(resolve, node) {
15
+ if (node.type !== 'Identifier')
16
+ return undefined;
17
+ const definition = resolve(node)?.defs[0];
18
+ return definition?.type === 'ImportBinding' &&
19
+ definition.node.type !== 'TSImportEqualsDeclaration'
20
+ ? definition.node
21
+ : undefined;
22
+ }
23
+ function importedName(specifier) {
24
+ return specifier.imported.type === 'Identifier'
25
+ ? specifier.imported.name
26
+ : specifier.imported.value;
27
+ }
28
+ function nodeTestImport(resolve, node) {
29
+ const clause = importClause(resolve, node);
30
+ return clause?.parent.type === 'ImportDeclaration' &&
31
+ NODE_TEST.test(clause.parent.source.value)
32
+ ? clause
33
+ : undefined;
34
+ }
35
+ function isNodeTestNamespace(resolve, node) {
36
+ return nodeTestImport(resolve, node)?.type === 'ImportNamespaceSpecifier';
37
+ }
38
+ /** `test` or `it` of node:test, also as `ns.test`, `test.only`, or the subtest `t.test`. */
39
+ function isTestFunction(resolve, node) {
40
+ if (node.type === 'Identifier') {
41
+ const clause = nodeTestImport(resolve, node);
42
+ return (clause?.type === 'ImportDefaultSpecifier' ||
43
+ (clause?.type === 'ImportSpecifier' &&
44
+ TEST_FUNCTIONS.has(importedName(clause))));
45
+ }
46
+ if (node.type !== 'MemberExpression' || node.property.type !== 'Identifier') {
47
+ return false;
48
+ }
49
+ const property = node.property.name;
50
+ return ((MODIFIERS.has(property) && isTestFunction(resolve, node.object)) ||
51
+ (TEST_FUNCTIONS.has(property) &&
52
+ isNodeTestNamespace(resolve, node.object)) ||
53
+ (property === 'test' && isTestContext(resolve, node.object)));
54
+ }
55
+ function isTestContextType(resolve, annotation) {
56
+ if (annotation.type !== 'TSTypeReference')
57
+ return false;
58
+ const clause = nodeTestImport(resolve, annotation.typeName);
59
+ return (clause?.type === 'ImportSpecifier' && importedName(clause) === 'TestContext');
60
+ }
61
+ /** A parameter typed `TestContext`, or the first parameter of a test function's callback. */
62
+ function isTestContext(resolve, node) {
63
+ if (node.type !== 'Identifier')
64
+ return false;
65
+ const definition = resolve(node)?.defs[0];
66
+ if (definition?.type !== 'Parameter')
67
+ return false;
68
+ const parameter = definition.name;
69
+ if (parameter.typeAnnotation &&
70
+ isTestContextType(resolve, parameter.typeAnnotation.typeAnnotation)) {
71
+ return true;
72
+ }
73
+ const callback = definition.node;
74
+ const call = callback.parent;
75
+ return (callback.params[0] === parameter &&
76
+ call.type === 'CallExpression' &&
77
+ call.arguments.some((argument) => argument === callback) &&
78
+ isTestFunction(resolve, call.callee));
79
+ }
80
+ function isHook(resolve, callee) {
81
+ if (callee.type === 'Identifier') {
82
+ const variable = resolve(callee);
83
+ if (!variable || variable.defs.length === 0)
84
+ return HOOKS.has(callee.name);
85
+ const clause = importClause(resolve, callee);
86
+ return (clause !== undefined &&
87
+ (HOOKS.has(callee.name) ||
88
+ (clause.type === 'ImportSpecifier' && HOOKS.has(importedName(clause)))));
89
+ }
90
+ return (callee.type === 'MemberExpression' &&
91
+ callee.property.type === 'Identifier' &&
92
+ HOOKS.has(callee.property.name) &&
93
+ (isTestFunction(resolve, callee.object) ||
94
+ isNodeTestNamespace(resolve, callee.object) ||
95
+ isTestContext(resolve, callee.object)));
96
+ }
97
+ /**
98
+ * A lifecycle hook moves arrange or teardown out of the test that needs it:
99
+ * the reader no longer sees the whole test in one place, and state that one
100
+ * test leaves behind reaches the next. A per-test `t.after()` of node:test has
101
+ * the same cost, because the teardown is out of the test's own flow. The rule
102
+ * reads a hook from Vitest, Jest or Mocha globals, from an import (also under
103
+ * another name), from node:test's `test`, `it` or namespace (`test.after`), and
104
+ * from a TestContext: the first parameter of a node:test test or subtest
105
+ * callback, or a parameter typed `TestContext`. A function of the file that is
106
+ * named `after` is not a hook.
107
+ */
108
+ const rule = ESLintUtils.RuleCreator.withoutDocs({
109
+ meta: {
110
+ type: 'problem',
111
+ docs: {
112
+ description: 'Disallow test lifecycle hooks; each test arranges and tears down its own state',
113
+ },
114
+ schema: [],
115
+ messages: {
116
+ matched: 'No test lifecycle hooks. Write self-contained AAA tests: inline arrange in each test and run teardown (cleanup, mock restore, resource stop) in a per-test try/finally or with `await using` a disposable.',
117
+ },
118
+ },
119
+ defaultOptions: [],
120
+ create(context) {
121
+ const resolve = (identifier) => ASTUtils.findVariable(context.sourceCode.getScope(identifier), identifier);
122
+ return {
123
+ CallExpression(node) {
124
+ if (isHook(resolve, node.callee)) {
125
+ context.report({ node, messageId: 'matched' });
126
+ }
127
+ },
128
+ };
129
+ },
8
130
  });
131
+ export default eslintRule(rule);
9
132
  //# sourceMappingURL=no-test-lifecycle-hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-test-lifecycle-hooks.js","sourceRoot":"","sources":["../../src/test-files/no-test-lifecycle-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,gFAAgF;IAClF,SAAS,EAAE;QACT,wFAAwF;KACzF;IACD,OAAO,EACL,yKAAyK;CAC5K,CAAC,CAAC"}
1
+ {"version":3,"file":"no-test-lifecycle-hooks.js","sourceRoot":"","sources":["../../src/test-files/no-test-lifecycle-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,WAAW,GAGZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC;IACpB,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,WAAW;IACX,WAAW;IACX,UAAU;CACX,CAAC,CAAC;AACH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AACnC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAC/C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAMpD,SAAS,YAAY,CACnB,OAAgB,EAChB,IAAmB;IAEnB,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,SAAS,CAAC;IACjD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1C,OA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AC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;YACrC,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;YAC3C,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CACzC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC;IAC/C,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,gFAAgF;SACnF;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,OAAO,EACL,4MAA4M;SAC/M;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAY,CAAC,UAAU,EAAE,EAAE,CACtC,QAAQ,CAAC,YAAY,CACnB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,EACvC,UAAU,CACX,CAAC;QACJ,OAAO;YACL,cAAc,CAAC,IAAI;gBACjB,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACjC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC,IAAI,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/eslint",
3
- "version": "0.3.53",
3
+ "version": "0.3.55",
4
4
  "description": "ESLint rules and configs shared across workspaces. Every check is its own named rule, so a repo's own config cannot silently erase it.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -56,7 +56,7 @@
56
56
  "ts-api-utils": "^2.5.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@zukhruf/testing": "^0.3.53"
59
+ "@zukhruf/testing": "^0.3.55"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@eslint/js": "^9.30.0 || ^10.0.0",