Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70dc803

Browse files
authored
fix:basePath directory can never be ignored (#18711)
Fixes#18706
1 parent53b1ff0 commit70dc803

File tree

2 files changed

+98
-1
lines changed

2 files changed

+98
-1
lines changed

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"dependencies": {
6969
"@eslint-community/eslint-utils":"^4.2.0",
7070
"@eslint-community/regexpp":"^4.11.0",
71-
"@eslint/config-array":"^0.17.0",
71+
"@eslint/config-array":"^0.17.1",
7272
"@eslint/eslintrc":"^3.1.0",
7373
"@eslint/js":"9.7.0",
7474
"@humanwhocodes/module-importer":"^1.0.1",

‎tests/lib/eslint/eslint.js‎

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,6 +2314,103 @@ describe("ESLint", () => {
23142314
assert.match(results[1].messages[0].message,/'baz'/u);
23152315
});
23162316

2317+
// https://github.com/eslint/eslint/issues/18706
2318+
it("should disregard ignore pattern '/'",async()=>{
2319+
eslint=newESLint({
2320+
cwd:getFixturePath("ignores-relative"),
2321+
overrideConfigFile:true,
2322+
overrideConfig:[
2323+
{
2324+
ignores:["/"]
2325+
},
2326+
{
2327+
plugins:{
2328+
"test-plugin":{
2329+
rules:{
2330+
"no-program":{
2331+
create(context){
2332+
return{
2333+
Program(node){
2334+
context.report({
2335+
node,
2336+
message:"Program is disallowed."
2337+
});
2338+
}
2339+
};
2340+
}
2341+
}
2342+
}
2343+
}
2344+
},
2345+
rules:{
2346+
"test-plugin/no-program":"warn"
2347+
}
2348+
}
2349+
]
2350+
});
2351+
2352+
constresults=awaiteslint.lintFiles(["**/a.js"]);
2353+
2354+
assert.strictEqual(results.length,2);
2355+
assert.strictEqual(results[0].filePath,getFixturePath("ignores-relative","a.js"));
2356+
assert.strictEqual(results[0].messages.length,1);
2357+
assert.strictEqual(results[0].messages[0].severity,1);
2358+
assert.strictEqual(results[0].messages[0].ruleId,"test-plugin/no-program");
2359+
assert.strictEqual(results[0].messages[0].message,"Program is disallowed.");
2360+
assert.strictEqual(results[1].filePath,getFixturePath("ignores-relative","subdir","a.js"));
2361+
assert.strictEqual(results[1].messages.length,1);
2362+
assert.strictEqual(results[1].messages[0].severity,1);
2363+
assert.strictEqual(results[1].messages[0].ruleId,"test-plugin/no-program");
2364+
assert.strictEqual(results[1].messages[0].message,"Program is disallowed.");
2365+
});
2366+
2367+
it("should not skip an unignored file in base path when all files are initially ignored by '**'",async()=>{
2368+
eslint=newESLint({
2369+
cwd:getFixturePath("ignores-relative"),
2370+
overrideConfigFile:true,
2371+
overrideConfig:[
2372+
{
2373+
ignores:[
2374+
"**",
2375+
"!a.js"
2376+
]
2377+
},
2378+
{
2379+
plugins:{
2380+
"test-plugin":{
2381+
rules:{
2382+
"no-program":{
2383+
create(context){
2384+
return{
2385+
Program(node){
2386+
context.report({
2387+
node,
2388+
message:"Program is disallowed."
2389+
});
2390+
}
2391+
};
2392+
}
2393+
}
2394+
}
2395+
}
2396+
},
2397+
rules:{
2398+
"test-plugin/no-program":"warn"
2399+
}
2400+
}
2401+
]
2402+
});
2403+
2404+
constresults=awaiteslint.lintFiles(["**/a.js"]);
2405+
2406+
assert.strictEqual(results.length,1);
2407+
assert.strictEqual(results[0].filePath,getFixturePath("ignores-relative","a.js"));
2408+
assert.strictEqual(results[0].messages.length,1);
2409+
assert.strictEqual(results[0].messages[0].severity,1);
2410+
assert.strictEqual(results[0].messages[0].ruleId,"test-plugin/no-program");
2411+
assert.strictEqual(results[0].messages[0].message,"Program is disallowed.");
2412+
});
2413+
23172414
});
23182415

23192416

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp