Permalink
Browse files

Upgrade: require-uncached renamed to import-fresh (#11066)

  • Loading branch information...
aladdin-add committed Dec 28, 2018
1 parent bf5bfa5 commit 258b6541f61dc3a9ae64e200680766a11c3dd316
Showing with 8 additions and 8 deletions.
  1. +2 −2 lib/config/config-file.js
  2. +1 −1 package.json
  3. +5 −5 tests/lib/config/config-file.js
@@ -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");

@@ -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}`;
@@ -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",
@@ -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",
@@ -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];
}
};
@@ -265,7 +265,7 @@ describe("ConfigFile", () => {
"../util/module-resolver": createStubModuleResolver({
"eslint-plugin-test": resolvedPath
}),
"require-uncached"(filename) {
"import-fresh"(filename) {
return configDeps[filename];
}
};
@@ -296,7 +296,7 @@ describe("ConfigFile", () => {
"../util/module-resolver": createStubModuleResolver({
"eslint-plugin-test": resolvedPath
}),
"require-uncached"(filename) {
"import-fresh"(filename) {
return configDeps[filename];
}
};
@@ -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];
}
};
@@ -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];
}
};

0 comments on commit 258b654

Please sign in to comment.