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

Commitc591da6

Browse files
authored
feat: Add language to types (#18917)
1 parent91cbd18 commitc591da6

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

‎lib/types/index.d.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
import*asESTreefrom"estree";
29+
import{Language}from"@eslint/core";
2930
import{JSONSchema4}from"json-schema";
3031
import{LegacyESLint}from"./use-at-your-own-risk.js";
3132

@@ -1265,6 +1266,13 @@ export namespace Linter {
12651266
*/
12661267
ignores?:string[];
12671268

1269+
/**
1270+
* The name of the language used for linting. This is used to determine the
1271+
* parser and other language-specific settings.
1272+
*@since 9.7.0
1273+
*/
1274+
language?:string;
1275+
12681276
/**
12691277
* An object containing settings related to how JavaScript is configured for
12701278
* linting.
@@ -1441,6 +1449,7 @@ export namespace ESLint {
14411449
interfacePluginextendsObjectMetaProperties{
14421450
configs?:Record<string,Linter.LegacyConfig|Linter.Config|Linter.Config[]>|undefined;
14431451
environments?:Record<string,Environment>|undefined;
1452+
languages?:Record<string,Language>|undefined;
14441453
processors?:Record<string,Linter.Processor>|undefined;
14451454
rules?:Record<string,Rule.RuleModule>|undefined;
14461455
}

‎tests/lib/types/types.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
shouldUseFlatConfig,
3636
}from"eslint/use-at-your-own-risk";
3737
import{Comment,PrivateIdentifier,PropertyDefinition,StaticBlock,WhileStatement}from"estree";
38+
import{Language}from"@eslint/core";
3839

3940
constSOURCE=`var foo = bar;`;
4041

@@ -1354,6 +1355,15 @@ ruleTester.run("simple-valid-test", rule, {
13541355

13551356
// #region Config
13561357

1358+
(():Linter.Config=>({
1359+
language:"js/js"
1360+
}));
1361+
1362+
(():Linter.Config=>({
1363+
//@ts-expect-error
1364+
language:null
1365+
}));
1366+
13571367
(():Linter.Config=>({
13581368
languageOptions:{
13591369
parser:{
@@ -1496,6 +1506,16 @@ flatConfig = config;
14961506

14971507
// #endregion Config
14981508

1509+
// #region Plugins
1510+
1511+
(():ESLint.Plugin=>({
1512+
languages:{
1513+
"js":{}asLanguage
1514+
}
1515+
}));
1516+
1517+
// #endregion Plugins
1518+
14991519
(async(useFlatConfig?:boolean)=>{
15001520
awaitloadESLint();// $ExpectType typeof ESLint | typeof LegacyESLint
15011521
awaitloadESLint({});// $ExpectType typeof ESLint | typeof LegacyESLint

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp