Content-Length: 329555 | pFad | https://github.com/eslint/eslint/commit/#start-of-content

6849D98D fix: fix `LintOptions.filterCodeBlock` types (#19837) · eslint/eslint@9bda4a9 · GitHub
Skip to content

Commit 9bda4a9

Browse files
authored
fix: fix LintOptions.filterCodeBlock types (#19837)
* fix: fix `lintOptions.filterCodeBlock` types * chore: resolve suggestions
1 parent a806994 commit 9bda4a9

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/types/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,9 @@ export namespace Linter {
16261626
postprocess?:
16271627
| ((problemLists: LintMessage[][]) => LintMessage[])
16281628
| undefined;
1629-
filterCodeBlock?: boolean | undefined;
1629+
filterCodeBlock?:
1630+
| ((filename: string, text: string) => boolean)
1631+
| undefined;
16301632
disableFixes?: boolean | undefined;
16311633
allowInlineConfig?: boolean | undefined;
16321634
reportUnusedDisableDirectives?: boolean | undefined;

tests/lib/types/types.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,11 @@ linterWithFlatConfig.verify(SOURCE, [{}], {
11491149
linterWithFlatConfig.verify(SOURCE, [{}], {
11501150
postprocess: problemList => problemList[0],
11511151
});
1152+
linterWithFlatConfig.verify(SOURCE, [{}], {
1153+
filterCodeBlock(filename) {
1154+
return filename.endsWith(".js");
1155+
},
1156+
});
11521157

11531158
linterWithFlatConfig.verify(
11541159
SOURCE,
@@ -1274,6 +1279,15 @@ linterWithFlatConfig.verifyAndFix(
12741279
{ linterOptions: {} },
12751280
{ filename: "test.js" },
12761281
);
1282+
linterWithFlatConfig.verifyAndFix(
1283+
SOURCE,
1284+
{ linterOptions: {} },
1285+
{
1286+
filterCodeBlock(filename) {
1287+
return filename.endsWith(".js");
1288+
},
1289+
},
1290+
);
12771291

12781292
// #endregion Linter with flat config
12791293

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/eslint/eslint/commit/#start-of-content

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy