@@ -35,6 +35,7 @@ import {
3535 Scope ,
3636 SourceCode ,
3737} from "eslint" ;
38+ import { defineConfig , globalIgnores } from "eslint/config" ;
3839import { ESLintRules } from "eslint/rules" ;
3940import { Linter as ESLinter } from "eslint/universal" ;
4041import {
@@ -530,6 +531,68 @@ rule = {
530531 } ,
531532 meta : { deprecated : true , replacedBy : [ "other-rule-name" ] } ,
532533} ;
534+ rule = {
535+ create ( context ) {
536+ return { } ;
537+ } ,
538+ meta : { deprecated : { message : "message" , url : "https://example.com" } } ,
539+ } ;
540+ rule = {
541+ create ( context ) {
542+ return { } ;
543+ } ,
544+ meta : { deprecated : { availableUntil : "10.0.0" } } ,
545+ } ;
546+ rule = {
547+ create ( context ) {
548+ return { } ;
549+ } ,
550+ meta : { deprecated : { availableUntil : null } } ,
551+ } ;
552+ rule = {
553+ create ( context ) {
554+ return { } ;
555+ } ,
556+ meta : { deprecated : { deprecatedSince : "9.0.0" } } ,
557+ } ;
558+ rule = {
559+ create ( context ) {
560+ return { } ;
561+ } ,
562+ meta : { deprecated : { replacedBy : [ ] } } ,
563+ } ;
564+ rule = {
565+ create ( context ) {
566+ return { } ;
567+ } ,
568+ meta : {
569+ deprecated : {
570+ replacedBy : [ { message : "message" , url : "https://example.com" } ] ,
571+ } ,
572+ } ,
573+ } ;
574+ rule = {
575+ create ( context ) {
576+ return { } ;
577+ } ,
578+ meta : {
579+ deprecated : {
580+ replacedBy : [ { plugin : { name : "eslint-plugin-example" } } ] ,
581+ } ,
582+ } ,
583+ } ;
584+ rule = {
585+ create ( context ) {
586+ return { } ;
587+ } ,
588+ meta : {
589+ deprecated : {
590+ replacedBy : [
591+ { rule : { name : "rule-id" , url : "https://example.com" } } ,
592+ ] ,
593+ } ,
594+ } ,
595+ } ;
533596rule = {
534597 create ( context ) {
535598 return { } ;
@@ -552,7 +615,7 @@ rule = {
552615} ;
553616
554617rule = {
555- create ( context ) {
618+ create ( context : Rule . RuleContext ) {
556619 context . getAncestors ( ) ;
557620
558621 context . getDeclaredVariables ( AST ) ;
@@ -569,9 +632,15 @@ rule = {
569632
570633 context . getCwd ( ) ;
571634
635+ context . languageOptions ;
636+ context . languageOptions
637+ . ecmaVersion satisfies Linter . LanguageOptions [ "ecmaVersion" ] ;
638+
572639 context . sourceCode ;
640+ context . sourceCode . getLocFromIndex ( 42 ) ;
573641
574642 context . getSourceCode ( ) ;
643+ context . getSourceCode ( ) . getLocFromIndex ( 42 ) ;
575644
576645 context . getScope ( ) ;
577646
@@ -583,8 +652,14 @@ rule = {
583652
584653 context . markVariableAsUsed ( "foo" ) ;
585654
655+ // @ts -expect-error wrong `node` type
656+ context . report ( { message : "foo" , node : { } } ) ;
657+
586658 context . report ( { message : "foo" , node : AST } ) ;
587- context . report ( { message : "foo" , loc : { line : 0 , column : 0 } } ) ;
659+ context . report ( {
660+ message : "foo" ,
661+ loc : { start : { line : 0 , column : 0 } , end : { line : 1 , column : 1 } } ,
662+ } ) ;
588663 context . report ( { message : "foo" , node : AST , data : { foo : "bar" } } ) ;
589664 context . report ( { message : "foo" , node : AST , fix : ( ) => null } ) ;
590665 context . report ( {
@@ -661,6 +736,8 @@ rule = {
661736 ] ,
662737 } ) ;
663738
739+ ( violation : Rule . ReportDescriptor ) => context . report ( violation ) ;
740+
664741 return {
665742 onCodePathStart ( codePath , node ) {
666743 const origin : Rule . CodePathOrigin = codePath . origin ;
@@ -1935,3 +2012,32 @@ FlatESLint; // $ExpectType typeof ESLint
19352012shouldUseFlatConfig ( ) ; // $ExpectType Promise<boolean>
19362013
19372014// #endregion
2015+
2016+ // #region defineConfig
2017+
2018+ defineConfig ( [
2019+ {
2020+ files : [ "*.js" ] ,
2021+ rules : {
2022+ "no-console" : "error" ,
2023+ } ,
2024+ } ,
2025+ ] ) ;
2026+
2027+ defineConfig ( [
2028+ globalIgnores ( [ "*.js" ] ) ,
2029+ {
2030+ files : [ "*.js" ] ,
2031+ rules : {
2032+ "no-console" : "error" ,
2033+ } ,
2034+ } ,
2035+ {
2036+ files : [ "*.ts" ] ,
2037+ rules : {
2038+ "@typescript-eslint/no-unused-vars" : "error" ,
2039+ } ,
2040+ } ,
2041+ ] ) ;
2042+
2043+ // #endregion
0 commit comments