@open-turo/eslint-config-typescript 23.1.16 → 23.1.17

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/index.js CHANGED
@@ -97,6 +97,17 @@ const importConfig = () =>
97
97
  "import/resolver": {
98
98
  typescript: {
99
99
  alwaysTryTypes: true,
100
+ /**
101
+ * Without an explicit `project`, the resolver caches a single tsconfig for the
102
+ * entire process (keyed by whatever the CWD was on first resolution). In a
103
+ * monorepo, running lint from the repo root (e.g. via pre-commit across
104
+ * packages) causes every file to resolve imports/aliases against just one
105
+ * package's tsconfig. Globbing for all tsconfigs makes the resolver pick the
106
+ * nearest one per file instead.
107
+ * @see https://github.com/import-js/eslint-import-resolver-typescript#project
108
+ */
109
+ noWarnOnMultipleProjects: true,
110
+ project: ["**/tsconfig.json"],
100
111
  },
101
112
  },
102
113
  },
@@ -341,7 +352,7 @@ const config = function config(options = {}) {
341
352
  }
342
353
 
343
354
  const defaultAllowModules =
344
- testFramework === "vitest" ? ["nock"] : ["@jest/globals", "nock"];
355
+ testFramework === "vitest" ? ["nock", "vitest"] : ["@jest/globals", "nock"];
345
356
  const allowModules = options.allowModules || defaultAllowModules;
346
357
 
347
358
  return eslintConfig.defineConfig(
package/package.json CHANGED
@@ -57,6 +57,6 @@
57
57
  "access": "public"
58
58
  },
59
59
  "repository": "https://github.com/open-turo/eslint-config-typescript",
60
- "version": "23.1.16",
60
+ "version": "23.1.17",
61
61
  "packageManager": "npm@11.19.0"
62
62
  }
package/test/test.spec.js CHANGED
@@ -237,4 +237,37 @@ describe("validate config", () => {
237
237
  'Invalid testFramework option: "invalid". Valid values are "jest" or "vitest".',
238
238
  );
239
239
  });
240
+
241
+ test.each(["jest", "vitest"])(
242
+ "n/no-unpublished-import allows importing the %s package by default",
243
+ async (testFramework) => {
244
+ const { default: config } = await import("../index.js");
245
+ const ESLint = await loadESLint({ useFlatConfig: true });
246
+ const linter = new ESLint({
247
+ baseConfig: config({ testFramework }),
248
+ overrideConfigFile: true,
249
+ });
250
+ const calculatedConfig =
251
+ await linter.calculateConfigForFile(TEST_FILE_PATH);
252
+ const [, { allowModules }] =
253
+ calculatedConfig.rules["n/no-unpublished-import"];
254
+ expect(allowModules).toContain(
255
+ testFramework === "vitest" ? "vitest" : "@jest/globals",
256
+ );
257
+ },
258
+ );
259
+
260
+ test("import/resolver typescript project globs all tsconfigs so files resolve against their own package", async () => {
261
+ const { default: config } = await import("../index.js");
262
+ const ESLint = await loadESLint({ useFlatConfig: true });
263
+ const linter = new ESLint({
264
+ baseConfig: config(),
265
+ overrideConfigFile: true,
266
+ });
267
+ const calculatedConfig =
268
+ await linter.calculateConfigForFile(TEST_FILE_PATH);
269
+ expect(
270
+ calculatedConfig.settings["import/resolver"].typescript.project,
271
+ ).toContain("**/tsconfig.json");
272
+ });
240
273
  });