You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For more information about using feature flags, see [Feature Flags](../../flags/).
531
531
532
-
For Deno and Bun, TypeScript configuration files are natively supported; for Node.js, you must install the optional dev dependency [`jiti`](https://github.com/unjs/jiti) in your project (this dependency is not automatically installed by ESLint):
532
+
For Deno and Bun, TypeScript configuration files are natively supported; for Node.js, you must install the optional dev dependency [`jiti`](https://github.com/unjs/jiti) in version 2.0.0 or later in your project (this dependency is not automatically installed by ESLint):
thrownewError("The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it.");
178
179
});
179
180
181
+
// `createJiti` was added in jiti v2.
182
+
if(typeofcreateJiti!=="function"){
183
+
thrownewError("You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features.");
184
+
}
185
+
180
186
/*
181
187
* Disabling `moduleCache` allows us to reload a
182
188
* config file when the last modified timestamp changes.
thrownewError("You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features.");
{message: "You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features."}
1351
+
);
1352
+
});
1353
+
1354
+
it("should fail to load a CommonJS TS config file that exports undefined with a helpful error message",async()=>{
1355
+
1356
+
constcwd=getFixturePath("ts-config-files","ts");
1357
+
1358
+
eslint=newESLint({
1359
+
cwd,
1360
+
flags: tsFlags,
1361
+
overrideConfigFile: "eslint.undefined.config.ts"
1362
+
});
1363
+
1364
+
awaitassert.rejects(
1365
+
eslint.lintText("foo"),
1366
+
{message: "Config (unnamed): Unexpected undefined config at user-defined index 0."}
1367
+
);
1368
+
1369
+
});
1370
+
1316
1371
});
1317
1372
1318
1373
it("should pass BOM through processors",async()=>{
@@ -5753,6 +5808,61 @@ describe("ESLint", () => {
5753
5808
5754
5809
});
5755
5810
5811
+
it("should fail to load a TS config file if jiti is not installed",async()=>{
{message: "You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features."}
5846
+
);
5847
+
});
5848
+
5849
+
it("should fail to load a CommonJS TS config file that exports undefined with a helpful error message",async()=>{
5850
+
5851
+
constcwd=getFixturePath("ts-config-files","ts");
5852
+
5853
+
eslint=newESLint({
5854
+
cwd,
5855
+
flags: newFlags,
5856
+
overrideConfigFile: "eslint.undefined.config.ts"
5857
+
});
5858
+
5859
+
awaitassert.rejects(
5860
+
eslint.lintFiles("foo.js"),
5861
+
{message: "Config (unnamed): Unexpected undefined config at user-defined index 0."}
5862
+
);
5863
+
5864
+
});
5865
+
5756
5866
});
5757
5867
5758
5868
it("should stop linting files if a rule crashes",async()=>{
0 commit comments