Skip to content

Commit 258b654

Browse files
authored
Upgrade: require-uncached renamed to import-fresh (#11066)
1 parent bf5bfa5 commit 258b654

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/config/config-file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const fs = require("fs"),
1818
pathIsInside = require("path-is-inside"),
1919
stripComments = require("strip-json-comments"),
2020
stringify = require("json-stable-stringify-without-jsonify"),
21-
requireUncached = require("require-uncached");
21+
importFresh = require("import-fresh");
2222

2323
const debug = require("debug")("eslint:config-file");
2424

@@ -156,7 +156,7 @@ function loadLegacyConfigFile(filePath) {
156156
function loadJSConfigFile(filePath) {
157157
debug(`Loading JS config file: ${filePath}`);
158158
try {
159-
return requireUncached(filePath);
159+
return importFresh(filePath);
160160
} catch (e) {
161161
debug(`Error reading JavaScript file: ${filePath}`);
162162
e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"glob": "^7.1.2",
5353
"globals": "^11.7.0",
5454
"ignore": "^4.0.6",
55+
"import-fresh": "^3.0.0",
5556
"imurmurhash": "^0.1.4",
5657
"inquirer": "^6.1.0",
5758
"js-yaml": "^3.12.0",
@@ -66,7 +67,6 @@
6667
"pluralize": "^7.0.0",
6768
"progress": "^2.0.0",
6869
"regexpp": "^2.0.1",
69-
"require-uncached": "^1.0.3",
7070
"semver": "^5.5.1",
7171
"strip-ansi": "^4.0.0",
7272
"strip-json-comments": "^2.0.1",

tests/lib/config/config-file.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe("ConfigFile", () => {
181181

182182
// Hacky: need to override isFile for each call for testing
183183
"../util/module-resolver": createStubModuleResolver({ "eslint-config-foo": resolvedPath }),
184-
"require-uncached"(filename) {
184+
"import-fresh"(filename) {
185185
return configDeps[filename];
186186
}
187187
};
@@ -265,7 +265,7 @@ describe("ConfigFile", () => {
265265
"../util/module-resolver": createStubModuleResolver({
266266
"eslint-plugin-test": resolvedPath
267267
}),
268-
"require-uncached"(filename) {
268+
"import-fresh"(filename) {
269269
return configDeps[filename];
270270
}
271271
};
@@ -296,7 +296,7 @@ describe("ConfigFile", () => {
296296
"../util/module-resolver": createStubModuleResolver({
297297
"eslint-plugin-test": resolvedPath
298298
}),
299-
"require-uncached"(filename) {
299+
"import-fresh"(filename) {
300300
return configDeps[filename];
301301
}
302302
};
@@ -331,7 +331,7 @@ describe("ConfigFile", () => {
331331
"eslint-config-foo": resolvedPaths[0],
332332
"eslint-config-bar": resolvedPaths[1]
333333
}),
334-
"require-uncached"(filename) {
334+
"import-fresh"(filename) {
335335
return configDeps[filename];
336336
}
337337
};
@@ -932,7 +932,7 @@ describe("ConfigFile", () => {
932932
const resolvedPath = path.resolve(PROJECT_PATH, "./node_modules/eslint-plugin-test/index.js");
933933

934934
const configDeps = {
935-
"require-uncached"(filename) {
935+
"import-fresh"(filename) {
936936
return configDeps[filename];
937937
}
938938
};

0 commit comments

Comments
 (0)