8000 refactor: switch to `@eslint/config-array` (#18527) · eslint/eslint@594145f · GitHub
[go: up one dir, main page]

Skip to content

Commit 594145f

Browse files
authored
refactor: switch to @eslint/config-array (#18527)
* chore: switch to `@eslint/config-array` * remove redundant check
1 parent 525fdff commit 594145f

File tree

5 files changed

+10
-19
lines changed

5 files changed

+10
-19
lines changed

lib/config/flat-config-array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// Requirements
1010
//-----------------------------------------------------------------------------
1111

12-
const { ConfigArray, ConfigArraySymbol } = require("@humanwhocodes/config-array");
12+
const { ConfigArray, ConfigArraySymbol } = require("@eslint/config-array");
1313
const { flatConfigSchema } = require("./flat-config-schema");
1414
const { RuleValidator } = require("./rule-validator");
1515
const { defaultConfig } = require("./default-config");

lib/eslint/eslint-helpers.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,23 +335,23 @@ async function globSearch({
335335

336336
/*
337337
* We updated the unmatched patterns set only if the path
338-
* matches and the file isn't ignored. If the file is
339-
* ignored, that means there wasn't a match for the
338+
* matches and the file has a config. If the file has no
339+
* config, that means there wasn't a match for the
340340
* pattern so it should not be removed.
341341
*
342-
* Performance note: isFileIgnored() aggressively caches
342+
* Performance note: `getConfig()` aggressively caches
343343
* results so there is no performance penalty for calling
344-
* it twice with the same argument.
344+
* it multiple times with the same argument.
345345
*/
346-
if (pathMatches && !configs.isFileIgnored(entry.path)) {
346+
if (pathMatches && configs.getConfig(entry.path)) {
347347
unmatchedPatterns.delete(matcher.pattern);
348348
}
349349

350350
return pathMatches || previousValue;
351351
}, false)
352352
: matchers.some(matcher => matcher.match(relativePath));
353353

354-
return matchesPattern && !configs.isFileIgnored(entry.path);
354+
return matchesPattern && configs.getConfig(entry.path) !== void 0;
355355
})
356356
},
357357
(error, entries) => {
@@ -545,7 +545,7 @@ async function findFiles({
545545
if (stat.isFile()) {
546546
results.push({
547547
filePath,
548-
ignored: configs.isFileIgnored(filePath)
548+
ignored: !configs.getConfig(filePath)
549549
});
550550
}
551551

lib/eslint/eslint.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -881,15 +881,6 @@ class ESLint {
881881

882882
const config = configs.getConfig(filePath);
883883

884-
/*
885-
* Sometimes a file found through a glob pattern will
886-
* be ignored. In this case, `config` will be undefined
887-
* and we just silently ignore the file.
888-
*/
889-
if (!config) {
890-
return void 0;
891-
}
892-
893884
// Skip if there is cached result.
894885
if (lintResultCache) {
895886
const cachedResult =

lib/rule-tester/rule-tester.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const ajv = require("../shared/ajv")({ strictDefaults: true });
2828

2929
const parserSymbol = Symbol.for("eslint.RuleTester.parser");
3030
const { SourceCode } = require("../source-code");
31-
const { ConfigArraySymbol } = require("@humanwhocodes/config-array");
31+
const { ConfigArraySymbol } = require("@eslint/config-array");
3232
const { isSerializable } = require("../shared/serialization");
3333

3434
//------------------------------------------------------------------------------

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@
6868
"dependencies": {
6969
"@eslint-community/eslint-utils": "^4.2.0",
7070
"@eslint-community/regexpp": "^4.6.1",
71+
"@eslint/config-array": "^0.15.1",
7172
"@eslint/eslintrc": "^3.1.0",
7273
"@eslint/js": "9.3.0",
73-
"@humanwhocodes/config-array": "^0.13.0",
7474
"@humanwhocodes/module-importer": "^1.0.1",
7575
"@humanwhocodes/retry": "^0.3.0",
7676
"@nodelib/fs.walk": "^1.2.8",

0 commit comments

Comments
 (0)
0