File tree Expand file tree Collapse file tree 3 files changed +21
-17
lines changed
Expand file tree Collapse file tree 3 files changed +21
-17
lines changed Original file line number Diff line number Diff line change 1818 "devDependencies" : {
1919 "@lerna-lite/cli" : " latest" ,
2020 "@lerna-lite/publish" : " latest" ,
21- "@tsslint/config" : " 3.0.2" ,
2221 "@types/node" : " latest" ,
2322 "@typescript-eslint/eslint-plugin" : " latest" ,
2423 "dprint" : " latest" ,
Original file line number Diff line number Diff line change @@ -41,15 +41,16 @@ const loader = async (moduleName: string) => {
4141export async function importESLintRules (
4242 config : { [ K in keyof ESLintRulesConfig ] : RuleSeverity | [ RuleSeverity , ...ESLintRulesConfig [ K ] ] } ,
4343 context : Partial < ESLint . Rule . RuleContext > = { } ,
44+ getConvertRule = async ( ) => {
45+ try {
46+ return ( await import ( '@tsslint/compat-eslint' ) ) . convertRule ;
47+ }
48+ catch {
49+ throw new Error ( 'Please install @tsslint/compat-eslint to use importESLintRules().' ) ;
50+ }
51+ } ,
4452) {
45- let convertRule : typeof import ( '@tsslint/compat-eslint' ) . convertRule ;
46- try {
47- ( { convertRule } = await import ( '@tsslint/compat-eslint' ) ) ;
48- }
49- catch {
50- throw new Error ( 'Please install @tsslint/compat-eslint to use importESLintRules().' ) ;
51- }
52-
53+ const convertRule = await getConvertRule ( ) ;
5354 const rules : TSSLint . Rules = { } ;
5455 for ( const [ rule , severityOrOptions ] of Object . entries ( config ) ) {
5556 let severity : RuleSeverity ;
Original file line number Diff line number Diff line change 1- import { defineConfig , importESLintRules } from '@tsslint/ config' ;
1+ import { defineConfig , importESLintRules } from './packages/ config/index.js ' ;
22
33export default defineConfig ( {
4- rules : await importESLintRules ( {
5- '@typescript-eslint/consistent-type-imports' : [ true , {
6- disallowTypeAnnotations : false ,
7- fixStyle : 'inline-type-imports' ,
8- } ] ,
9- '@typescript-eslint/no-unnecessary-type-assertion' : true ,
10- } ) ,
4+ rules : await importESLintRules (
5+ {
6+ '@typescript-eslint/consistent-type-imports' : [ true , {
7+ disallowTypeAnnotations : false ,
8+ fixStyle : 'inline-type-imports' ,
9+ } ] ,
10+ '@typescript-eslint/no-unnecessary-type-assertion' : true ,
11+ } ,
12+ { } ,
13+ async ( ) => ( await import ( './packages/compat-eslint/index.js' ) ) . convertRule ,
14+ ) ,
1115} ) ;
You can’t perform that action at this time.
0 commit comments