Skip to content

Commit 523c076

Browse files
feat!: drop support for jiti < 2.2.0 (#20016)
* feat!: drop support for jiti < 2.2.0 This change removes support for `jiti` `< 2.2.0`. Now, if you're wanting to use a TypeScript config without Node's native type stripping, you must have at least version `2.2.0` of `jiti` installed. * updated for pr feedback * fix formatting * add to the migration doc * revert formatting * Update docs/src/use/migrate-to-10.0.0.md correct latest jiti version Co-authored-by: Francesco Trotta <github@fasttime.org> * fix test merge issue --------- Co-authored-by: Francesco Trotta <github@fasttime.org>
1 parent 454a292 commit 523c076

7 files changed

Lines changed: 1484 additions & 1458 deletions

File tree

.github/renovate.json5

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
$schema: "https://docs.renovatebot.com/renovate-schema.json",
33
extends: ["github>eslint/workflows//.github/renovate/base.json5"],
4-
ignoreDeps: ["jiti-v2.0", "jiti-v2.1"],
54
packageRules: [
65
{
76
description: "Group Babel packages into a single PR.",

docs/src/use/configure/configuration-files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ In this case, ESLint does not search for configuration files and instead uses `s
793793

794794
## TypeScript Configuration Files
795795

796-
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):
796+
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.2.0 or later in your project (this dependency is not automatically installed by ESLint):
797797

798798
{{ npm_tabs({
799799
command: "install",

docs/src/use/migrate-to-10.0.0.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The lists below are ordered roughly by the number of users each change is expect
1919
- [New configuration file lookup algorithm](#config-lookup-from-file)
2020
- [`no-shadow-restricted-names` now reports `globalThis` by default](#no-shadow-restricted-names)
2121
- [`eslint:recommended` has been updated](#eslint-recommended)
22+
- [Jiti < v2.2.0 are no longer supported](#-jiti--v220-are-no-longer-supported)
2223

2324
### Breaking changes for plugin developers
2425

@@ -87,3 +88,11 @@ Three new rules have been enabled in `eslint:recommended`:
8788
**To address:** Fix errors or disable these rules.
8889

8990
**Related issue(s):** [#19966](https://github.com/eslint/eslint/issues/19966)
91+
92+
## <a name="drop-old-jiti"></a> Jiti < v2.2.0 are no longer supported
93+
94+
ESLint is officially dropping support for versions of `jiti` that are less than v2.2.0.
95+
96+
**To address:** If you've authored your config file in `TypeScript` and have `jiti` v2.1.2 or earlier installed, be sure to update it to at least `2.2.0` when using ESLint v10.
97+
98+
**Related issue(s):** [#19765](https://github.com/eslint/eslint/issues/19765)

knip.jsonc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
"c8",
3131
// Optional peer dependency used for loading TypeScript configuration files
3232
"jiti",
33-
"jiti-v2.0",
34-
"jiti-v2.1",
3533
],
3634
},
3735
"docs": {

lib/config/config-loader.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ async function loadTypeScriptConfigFileWithJiti(filePath, fileURL, mtime) {
147147
);
148148
});
149149

150-
// `createJiti` was added in jiti v2.
151-
if (typeof createJiti !== "function") {
150+
// Ensure the version is at least 2.2.0.
151+
const [jitiMajor, jitiMinor] = jitiVersion
152+
.split(".")
153+
.map(versionPart => Number(versionPart));
154+
if (jitiMajor < 2 || (jitiMajor === 2 && jitiMinor < 2)) {
152155
throw new Error(
153156
"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.",
154157
);
@@ -162,10 +165,6 @@ async function loadTypeScriptConfigFileWithJiti(filePath, fileURL, mtime) {
162165
moduleCache: false,
163166
};
164167

165-
if (jitiVersion.startsWith("2.1.")) {
166-
jitiOptions.interopDefault = false;
167-
}
168-
169168
const jiti = createJiti(__filename, jitiOptions);
170169
const config = await jiti.import(fileURL.href);
171170

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@
175175
"got": "^11.8.3",
176176
"gray-matter": "^4.0.3",
177177
"jiti": "^2.6.1",
178-
"jiti-v2.0": "npm:jiti@2.0.x",
179-
"jiti-v2.1": "npm:jiti@2.1.x",
180178
"knip": "^5.60.2",
181179
"lint-staged": "^11.0.0",
182180
"markdown-it": "^12.2.0",

0 commit comments

Comments
 (0)