@@ -73,6 +73,10 @@ import tsNoUnnecessaryTemplateExpression from './rules/tsNoUnnecessaryTemplateEx
7373import tsPreferFunctionType from './rules/tsPreferFunctionType.js' ;
7474import typeFormatting from './rules/typeFormatting.js' ;
7575import validTypes from './rules/validTypes.js' ;
76+ import {
77+ ESLint ,
78+ } from 'eslint' ;
79+ import semver from 'semver' ;
7680
7781/**
7882 * @typedef {"recommended" | "stylistic" | "contents" | "logical" | "requirements" } ConfigGroups
@@ -592,9 +596,6 @@ index.configs.examples = /** @type {import('eslint').Linter.Config[]} */ ([
592596
593597 '@typescript-eslint/no-unused-vars' : 0 ,
594598
595- // "always" newline rule at end unlikely in sample code
596- 'eol-last' : 0 ,
597-
598599 // Wouldn't generally expect example paths to resolve relative to JS file
599600 'import/no-unresolved' : 0 ,
600601
@@ -614,9 +615,18 @@ index.configs.examples = /** @type {import('eslint').Linter.Config[]} */ ([
614615 // Unlikely to have inadvertent debugging within examples
615616 'no-console' : 0 ,
616617
617- // Often wish to start `@example` code after newline; also may use
618- // empty lines for spacing
619- 'no-multiple-empty-lines' : 0 ,
618+ /* c8 ignore next 11 -- Coercion should work */
619+ ...( semver . gte ( semver . coerce ( ESLint . version ) ?? '9.0.0' , '9.0.0' ) ? { } : {
620+ // "always" newline rule at end unlikely in sample code
621+ 'eol-last' : 0 ,
622+
623+ // Often wish to start `@example` code after newline; also may use
624+ // empty lines for spacing
625+ 'no-multiple-empty-lines' : 0 ,
626+
627+ // Can generally look nicer to pad a little even if code imposes more stringency
628+ 'padded-blocks' : 0 ,
629+ } ) ,
620630
621631 // Many variables in examples will be `undefined`
622632 'no-undef' : 0 ,
@@ -626,9 +636,6 @@ index.configs.examples = /** @type {import('eslint').Linter.Config[]} */ ([
626636 // See import/no-unresolved
627637 'node/no-missing-import' : 0 ,
628638 'node/no-missing-require' : 0 ,
629-
630- // Can generally look nicer to pad a little even if code imposes more stringency
631- 'padded-blocks' : 0 ,
632639 } ,
633640 } ,
634641] ) ;
@@ -666,12 +673,15 @@ index.configs['default-expressions'] = /** @type {import('eslint').Linter.Config
666673 'no-empty-function' : 0 ,
667674 'no-new' : 0 ,
668675 'no-unused-expressions' : 0 ,
669- quotes : [
670- 'error' , 'double' ,
671- ] ,
672- semi : [
673- 'error' , 'never' ,
674- ] ,
676+ /* c8 ignore next 8 -- Coercion should work */
677+ ...( semver . gte ( semver . coerce ( ESLint . version ) ?? '9.0.0' , '9.0.0' ) ? { } : {
678+ quotes : [
679+ 'error' , 'double' ,
680+ ] ,
681+ semi : [
682+ 'error' , 'never' ,
683+ ] ,
684+ } ) ,
675685 strict : 0 ,
676686 } ,
677687 } ,
0 commit comments