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

Breaking: fix config loading (fixes #11510, fixes #11559, fixes #11586) #11546

Merged
merged 53 commits into from May 10, 2019
Merged
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ea25be2
Breaking: fix config loading (fixes #11510, fixes #11559, fixes #11586)
mysticatea Apr 9, 2019
ef57db3
fix typo
platinumazure Apr 11, 2019
69566ee
clarify a magic number
platinumazure Apr 11, 2019
8157464
correct a comment
platinumazure Apr 11, 2019
d96176f
correct a test description
platinumazure Apr 11, 2019
11f293d
fix typo
platinumazure Apr 11, 2019
f6eb5fa
fix typo
platinumazure Apr 11, 2019
d6538e7
fix typo
platinumazure Apr 11, 2019
f51d2c0
fix a copy/paste mistake
platinumazure Apr 11, 2019
bedce88
fix typo
platinumazure Apr 11, 2019
95d3dc2
remove "a.js" from getConfigForFile (https://github.com/eslint/eslint…
mysticatea Apr 12, 2019
6a13317
remove commented out debug.enabled=true
mysticatea Apr 12, 2019
fa671b8
fix CascadingConfigArrayFactoryOptions#cliConfig comment
mysticatea Apr 12, 2019
e743a71
originalEnabled → originalDebugEnabled
mysticatea Apr 12, 2019
ef65825
fix a test description (https://github.com/eslint/eslint/pull/11546#d…
mysticatea Apr 12, 2019
c1f7075
remove "Moved from *" groups
mysticatea Apr 12, 2019
80d55d6
Inmemory → InMemory
mysticatea Apr 12, 2019
41f0d91
remove JSON.stringify(files) from test subjects
mysticatea Apr 12, 2019
f8e3102
remove shadowing variables
mysticatea Apr 12, 2019
3df21e8
update wrong JSDoc comment
mysticatea Apr 12, 2019
f8f6950
remove a workaround for Node 6
mysticatea Apr 12, 2019
d1c2752
make `factory` instance unique for each test case
mysticatea Apr 12, 2019
75c5157
add a test case for `root`
mysticatea Apr 12, 2019
8a2772e
fix a test case more readable
mysticatea Apr 12, 2019
6ea6c1e
improve tests for JSON.stringify and console.log
mysticatea Apr 12, 2019
6f97db3
Merge branch 'master' into issue11510
mysticatea Apr 13, 2019
db764bb
Merge branch 'master' into issue11510
mysticatea Apr 25, 2019
45f724e
Merge branch 'master' into issue11510
mysticatea Apr 27, 2019
5bc6da0
fix typo
mysticatea May 9, 2019
abdea3e
"on" → "in" in a comment
mysticatea May 9, 2019
c04ead2
Merge branch 'master' into issue11510
mysticatea May 9, 2019
511da78
change `verifyText` parameter to an object
mysticatea May 9, 2019
6a3c384
add a comment about `basename` and `resultFilePath`
mysticatea May 9, 2019
bfc25ec
simplify `dirSuffix`
mysticatea May 9, 2019
57774b4
"on" → "in" in an error message
mysticatea May 9, 2019
49d1461
remove the default value from `CascadingConfigArrayFactory#getConfigA…
mysticatea May 9, 2019
bdb3123
freeze cached config arrays
mysticatea May 9, 2019
4fae2b2
"*OnDirectory" → "*InDirectory"
mysticatea May 9, 2019
3447120
normalize plugins in `_loadPlugin` method
mysticatea May 9, 2019
6f5269b
rename placeholder filename
mysticatea May 9, 2019
b5c0285
remove unnecessary `if` for local plugins
mysticatea May 9, 2019
396ff47
add more check for __proto__
mysticatea May 9, 2019
55fd2da
"mergeRules" → "mergeRuleConfigs"
mysticatea May 9, 2019
5a2453d
"root" → "isRoot()"
mysticatea May 9, 2019
f8cd098
add assertion for basePath in OverrideTester.and()
mysticatea May 9, 2019
bc23404
Update lib/config/config-initializer.js
mysticatea May 9, 2019
eb5164a
"builtInRules.keys()" → "builtInRules.entries()"
mysticatea May 9, 2019
810dd77
"Function.prototype" → "noop"
mysticatea May 9, 2019
fb5c29a
remove unnecessary lodash.cloneDeep
mysticatea May 9, 2019
a852b02
fix about `<text>`
mysticatea May 9, 2019
1fda3f2
fix `getConfigForFile()` to require an argument
mysticatea May 9, 2019
40925c0
`builtInRules.entries()` → `builtInRules`
mysticatea May 9, 2019
fcf8228
update migration guide
mysticatea May 9, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

add assertion for basePath in OverrideTester.and()

  • Loading branch information...
mysticatea committed May 9, 2019
commit f8cd0980a05ba42ace0764254571caef9a148bd4
@@ -491,19 +491,18 @@ class ConfigArrayFactory {

// Apply the criteria to every element.
for (const element of elements) {
element.criteria = OverrideTester.and(criteria, element.criteria);

/*
* Adopt the base path of the entry file (the outermost base path).
* Also, ensure the elements which came from `overrides` settings
* don't have `root` property even if it came from `extends` in
* `overrides`.
*/
// Adopt the base path of the entry file (the outermost base path).
if (element.criteria) {
element.criteria.basePath = basePath;
element.root = void 0;
}

/*
* Merge the criteria; this is for only file extension processors in
* `overrides` section for now.
*/
element.criteria = OverrideTester.and(criteria, element.criteria);

yield element;
}
}
@@ -18,6 +18,7 @@
*/
"use strict";

const assert = require("assert");
const path = require("path");
const util = require("util");
const { Minimatch } = require("minimatch");
@@ -107,6 +108,7 @@ class OverrideTester {
/**
* Combine two testers by logical and.
* If either of the testers was `null`, returns the other tester.
* The `basePath` property of the two must be the same value.
* @param {OverrideTester|null} a A tester.
* @param {OverrideTester|null} b Another tester.
* @returns {OverrideTester|null} Combined tester.
@@ -119,6 +121,7 @@ class OverrideTester {
return b;
}

assert.strictEqual(a.basePath, b.basePath);
return new OverrideTester(a.patterns.concat(b.patterns), a.basePath);
This conversation was marked as resolved by mysticatea

This comment has been minimized.

Copy link
@not-an-aardvark

not-an-aardvark May 9, 2019

Member

Is using a.basePath correct here? It seems like this will cause b.patterns to be resolved against the wrong path.

This comment has been minimized.

Copy link
@mysticatea

mysticatea May 9, 2019

Author Member

Actually, the basePath property of a and b are the same value always. I will add assert.

}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.