Skip to content

Commit

Permalink
Upgrade: require-uncached renamed to import-fresh (#11066)
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add authored Dec 28, 2018
1 parent bf5bfa5 commit 258b654
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/config/config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const fs = require("fs"),
pathIsInside = require("path-is-inside"),
stripComments = require("strip-json-comments"),
stringify = require("json-stable-stringify-without-jsonify"),
requireUncached = require("require-uncached");
importFresh = require("import-fresh");

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

Expand Down Expand Up @@ -156,7 +156,7 @@ function loadLegacyConfigFile(filePath) {
function loadJSConfigFile(filePath) {
debug(`Loading JS config file: ${filePath}`);
try {
return requireUncached(filePath);
return importFresh(filePath);
} catch (e) {
debug(`Error reading JavaScript file: ${filePath}`);
e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"glob": "^7.1.2",
"globals": "^11.7.0",
"ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"inquirer": "^6.1.0",
"js-yaml": "^3.12.0",
Expand All @@ -66,7 +67,6 @@
"pluralize": "^7.0.0",
"progress": "^2.0.0",
"regexpp": "^2.0.1",
"require-uncached": "^1.0.3",
"semver": "^5.5.1",
"strip-ansi": "^4.0.0",
"strip-json-comments": "^2.0.1",
Expand Down
10 changes: 5 additions & 5 deletions tests/lib/config/config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe("ConfigFile", () => {

// Hacky: need to override isFile for each call for testing
"../util/module-resolver": createStubModuleResolver({ "eslint-config-foo": resolvedPath }),
"require-uncached"(filename) {
"import-fresh"(filename) {
return configDeps[filename];
}
};
Expand Down Expand Up @@ -265,7 +265,7 @@ describe("ConfigFile", () => {
"../util/module-resolver": createStubModuleResolver({
"eslint-plugin-test": resolvedPath
}),
"require-uncached"(filename) {
"import-fresh"(filename) {
return configDeps[filename];
}
};
Expand Down Expand Up @@ -296,7 +296,7 @@ describe("ConfigFile", () => {
"../util/module-resolver": createStubModuleResolver({
"eslint-plugin-test": resolvedPath
}),
"require-uncached"(filename) {
"import-fresh"(filename) {
return configDeps[filename];
}
};
Expand Down Expand Up @@ -331,7 +331,7 @@ describe("ConfigFile", () => {
"eslint-config-foo": resolvedPaths[0],
"eslint-config-bar": resolvedPaths[1]
}),
"require-uncached"(filename) {
"import-fresh"(filename) {
return configDeps[filename];
}
};
Expand Down Expand Up @@ -932,7 +932,7 @@ describe("ConfigFile", () => {
const resolvedPath = path.resolve(PROJECT_PATH, "./node_modules/eslint-plugin-test/index.js");

const configDeps = {
"require-uncached"(filename) {
"import-fresh"(filename) {
return configDeps[filename];
}
};
Expand Down

0 comments on commit 258b654

Please sign in to comment.