@zukhruf/eslint 0.3.41 → 0.3.43

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 (84) hide show
  1. package/README.md +34 -15
  2. package/dist/async-values/no-promise-field.d.ts.map +1 -1
  3. package/dist/async-values/no-promise-field.js +5 -3
  4. package/dist/async-values/no-promise-field.js.map +1 -1
  5. package/dist/base/config.d.ts.map +1 -1
  6. package/dist/base/config.js +11 -2
  7. package/dist/base/config.js.map +1 -1
  8. package/dist/base/options.d.ts +4 -3
  9. package/dist/base/options.d.ts.map +1 -1
  10. package/dist/base/options.js.map +1 -1
  11. package/dist/diagnostics/config.js +2 -2
  12. package/dist/diagnostics/config.js.map +1 -1
  13. package/dist/environment/config.d.ts +1 -0
  14. package/dist/environment/config.d.ts.map +1 -1
  15. package/dist/environment/config.js +4 -2
  16. package/dist/environment/config.js.map +1 -1
  17. package/dist/environment/no-undeclared-process-env.d.ts.map +1 -1
  18. package/dist/environment/no-undeclared-process-env.js +19 -18
  19. package/dist/environment/no-undeclared-process-env.js.map +1 -1
  20. package/dist/files.d.ts +3 -0
  21. package/dist/files.d.ts.map +1 -1
  22. package/dist/files.js +3 -0
  23. package/dist/files.js.map +1 -1
  24. package/dist/hermes/plugin.d.ts.map +1 -1
  25. package/dist/hermes/plugin.js +2 -2
  26. package/dist/hermes/plugin.js.map +1 -1
  27. package/dist/hono/config.js +2 -2
  28. package/dist/hono/config.js.map +1 -1
  29. package/dist/imports/no-test-file-import.d.ts +9 -0
  30. package/dist/imports/no-test-file-import.d.ts.map +1 -0
  31. package/dist/imports/no-test-file-import.js +21 -0
  32. package/dist/imports/no-test-file-import.js.map +1 -0
  33. package/dist/index.d.ts +2 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/island/plugin.d.ts.map +1 -1
  38. package/dist/island/plugin.js +3 -3
  39. package/dist/island/plugin.js.map +1 -1
  40. package/dist/manifest/manifest-policy.d.ts +3 -2
  41. package/dist/manifest/manifest-policy.d.ts.map +1 -1
  42. package/dist/manifest/manifest-policy.js +10 -3
  43. package/dist/manifest/manifest-policy.js.map +1 -1
  44. package/dist/manifest/project-build.d.ts +7 -5
  45. package/dist/manifest/project-build.d.ts.map +1 -1
  46. package/dist/manifest/project-build.js +11 -5
  47. package/dist/manifest/project-build.js.map +1 -1
  48. package/dist/manifest/test-support.d.ts +10 -0
  49. package/dist/manifest/test-support.d.ts.map +1 -0
  50. package/dist/manifest/test-support.js +52 -0
  51. package/dist/manifest/test-support.js.map +1 -0
  52. package/dist/packaged-app/config.js +2 -2
  53. package/dist/packaged-app/config.js.map +1 -1
  54. package/dist/react-router/config.d.ts.map +1 -1
  55. package/dist/react-router/config.js +16 -2
  56. package/dist/react-router/config.js.map +1 -1
  57. package/dist/react-router/options.d.ts +10 -0
  58. package/dist/react-router/options.d.ts.map +1 -0
  59. package/dist/react-router/options.js +13 -0
  60. package/dist/react-router/options.js.map +1 -0
  61. package/dist/test-files/config.d.ts.map +1 -1
  62. package/dist/test-files/config.js +15 -4
  63. package/dist/test-files/config.js.map +1 -1
  64. package/dist/test-files/no-catch-all-msw-handler.d.ts +10 -0
  65. package/dist/test-files/no-catch-all-msw-handler.d.ts.map +1 -0
  66. package/dist/test-files/no-catch-all-msw-handler.js +16 -0
  67. package/dist/test-files/no-catch-all-msw-handler.js.map +1 -0
  68. package/dist/test-files/no-direct-msw-server.d.ts +12 -0
  69. package/dist/test-files/no-direct-msw-server.d.ts.map +1 -0
  70. package/dist/test-files/no-direct-msw-server.js +67 -0
  71. package/dist/test-files/no-direct-msw-server.js.map +1 -0
  72. package/dist/test-files/no-process-env-write.d.ts +10 -0
  73. package/dist/test-files/no-process-env-write.d.ts.map +1 -0
  74. package/dist/test-files/no-process-env-write.js +21 -0
  75. package/dist/test-files/no-process-env-write.js.map +1 -0
  76. package/dist/test-files/no-timer-race.d.ts +13 -0
  77. package/dist/test-files/no-timer-race.d.ts.map +1 -0
  78. package/dist/test-files/no-timer-race.js +144 -0
  79. package/dist/test-files/no-timer-race.js.map +1 -0
  80. package/package.json +1 -1
  81. package/dist/test-files/require-msw-error-on-unhandled-request.d.ts +0 -11
  82. package/dist/test-files/require-msw-error-on-unhandled-request.d.ts.map +0 -1
  83. package/dist/test-files/require-msw-error-on-unhandled-request.js +0 -17
  84. package/dist/test-files/require-msw-error-on-unhandled-request.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/island/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAmC7C;;;;;;;GAOG;AACH,QAAA,MAAM,MAAM;;;;;;;;;;;;;CAIa,CAAC;AAkC1B,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/island/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAoC7C;;;;;;;GAOG;AACH,QAAA,MAAM,MAAM;;;;;;;;;;;;;CAIa,CAAC;AAkC1B,eAAe,MAAM,CAAC"}
@@ -3,7 +3,7 @@ import * as jsonc from 'jsonc-eslint-parser';
3
3
  import tseslint from 'typescript-eslint';
4
4
  import { ruleOf } from "../authoring/rule-module.js";
5
5
  import { scopedRule } from "../authoring/scoped-rule.js";
6
- import { CONFIG_FILES, PACKAGE_JSON, SCRIPTS, TESTS, TYPESCRIPT, } from "../files.js";
6
+ import { CONFIG_FILES, PACKAGE_JSON, SCRIPTS, TESTS, TEST_SUPPORT, TYPESCRIPT, } from "../files.js";
7
7
  import { dependencyPolicy } from "../nx-policy/dependency-policy.js";
8
8
  import { inIsland, inLibrary } from "./island-scope.js";
9
9
  import noConsole from "./no-console.js";
@@ -38,7 +38,7 @@ configs['recommended'] = [
38
38
  {
39
39
  name: 'island/recommended/ports',
40
40
  files: TYPESCRIPT,
41
- ignores: TESTS,
41
+ ignores: [...TESTS, ...TEST_SUPPORT],
42
42
  plugins,
43
43
  rules: {
44
44
  'island/no-generic-port': 'error',
@@ -48,7 +48,7 @@ configs['recommended'] = [
48
48
  {
49
49
  name: 'island/recommended/library',
50
50
  files: TYPESCRIPT,
51
- ignores: [...TESTS, ...SCRIPTS, ...CONFIG_FILES],
51
+ ignores: [...TESTS, ...TEST_SUPPORT, ...SCRIPTS, ...CONFIG_FILES],
52
52
  plugins,
53
53
  rules: {
54
54
  'island/no-process-env': 'error',
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/island/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEnC,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAC7C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,KAAK,EACL,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAE/C,0EAA0E;AAC1E,iFAAiF;AACjF,wEAAwE;AACxE,MAAM,KAAK,GAAG;IACZ,iBAAiB,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,CAAC;IACtD,iBAAiB,EAAE,UAAU,CAC3B,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAC1C,QAAQ,CACT;IACD,mBAAmB,EAAE,UAAU,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Aa,CAAC,GAAG;IACvB;QACE,IAAI,EAAE,0BAA0B;QAChC,KAAK,EAAE,UAAU;QACjB,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,YAAY,CAAC;QACpC,OAAO;QACP,KAAK,EAAE;YACL,wBAAwB,EAAE,OAAO;YACjC,wBAAwB,EAAE,OAAO;SAClC;KACF;IACD;QACE,IAAI,EAAE,4BAA4B;QAClC,KAAK,EAAE,UAAU;QACjB,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,EAAE,GAAG,YAAY,CAAC;QACjE,OAAO;QACP,KAAK,EAAE;YACL,uBAAuB,EAAE,OAAO;YAChC,mBAAmB,EAAE,OAAO;SAC7B;KACF;IACD;QACE,IAAI,EAAE,iCAAiC;QACvC,KAAK,EAAE,YAAY;QACnB,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QAClC,OAAO;QACP,KAAK,EAAE,EAAE,0BAA0B,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC,EAAE;KACrE;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -13,9 +13,10 @@ export interface ManifestPolicyOptions extends Omit<DependencyPolicyOptions, 'in
13
13
  * The complete `@nx/dependency-checks` options for `project`: the shared
14
14
  * policy, the repo's entries, the project's own extras, and what its shape
15
15
  * demands. A bundled project declares the npm packages its workspace imports
16
- * pull in. No project declares the workspace packages its build inlines.
16
+ * pull in. No project declares the workspace packages its build inlines, or
17
+ * what a `testing/` folder that its manifest does not publish imports.
17
18
  */
18
- export declare function manifestPolicy(graph: ProjectGraph, project: ProjectGraphProjectNode, { projects, ignoredDependencies, ...options }?: ManifestPolicyOptions): {
19
+ export declare function manifestPolicy(graph: ProjectGraph, project: ProjectGraphProjectNode, { projects, ignoredDependencies, ignoredFiles, ...options }?: ManifestPolicyOptions): {
19
20
  ignoredFiles: string[];
20
21
  ignoredDependencies: string[];
21
22
  includeTransitiveDependencies: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-policy.d.ts","sourceRoot":"","sources":["../../src/manifest/manifest-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAExE,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,mCAAmC,CAAC;AAG3C,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,8FAA8F;AAC9F,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,uBAAuB,EACvB,+BAA+B,CAChC;IACC,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,uBAAuB,EAChC,EACE,QAAa,EACb,mBAAwB,EACxB,GAAG,OAAO,EACX,GAAE,qBAA0B;;;;;;;;EAY9B"}
1
+ {"version":3,"file":"manifest-policy.d.ts","sourceRoot":"","sources":["../../src/manifest/manifest-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAExE,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,mCAAmC,CAAC;AAI3C,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,8FAA8F;AAC9F,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,uBAAuB,EACvB,+BAA+B,CAChC;IACC,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,uBAAuB,EAChC,EACE,QAAa,EACb,mBAAwB,EACxB,YAAiB,EACjB,GAAG,OAAO,EACX,GAAE,qBAA0B;;;;;;;;EAiB9B"}
@@ -1,16 +1,23 @@
1
1
  import { dependencyPolicy, } from "../nx-policy/dependency-policy.js";
2
2
  import { ProjectBuild } from "./project-build.js";
3
+ import { testSupportFiles } from "./test-support.js";
3
4
  /**
4
5
  * The complete `@nx/dependency-checks` options for `project`: the shared
5
6
  * policy, the repo's entries, the project's own extras, and what its shape
6
7
  * demands. A bundled project declares the npm packages its workspace imports
7
- * pull in. No project declares the workspace packages its build inlines.
8
+ * pull in. No project declares the workspace packages its build inlines, or
9
+ * what a `testing/` folder that its manifest does not publish imports.
8
10
  */
9
- export function manifestPolicy(graph, project, { projects = {}, ignoredDependencies = [], ...options } = {}) {
11
+ export function manifestPolicy(graph, project, { projects = {}, ignoredDependencies = [], ignoredFiles = [], ...options } = {}) {
10
12
  const build = new ProjectBuild(graph, project);
13
+ const bundled = build.shape === 'bundled';
11
14
  return dependencyPolicy({
12
15
  ...options,
13
- includeTransitiveDependencies: build.shape === 'bundled',
16
+ includeTransitiveDependencies: bundled,
17
+ ignoredFiles: [
18
+ ...testSupportFiles(graph, project, bundled),
19
+ ...ignoredFiles,
20
+ ],
14
21
  ignoredDependencies: [
15
22
  ...build.inlined,
16
23
  ...ignoredDependencies,
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-policy.js","sourceRoot":"","sources":["../../src/manifest/manifest-policy.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgBlD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAmB,EACnB,OAAgC,EAChC,EACE,QAAQ,GAAG,EAAE,EACb,mBAAmB,GAAG,EAAE,EACxB,GAAG,OAAO,KACe,EAAE;IAE7B,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC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SAC5D;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -14,11 +14,13 @@ export type ProjectShape = 'bundled' | 'unbundled';
14
14
  * as Nx resolves it: project.json, the target defaults in nx.json, and the
15
15
  * targets that Nx plugins infer.
16
16
  *
17
- * An application bundles unless its build is `nx:noop` (it ships what other
18
- * projects built), esbuild with `bundle: false` (it transpiles file by file),
19
- * or esbuild that leaves a workspace package it imports to node_modules (it
20
- * installs that package, and inlines only the others). esbuild bundles by
21
- * default.
17
+ * An application bundles unless its build compiles with tsc (it emits file by
18
+ * file and keeps each import), as `@nx/js:tsc` or the `tsc --build` target
19
+ * that the `@nx/js/typescript` plugin infers, is `nx:noop` (it ships what
20
+ * other projects built), esbuild with `bundle: false` (it transpiles file by
21
+ * file), or esbuild that leaves a workspace package it imports to
22
+ * node_modules (it installs that package, and inlines only the others).
23
+ * esbuild bundles by default.
22
24
  */
23
25
  export declare class ProjectBuild {
24
26
  readonly shape: ProjectShape;
@@ -1 +1 @@
1
- {"version":3,"file":"project-build.d.ts","sourceRoot":"","sources":["../../src/manifest/project-build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAKxE;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,CAAC;AA4BnD;;;;;;;;;;GAUG;AACH,qBAAa,YAAY;IACvB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;gBAExB,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,uBAAuB;CAyBlE"}
1
+ {"version":3,"file":"project-build.d.ts","sourceRoot":"","sources":["../../src/manifest/project-build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAKxE;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,CAAC;AA4BnD;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAY;IACvB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;gBAExB,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,uBAAuB;CA8BlE"}
@@ -29,11 +29,13 @@ function matchesExternal(name, pattern) {
29
29
  * as Nx resolves it: project.json, the target defaults in nx.json, and the
30
30
  * targets that Nx plugins infer.
31
31
  *
32
- * An application bundles unless its build is `nx:noop` (it ships what other
33
- * projects built), esbuild with `bundle: false` (it transpiles file by file),
34
- * or esbuild that leaves a workspace package it imports to node_modules (it
35
- * installs that package, and inlines only the others). esbuild bundles by
36
- * default.
32
+ * An application bundles unless its build compiles with tsc (it emits file by
33
+ * file and keeps each import), as `@nx/js:tsc` or the `tsc --build` target
34
+ * that the `@nx/js/typescript` plugin infers, is `nx:noop` (it ships what
35
+ * other projects built), esbuild with `bundle: false` (it transpiles file by
36
+ * file), or esbuild that leaves a workspace package it imports to
37
+ * node_modules (it installs that package, and inlines only the others).
38
+ * esbuild bundles by default.
37
39
  */
38
40
  export class ProjectBuild {
39
41
  shape;
@@ -42,7 +44,11 @@ export class ProjectBuild {
42
44
  constructor(graph, project) {
43
45
  const build = project.data.targets?.['build'];
44
46
  const esbuild = build?.executor?.includes('esbuild') === true;
47
+ const typescript = build?.executor === '@nx/js:tsc' ||
48
+ (build?.executor === 'nx:run-commands' &&
49
+ build.metadata?.technologies?.includes('typescript') === true);
45
50
  if (project.data.projectType !== 'application' ||
51
+ typescript ||
46
52
  build?.executor === 'nx:noop' ||
47
53
  (esbuild && build?.options?.bundle === false)) {
48
54
  this.shape = 'unbundled';
@@ -1 +1 @@
1
- {"version":3,"file":"project-build.js","sourceRoot":"","sources":["../../src/manifest/project-build.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ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,EAAE,OAAO,CAAC,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;YACrE,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACvC,MAAM,IAAI,GAAG,UAAU,IAAI,oBAAoB,CAAC,UAAU,CAAC,CAAC;YAC5D,OAAO,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;aACtC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aACnD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { type ProjectGraph, type ProjectGraphProjectNode } from '@nx/devkit';
2
+ /**
3
+ * The `testing/` folders that hold test support, as `ignoredFiles` globs. A
4
+ * `testing/` folder is test support unless its project's manifest publishes it,
5
+ * because a package can ship a testing subpath for its consumers. The globs
6
+ * are relative to the workspace root, not `{projectRoot}`, because Nx applies
7
+ * one `ignoredFiles` list to every project a bundled app inlines.
8
+ */
9
+ export declare function testSupportFiles(graph: ProjectGraph, project: ProjectGraphProjectNode, bundled: boolean): string[];
10
+ //# sourceMappingURL=test-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../../src/manifest/test-support.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAE7B,MAAM,YAAY,CAAC;AA+CpB;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,OAAO,GACf,MAAM,EAAE,CASV"}
@@ -0,0 +1,52 @@
1
+ import { join, posix } from 'node:path';
2
+ import { workspaceRoot, } from '@nx/devkit';
3
+ import { isRecord, stringsAt } from "../unknown-values.js";
4
+ import { readJson } from "../workspace/project-manifest.js";
5
+ /** The file paths a manifest's `exports` maps to, in any of its forms. */
6
+ function exportTargets(exports) {
7
+ if (typeof exports === 'string')
8
+ return [exports];
9
+ if (Array.isArray(exports))
10
+ return exports.flatMap(exportTargets);
11
+ return isRecord(exports) ? Object.values(exports).flatMap(exportTargets) : [];
12
+ }
13
+ /**
14
+ * Whether the manifest publishes a `testing/` folder: an `exports` target or
15
+ * a `files` entry names a `testing` segment, or an `exports` target has a
16
+ * `*`, which can reach any folder.
17
+ */
18
+ function publishesTesting(manifest) {
19
+ const exports = isRecord(manifest) ? exportTargets(manifest['exports']) : [];
20
+ return (exports.some((path) => path.includes('*')) ||
21
+ [...exports, ...stringsAt(manifest, 'files')].some((path) => path.split('/').includes('testing')));
22
+ }
23
+ /** `project` and, when its build inlines them, the workspace projects it imports, transitively. */
24
+ function checkedProjects(graph, project, bundled) {
25
+ const seen = new Map([[project.name, project]]);
26
+ if (!bundled)
27
+ return [...seen.values()];
28
+ const visit = (name) => {
29
+ for (const { target } of graph.dependencies[name] ?? []) {
30
+ const node = graph.nodes[target];
31
+ if (!node || seen.has(target))
32
+ continue;
33
+ seen.set(target, node);
34
+ visit(target);
35
+ }
36
+ };
37
+ visit(project.name);
38
+ return [...seen.values()];
39
+ }
40
+ /**
41
+ * The `testing/` folders that hold test support, as `ignoredFiles` globs. A
42
+ * `testing/` folder is test support unless its project's manifest publishes it,
43
+ * because a package can ship a testing subpath for its consumers. The globs
44
+ * are relative to the workspace root, not `{projectRoot}`, because Nx applies
45
+ * one `ignoredFiles` list to every project a bundled app inlines.
46
+ */
47
+ export function testSupportFiles(graph, project, bundled) {
48
+ return checkedProjects(graph, project, bundled)
49
+ .filter(({ data }) => !publishesTesting(readJson(join(workspaceRoot, data.root, 'package.json'))))
50
+ .map(({ data }) => posix.join(data.root, '**/testing/**'));
51
+ }
52
+ //# sourceMappingURL=test-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-support.js","sourceRoot":"","sources":["../../src/manifest/test-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAGL,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,0EAA0E;AAC1E,SAAS,aAAa,CAAC,OAAgB;IACrC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAClE,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChF,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,QAAiB;IACzC,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7E,OAAO,CACL,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,C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CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CACX,CAAC,gBAAgB,CACf,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CACzD,CACJ;SACA,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;AAC/D,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { enable } from "../concept.js";
2
- import { TESTS, TYPESCRIPT } from "../files.js";
2
+ import { TESTS, TEST_SUPPORT, TYPESCRIPT } from "../files.js";
3
3
  import noBareSpawn from "./no-bare-spawn.js";
4
4
  const rules = { 'no-bare-spawn': noBareSpawn };
5
5
  /** An app installed and launched outside a terminal, which gets the OS's minimal PATH. */
@@ -10,7 +10,7 @@ export const packagedApp = {
10
10
  {
11
11
  name: 'zukhruf/packaged-app',
12
12
  files: TYPESCRIPT,
13
- ignores: TESTS,
13
+ ignores: [...TESTS, ...TEST_SUPPORT],
14
14
  plugins,
15
15
  rules: enable(rules),
16
16
  },
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/packaged-app/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,MAAM,KAAK,GAAG,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC;AAE/C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,WAAW,GAAY;IAClC,IAAI,EAAE,cAAc;IACpB,KAAK;IACL,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACnB;YACE,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;YACd,OAAO;YACP,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;SACrB;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/packaged-app/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,MAAM,KAAK,GAAG,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC;AAE/C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,WAAW,GAAY;IAClC,IAAI,EAAE,cAAc;IACpB,KAAK;IACL,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACnB;YACE,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,YAAY,CAAC;YACpC,OAAO;YACP,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;SACrB;KACF;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/react-router/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,eAAe,CAAC;AAYrD,eAAO,MAAM,WAAW,EAAE,OAsBzB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/react-router/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,eAAe,CAAC;AAarD,eAAO,MAAM,WAAW,EAAE,OAmCzB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { enable } from "../concept.js";
2
- import { SOURCE, TESTS } from "../files.js";
2
+ import { SOURCE, TESTS, TEST_SUPPORT, TYPESCRIPT } from "../files.js";
3
3
  import noInternalAnchor from "./no-internal-anchor.js";
4
4
  import noRawRoutePath from "./no-raw-route-path.js";
5
+ import { reactRouterOnlyThrowError } from "./options.js";
5
6
  import requireLoaderDataTypeArgument from "./require-loader-data-type-argument.js";
6
7
  const rules = {
7
8
  'require-loader-data-type-argument': requireLoaderDataTypeArgument,
@@ -22,13 +23,26 @@ export const reactRouter = {
22
23
  // A test renders links to whatever path it sets up.
23
24
  name: 'zukhruf/react-router/links',
24
25
  files: SOURCE,
25
- ignores: TESTS,
26
+ ignores: [...TESTS, ...TEST_SUPPORT],
26
27
  plugins,
27
28
  rules: enable({
28
29
  'no-raw-route-path': noRawRoutePath,
29
30
  'no-internal-anchor': noInternalAnchor,
30
31
  }),
31
32
  },
33
+ {
34
+ // `base` turns the rule on with no allow list. Loader helpers live
35
+ // outside the route modules, so the allow list covers every file of
36
+ // this config, not only a routes folder.
37
+ name: 'zukhruf/react-router/throws',
38
+ files: TYPESCRIPT,
39
+ rules: {
40
+ '@typescript-eslint/only-throw-error': [
41
+ 'error',
42
+ reactRouterOnlyThrowError(),
43
+ ],
44
+ },
45
+ },
32
46
  ],
33
47
  };
34
48
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/react-router/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,6BAA6B,MAAM,wCAAwC,CAAC;AAEnF,MAAM,KAAK,GAAG;IACZ,mCAAmC,EAAE,6BAA6B;IAClE,mBAAmB,EAAE,cAAc;IACnC,oBAAoB,EAAE,gBAAgB;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAY;IAClC,IAAI,EAAE,cAAc;IACpB,KAAK;IACL,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACnB;YACE,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,MAAM;YACb,OAAO;YACP,KAAK,EAAE,EAAE,2CAA2C,EAAE,OAAO,EAAE;SAChE;QACD;YACE,oDAAoD;YACpD,IAAI,EAAE,4BAA4B;YAClC,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,KAAK;YACd,OAAO;YACP,KAAK,EAAE,MAAM,CAAC;gBACZ,mBAAmB,EAAE,cAAc;gBACnC,oBAAoB,EAAE,gBAAgB;aACvC,CAAC;SACH;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/react-router/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,6BAA6B,MAAM,wCAAwC,CAAC;AAEnF,MAAM,KAAK,GAAG;IACZ,mCAAmC,EAAE,6BAA6B;IAClE,mBAAmB,EAAE,cAAc;IACnC,oBAAoB,EAAE,gBAAgB;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAY;IAClC,IAAI,EAAE,cAAc;IACpB,KAAK;IACL,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACnB;YACE,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,MAAM;YACb,OAAO;YACP,KAAK,EAAE,EAAE,2CAA2C,EAAE,OAAO,EAAE;SAChE;QACD;YACE,oDAAoD;YACpD,IAAI,EAAE,4BAA4B;YAClC,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,YAAY,CAAC;YACpC,OAAO;YACP,KAAK,EAAE,MAAM,CAAC;gBACZ,mBAAmB,EAAE,cAAc;gBACnC,oBAAoB,EAAE,gBAAgB;aACvC,CAAC;SACH;QACD;YACE,mEAAmE;YACnE,oEAAoE;YACpE,yCAAyC;YACzC,IAAI,EAAE,6BAA6B;YACnC,KAAK,EAAE,UAAU;YACjB,KAAK,EAAE;gBACL,qCAAqC,EAAE;oBACrC,OAAO;oBACP,yBAAyB,EAAE;iBAC5B;aACF;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { TypeOrValueSpecifier } from '../base/options.ts';
2
+ export interface ReactRouterOnlyThrowErrorOptions {
3
+ /** More types that a react-router file may throw. */
4
+ allow?: TypeOrValueSpecifier[];
5
+ }
6
+ /** Options for `@typescript-eslint/only-throw-error` in react-router files, with React Router's thrown types already allowed. */
7
+ export declare function reactRouterOnlyThrowError({ allow, }?: ReactRouterOnlyThrowErrorOptions): {
8
+ allow: TypeOrValueSpecifier[];
9
+ };
10
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/react-router/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,gCAAgC;IAC/C,qDAAqD;IACrD,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAWD,iIAAiI;AACjI,wBAAgB,yBAAyB,CAAC,EACxC,KAAU,GACX,GAAE,gCAAqC;;EAEvC"}
@@ -0,0 +1,13 @@
1
+ // A loader or an action throws `redirect()`, `replace()` (a Response) or
2
+ // `data()` (a DataWithResponseInit) to stop and answer at once. React Router
3
+ // catches the thrown value and renders it, so it is not an error that loses
4
+ // its stack.
5
+ const ROUTER_THROWS = [
6
+ { from: 'lib', name: 'Response' },
7
+ { from: 'package', package: 'react-router', name: 'DataWithResponseInit' },
8
+ ];
9
+ /** Options for `@typescript-eslint/only-throw-error` in react-router files, with React Router's thrown types already allowed. */
10
+ export function reactRouterOnlyThrowError({ allow = [], } = {}) {
11
+ return { allow: [...ROUTER_THROWS, ...allow] };
12
+ }
13
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/react-router/options.ts"],"names":[],"mappings":"AAOA,yEAAyE;AACzE,6EAA6E;AAC7E,4EAA4E;AAC5E,aAAa;AACb,MAAM,aAAa,GAA2B;IAC5C,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE;IACjC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,sBAAsB,EAAE;CAC3E,CAAC;AAEF,iIAAiI;AACjI,MAAM,UAAU,yBAAyB,CAAC,EACxC,KAAK,GAAG,EAAE,MAC0B,EAAE;IACtC,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,aAAa,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AACjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/test-files/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,eAAe,CAAC;AAUrD,eAAO,MAAM,KAAK,EAAE,OAMnB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/test-files/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,eAAe,CAAC;AAgBrD,eAAO,MAAM,KAAK,EAAE,OAWnB,CAAC"}
@@ -1,16 +1,27 @@
1
1
  import { enable } from "../concept.js";
2
- import { TESTS } from "../files.js";
2
+ import { TESTS, TEST_SUPPORT } from "../files.js";
3
+ import noCatchAllMswHandler from "./no-catch-all-msw-handler.js";
4
+ import noDirectMswServer from "./no-direct-msw-server.js";
5
+ import noProcessEnvWrite from "./no-process-env-write.js";
3
6
  import noTestLifecycleHooks from "./no-test-lifecycle-hooks.js";
4
- import requireMswErrorOnUnhandledRequest from "./require-msw-error-on-unhandled-request.js";
7
+ import noTimerRace from "./no-timer-race.js";
5
8
  const rules = {
6
9
  'no-test-lifecycle-hooks': noTestLifecycleHooks,
7
- 'require-msw-error-on-unhandled-request': requireMswErrorOnUnhandledRequest,
10
+ 'no-process-env-write': noProcessEnvWrite,
11
+ 'no-direct-msw-server': noDirectMswServer,
12
+ 'no-catch-all-msw-handler': noCatchAllMswHandler,
13
+ 'no-timer-race': noTimerRace,
8
14
  };
9
15
  export const tests = {
10
16
  name: 'tests',
11
17
  rules,
12
18
  config: (plugins) => [
13
- { name: 'zukhruf/tests', files: TESTS, plugins, rules: enable(rules) },
19
+ {
20
+ name: 'zukhruf/tests',
21
+ files: [...TESTS, ...TEST_SUPPORT],
22
+ plugins,
23
+ rules: enable(rules),
24
+ },
14
25
  ],
15
26
  };
16
27
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/test-files/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,iCAAiC,MAAM,6CAA6C,CAAC;AAE5F,MAAM,KAAK,GAAG;IACZ,yBAAyB,EAAE,oBAAoB;IAC/C,wCAAwC,EAAE,iCAAiC;CAC5E,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAY;IAC5B,IAAI,EAAE,OAAO;IACb,KAAK;IACL,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACnB,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;KACvE;CACF,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/test-files/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,MAAM,KAAK,GAAG;IACZ,yBAAyB,EAAE,oBAAoB;IAC/C,sBAAsB,EAAE,iBAAiB;IACzC,sBAAsB,EAAE,iBAAiB;IACzC,0BAA0B,EAAE,oBAAoB;IAChD,eAAe,EAAE,WAAW;CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAY;IAC5B,IAAI,EAAE,OAAO;IACb,KAAK;IACL,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACnB;YACE,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,YAAY,CAAC;YAClC,OAAO;YACP,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;SACrB;KACF;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * msw 3 sends a request that no handler matches to the network unless the
3
+ * strategy is strict, and a request that a catch-all handler matches but does
4
+ * not answer goes to the network too. So `http.all('*', () => {})` turns the
5
+ * strict strategy off for every origin. Scoped to a file that imports msw; a
6
+ * handler made with a `RegExp` built at run time is not seen.
7
+ */
8
+ declare const _default: import("eslint").Rule.RuleModule;
9
+ export default _default;
10
+ //# sourceMappingURL=no-catch-all-msw-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-catch-all-msw-handler.d.ts","sourceRoot":"","sources":["../../src/test-files/no-catch-all-msw-handler.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;;AACH,wBAQG"}
@@ -0,0 +1,16 @@
1
+ import { selectorRule } from "../authoring/selector-rule.js";
2
+ /**
3
+ * msw 3 sends a request that no handler matches to the network unless the
4
+ * strategy is strict, and a request that a catch-all handler matches but does
5
+ * not answer goes to the network too. So `http.all('*', () => {})` turns the
6
+ * strict strategy off for every origin. Scoped to a file that imports msw; a
7
+ * handler made with a `RegExp` built at run time is not seen.
8
+ */
9
+ export default selectorRule({
10
+ description: 'Disallow an msw handler that matches every request; match the origin',
11
+ selectors: [
12
+ 'Program:has(ImportDeclaration[source.value="msw"]) CallExpression[callee.object.name="http"]:matches([arguments.0.value="*"], [arguments.0.regex.pattern=/^\\^?\\.[*+]\\$?$/])',
13
+ ],
14
+ message: 'A catch-all handler that returns nothing sends unmatched requests to the network and turns the strict strategy off (msw 3). Match the origin: http.all(`${origin}/*`, () => passthrough()).',
15
+ });
16
+ //# sourceMappingURL=no-catch-all-msw-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-catch-all-msw-handler.js","sourceRoot":"","sources":["../../src/test-files/no-catch-all-msw-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;;;;GAMG;AACH,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,sEAAsE;IACxE,SAAS,EAAE;QACT,gLAAgL;KACjL;IACD,OAAO,EACL,6LAA6L;CAChM,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Rule } from 'eslint';
2
+ /**
3
+ * A server from msw's own `setupServer` sends an unmatched request to the
4
+ * network unless the test passes the strict option, keeps no record of what it
5
+ * answered, and stays open when a test forgets `close()`. `Msw` of
6
+ * `@zukhruf/testing/msw` is always strict, records each request, and closes at
7
+ * scope end. The rule follows the binding that `msw/node` exports, aliased or
8
+ * through a namespace, so a `setupServer` from another module is not reported.
9
+ */
10
+ declare const rule: Rule.RuleModule;
11
+ export default rule;
12
+ //# sourceMappingURL=no-direct-msw-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-direct-msw-server.d.ts","sourceRoot":"","sources":["../../src/test-files/no-direct-msw-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,QAAQ,CAAC;AA6B1C;;;;;;;GAOG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAmChB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { identifierName, isAstNode, isType } from "../authoring/ast.js";
2
+ const parentOf = (node) => isAstNode(node) ? node['parent'] : undefined;
3
+ /**
4
+ * The calls that the references to `variable` make: `setupServer()`, or
5
+ * `namespace.setupServer()` when the variable is the module namespace.
6
+ */
7
+ function callsOf(variable, member) {
8
+ return variable.references.flatMap(({ identifier }) => {
9
+ const access = parentOf(identifier);
10
+ const callee = member === undefined
11
+ ? identifier
12
+ : isType(access, 'MemberExpression') &&
13
+ access['computed'] === false &&
14
+ identifierName(access['property']) === member
15
+ ? access
16
+ : undefined;
17
+ const call = parentOf(callee);
18
+ return isType(call, 'CallExpression') && call['callee'] === callee
19
+ ? [call]
20
+ : [];
21
+ });
22
+ }
23
+ /**
24
+ * A server from msw's own `setupServer` sends an unmatched request to the
25
+ * network unless the test passes the strict option, keeps no record of what it
26
+ * answered, and stays open when a test forgets `close()`. `Msw` of
27
+ * `@zukhruf/testing/msw` is always strict, records each request, and closes at
28
+ * scope end. The rule follows the binding that `msw/node` exports, aliased or
29
+ * through a namespace, so a `setupServer` from another module is not reported.
30
+ */
31
+ const rule = {
32
+ meta: {
33
+ type: 'problem',
34
+ docs: {
35
+ description: "Disallow msw's setupServer in tests; use Msw from @zukhruf/testing/msw",
36
+ },
37
+ schema: [],
38
+ messages: {
39
+ direct: 'Use `new Msw().intercept(...handlers)` from @zukhruf/testing/msw: it is always strict, records each request, and closes at scope end.',
40
+ },
41
+ },
42
+ create(context) {
43
+ return {
44
+ ImportDeclaration(node) {
45
+ if (node.source.value !== 'msw/node')
46
+ return;
47
+ for (const specifier of node.specifiers) {
48
+ const [variable] = context.sourceCode.getDeclaredVariables(specifier);
49
+ if (variable === undefined)
50
+ continue;
51
+ const calls = specifier.type === 'ImportNamespaceSpecifier'
52
+ ? callsOf(variable, 'setupServer')
53
+ : specifier.type === 'ImportSpecifier' &&
54
+ specifier.imported.type === 'Identifier' &&
55
+ specifier.imported.name === 'setupServer'
56
+ ? callsOf(variable)
57
+ : [];
58
+ for (const call of calls) {
59
+ context.report({ node: call, messageId: 'direct' });
60
+ }
61
+ }
62
+ },
63
+ };
64
+ },
65
+ };
66
+ export default rule;
67
+ //# sourceMappingURL=no-direct-msw-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-direct-msw-server.js","sourceRoot":"","sources":["../../src/test-files/no-direct-msw-server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,QAAQ,GAAG,CAAC,IAAa,EAAE,EAAE,CACjC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAE/C;;;GAGG;AACH,SAAS,OAAO,CAAC,QAAwB,EAAE,MAAe;IACxD,OAAO,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;QACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;QACpC,MAAM,MAAM,GACV,MAAM,KAAK,SAAS;YAClB,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAChC,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK;gBAC5B,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,MAAM;gBAC/C,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,SAAS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AAI,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;oBACtD,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Tests run concurrently, and `process.env` is one object for the whole
3
+ * process: a test that sets a variable changes it for every test that runs at
4
+ * the same time, and a restore in `finally` cannot undo what the others read
5
+ * meanwhile. Reads and copies (`{ ...process.env, X: '1' }` for a child
6
+ * process) stay allowed.
7
+ */
8
+ declare const _default: import("eslint").Rule.RuleModule;
9
+ export default _default;
10
+ //# sourceMappingURL=no-process-env-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-process-env-write.d.ts","sourceRoot":"","sources":["../../src/test-files/no-process-env-write.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;;AACH,wBAWG"}
@@ -0,0 +1,21 @@
1
+ import { selectorRule } from "../authoring/selector-rule.js";
2
+ const PROCESS_ENV = '[object.name="process"][property.name="env"]';
3
+ /**
4
+ * Tests run concurrently, and `process.env` is one object for the whole
5
+ * process: a test that sets a variable changes it for every test that runs at
6
+ * the same time, and a restore in `finally` cannot undo what the others read
7
+ * meanwhile. Reads and copies (`{ ...process.env, X: '1' }` for a child
8
+ * process) stay allowed.
9
+ */
10
+ export default selectorRule({
11
+ description: 'Disallow a test that changes process.env',
12
+ selectors: [
13
+ `AssignmentExpression[left.object.object.name="process"][left.object.property.name="env"]`,
14
+ `AssignmentExpression > MemberExpression.left${PROCESS_ENV}`,
15
+ `UnaryExpression[operator="delete"][argument.object.object.name="process"][argument.object.property.name="env"]`,
16
+ `CallExpression[callee.object.name="Object"][callee.property.name=/^(assign|defineProperty|defineProperties)$/] > MemberExpression.arguments:first-child${PROCESS_ENV}`,
17
+ 'CallExpression[callee.object.name="vi"][callee.property.name="stubEnv"]',
18
+ ],
19
+ message: 'Tests run concurrently, and process.env is one object for the whole process. Pass the environment (or the value) to the code under test, or give a child process its own env.',
20
+ });
21
+ //# sourceMappingURL=no-process-env-write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-process-env-write.js","sourceRoot":"","sources":["../../src/test-files/no-process-env-write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,WAAW,GAAG,8CAA8C,CAAC;AAEnE;;;;;;GAMG;AACH,eAAe,YAAY,CAAC;IAC1B,WAAW,EAAE,0CAA0C;IACvD,SAAS,EAAE;QACT,0FAA0F;QAC1F,+CAA+C,WAAW,EAAE;QAC5D,gHAAgH;QAChH,0JAA0J,WAAW,EAAE;QACvK,yEAAyE;KAC1E;IACD,OAAO,EACL,+KAA+K;CAClL,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Rule } from 'eslint';
2
+ /**
3
+ * A race against a timer that rejects fails the test when the promise is late,
4
+ * with an error the test wrote itself, and leaves the promise running. A
5
+ * timeout belongs to the test (`{ timeout }`), or to `settleWithin`, which
6
+ * names what was late. Follows one variable: a timer built in a helper that
7
+ * returns it is not seen. A timer that resolves a marker
8
+ * (`sleep(ms).then(() => false)`, `delay(ms, 'pending')`) asserts that the
9
+ * promise stays pending, which is a different check, and stays allowed.
10
+ */
11
+ declare const rule: Rule.RuleModule;
12
+ export default rule;
13
+ //# sourceMappingURL=no-timer-race.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-timer-race.d.ts","sourceRoot":"","sources":["../../src/test-files/no-timer-race.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,QAAQ,CAAC;AA8I1C;;;;;;;;GAQG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UA6BhB,CAAC;AAEF,eAAe,IAAI,CAAC"}