@@ -4,6 +4,7 @@ import * as fs from 'fs';
44import * as path from 'path' ;
55import type * as ts from 'typescript' ;
66import type { ESLintRulesConfig } from './eslint-types.js' ;
7+ import { normalizeRuleSeverity , type RuleSeverity } from './utils.js' ;
78
89const noop = ( ) => { } ;
910const plugins : Record <
@@ -30,8 +31,6 @@ const loader = async (moduleName: string) => {
3031 return mod as any ;
3132} ;
3233
33- type Severity = boolean | 'error' | 'warn' ;
34-
3534/**
3635 * Converts an ESLint rules configuration to TSSLint rules.
3736 *
@@ -40,7 +39,7 @@ type Severity = boolean | 'error' | 'warn';
4039 * Please run `npx tsslint-docgen` to update them.
4140 */
4241export async function importESLintRules (
43- config : { [ K in keyof ESLintRulesConfig ] : Severity | [ Severity , ...ESLintRulesConfig [ K ] ] } ,
42+ config : { [ K in keyof ESLintRulesConfig ] : RuleSeverity | [ RuleSeverity , ...ESLintRulesConfig [ K ] ] } ,
4443 context : Partial < ESLint . Rule . RuleContext > = { } ,
4544) {
4645 let convertRule : typeof import ( '@tsslint/compat-eslint' ) . convertRule ;
@@ -53,7 +52,7 @@ export async function importESLintRules(
5352
5453 const rules : TSSLint . Rules = { } ;
5554 for ( const [ rule , severityOrOptions ] of Object . entries ( config ) ) {
56- let severity : Severity ;
55+ let severity : RuleSeverity ;
5756 let options : any [ ] ;
5857 if ( Array . isArray ( severityOrOptions ) ) {
5958 [ severity , ...options ] = severityOrOptions ;
@@ -62,6 +61,7 @@ export async function importESLintRules(
6261 severity = severityOrOptions ;
6362 options = [ ] ;
6463 }
64+ severity = normalizeRuleSeverity ( severity ) ;
6565 if ( ! severity ) {
6666 rules [ rule ] = noop ;
6767 continue ;
0 commit comments