Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Dec 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/config/config-file.js
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
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
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