-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix many tests, add hot-patching to get the ball rolling
- Loading branch information
Showing
14 changed files
with
291 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
diff --git a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs | ||
index b8d5f8c..bbd1ccc 100644 | ||
--- a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs | ||
+++ b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs | ||
@@ -3228,11 +3228,11 @@ class ConfigArrayFactory { | ||
_loadParser(nameOrPath, ctx) { | ||
debug$2("Loading parser %j from %s", nameOrPath, ctx.filePath); | ||
|
||
- const { cwd } = internalSlotsMap$1.get(this); | ||
+ const { cwd, resolver } = internalSlotsMap$1.get(this); | ||
const relativeTo = ctx.filePath || path__default['default'].join(cwd, "__placeholder__.js"); | ||
|
||
try { | ||
- const filePath = resolve(nameOrPath, relativeTo); | ||
+ const filePath = resolver.resolve(nameOrPath, relativeTo); | ||
|
||
writeDebugLogForLoading(nameOrPath, relativeTo, filePath); | ||
|
||
@@ -3279,7 +3279,7 @@ class ConfigArrayFactory { | ||
_loadPlugin(name, ctx) { | ||
debug$2("Loading plugin %j from %s", name, ctx.filePath); | ||
|
||
- const { additionalPluginPool } = internalSlotsMap$1.get(this); | ||
+ const { additionalPluginPool, resolver } = internalSlotsMap$1.get(this); | ||
const request = normalizePackageName(name, "eslint-plugin"); | ||
const id = getShorthandName(request, "eslint-plugin"); | ||
const relativeTo = path__default['default'].join(ctx.pluginBasePath, "__placeholder__.js"); | ||
@@ -3320,7 +3320,7 @@ class ConfigArrayFactory { | ||
let error; | ||
|
||
try { | ||
- filePath = resolve(request, relativeTo); | ||
+ filePath = resolver.resolve(request, relativeTo); | ||
} catch (resolveError) { | ||
error = resolveError; | ||
/* istanbul ignore else */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
diff --git a/node_modules/eslint/lib/cli-engine/cli-engine.js b/node_modules/eslint/lib/cli-engine/cli-engine.js | ||
index aae7160..45c7156 100644 | ||
--- a/node_modules/eslint/lib/cli-engine/cli-engine.js | ||
+++ b/node_modules/eslint/lib/cli-engine/cli-engine.js | ||
@@ -595,6 +595,7 @@ class CLIEngine { | ||
cwd: options.cwd, | ||
ignorePath: options.ignorePath, | ||
resolvePluginsRelativeTo: options.resolvePluginsRelativeTo, | ||
+ resolver: options.resolver, | ||
rulePaths: options.rulePaths, | ||
specificConfigPath: options.configFile, | ||
useEslintrc: options.useEslintrc, | ||
diff --git a/node_modules/eslint/lib/cli.js b/node_modules/eslint/lib/cli.js | ||
index 477310d..af6a75a 100644 | ||
--- a/node_modules/eslint/lib/cli.js | ||
+++ b/node_modules/eslint/lib/cli.js | ||
@@ -83,6 +83,7 @@ function translateOptions({ | ||
quiet, | ||
reportUnusedDisableDirectives, | ||
resolvePluginsRelativeTo, | ||
+ resolver, | ||
rule, | ||
rulesdir | ||
}) { | ||
@@ -119,6 +120,7 @@ function translateOptions({ | ||
overrideConfigFile: config, | ||
reportUnusedDisableDirectives: reportUnusedDisableDirectives ? "error" : void 0, | ||
resolvePluginsRelativeTo, | ||
+ resolver, | ||
rulePaths: rulesdir, | ||
useEslintrc: eslintrc | ||
}; | ||
diff --git a/node_modules/eslint/lib/eslint/eslint.js b/node_modules/eslint/lib/eslint/eslint.js | ||
index b4a1d02..89213d0 100644 | ||
--- a/node_modules/eslint/lib/eslint/eslint.js | ||
+++ b/node_modules/eslint/lib/eslint/eslint.js | ||
@@ -173,6 +173,7 @@ function processOptions({ | ||
plugins = {}, | ||
reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that. | ||
resolvePluginsRelativeTo = null, // ← should be null by default because if it's a string then it suppresses RFC47 feature. | ||
+ resolver = null, | ||
rulePaths = [], | ||
useEslintrc = true, | ||
...unknownOptions | ||
@@ -305,6 +306,7 @@ function processOptions({ | ||
ignorePath, | ||
reportUnusedDisableDirectives, | ||
resolvePluginsRelativeTo, | ||
+ resolver: resolver ? require(resolver) : undefined, | ||
rulePaths, | ||
useEslintrc | ||
}; | ||
diff --git a/node_modules/eslint/lib/options.js b/node_modules/eslint/lib/options.js | ||
index 2dd186d..dfe32c1 100644 | ||
--- a/node_modules/eslint/lib/options.js | ||
+++ b/node_modules/eslint/lib/options.js | ||
@@ -115,6 +115,11 @@ module.exports = optionator({ | ||
type: "path::String", | ||
description: "A folder where plugins should be resolved from, CWD by default" | ||
}, | ||
+ { | ||
+ option: "resolver", | ||
+ type: "path::String", | ||
+ description: "Absolute path to a resolver module" | ||
+ }, | ||
{ | ||
heading: "Specifying rules and plugins" | ||
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js b/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js | ||
index bda956c..29be68e 100644 | ||
--- a/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js | ||
+++ b/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js | ||
@@ -17,7 +17,7 @@ var _arrayIncludes = require('array-includes');var _arrayIncludes2 = _interopReq | ||
* @author René Fermann | ||
*/ // eslint/lib/util/glob-util has been moved to eslint/lib/util/glob-utils with version 5.3 | ||
// and has been moved to eslint/lib/cli-engine/file-enumerator in version 6 | ||
-var listFilesToProcess = void 0;try {var FileEnumerator = require('eslint/lib/cli-engine/file-enumerator').FileEnumerator; | ||
+var listFilesToProcess = void 0;try {var FileEnumerator = require('eslint/use-at-your-own-risk').FileEnumerator; | ||
listFilesToProcess = function listFilesToProcess(src, extensions) { | ||
var e = new FileEnumerator({ | ||
extensions: extensions }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
diff --git a/node_modules/gulp-eslint7/index.js b/node_modules/gulp-eslint7/index.js | ||
index 533550e..7592722 100644 | ||
--- a/node_modules/gulp-eslint7/index.js | ||
+++ b/node_modules/gulp-eslint7/index.js | ||
@@ -70,6 +70,11 @@ function gulpEslint(options) { | ||
const { eslintOptions, quiet, warnIgnored } = migrateOptions(options); | ||
const linter = new ESLint(eslintOptions); | ||
|
||
+ // yes that's ugly, we'll see for a better solution in a PR | ||
+ resolveFormatter(linter, "stylish").then(formatter => { | ||
+ gulpEslint.formatter = formatter; | ||
+ }) | ||
+ | ||
return transform((file, enc, cb) => { | ||
lintFile(linter, file, quiet, warnIgnored) | ||
.then(() => cb(null, file)) | ||
@@ -174,10 +179,9 @@ gulpEslint.failAfterError = () => { | ||
* @returns {stream} gulp file stream | ||
*/ | ||
gulpEslint.formatEach = (formatter, writable) => { | ||
- formatter = resolveFormatter(formatter); | ||
writable = resolveWritable(writable); | ||
|
||
- return gulpEslint.result(result => writeResults([result], formatter, writable)); | ||
+ return gulpEslint.result(result => writeResults([result], gulpEslint.formatter, writable)); | ||
}; | ||
|
||
/** | ||
@@ -188,13 +192,12 @@ gulpEslint.formatEach = (formatter, writable) => { | ||
* @returns {stream} gulp file stream | ||
*/ | ||
gulpEslint.format = (formatter, writable) => { | ||
- formatter = resolveFormatter(formatter); | ||
writable = resolveWritable(writable); | ||
|
||
return gulpEslint.results(results => { | ||
// Only format results if files has been lint'd | ||
if (results.length) { | ||
- writeResults(results, formatter, writable); | ||
+ writeResults(results, gulpEslint.formatter, writable); | ||
} | ||
}); | ||
}; | ||
diff --git a/node_modules/gulp-eslint7/util.js b/node_modules/gulp-eslint7/util.js | ||
index bf44540..9635b59 100644 | ||
--- a/node_modules/gulp-eslint7/util.js | ||
+++ b/node_modules/gulp-eslint7/util.js | ||
@@ -282,11 +282,11 @@ exports.filterResult = (result, filter) => { | ||
* @param {(String|Function)} [formatter=stylish] - A name to resolve as a formatter. If a function is provided, the same function is returned. | ||
* @returns {Function} An ESLint formatter | ||
*/ | ||
-exports.resolveFormatter = (formatter) => { | ||
+exports.resolveFormatter = async (linter, formatter) => { | ||
// use ESLint to look up formatter references | ||
if (typeof formatter !== 'function') { | ||
// load formatter (module, relative to cwd, ESLint formatter) | ||
- formatter = CLIEngine.getFormatter(formatter); | ||
+ formatter = linter.loadFormatter(formatter); | ||
} | ||
|
||
return formatter; | ||
@@ -321,7 +321,7 @@ exports.writeResults = (results, formatter, writable) => { | ||
|
||
const firstResult = results.find(result => result.config); | ||
|
||
- const message = formatter(results, firstResult ? firstResult.config : {}); | ||
+ const message = formatter.format(results, firstResult ? firstResult.config : {}); | ||
if (writable && message != null && message !== '') { | ||
writable(message); | ||
} |
Oops, something went wrong.