11import { defineConfig } from '@tsslint/config' ;
2- import { convertRules } from '@tsslint/eslint' ;
2+ import { defineRules } from '@tsslint/eslint' ;
33import * as path from 'node:path' ;
44
55export default defineConfig ( {
66 rules : {
77 semantic : {
8- ...await convertRules ( {
9- '@typescript-eslint/consistent-type-imports' : [ 'warn' , {
8+ ...await defineRules ( {
9+ '@typescript-eslint/consistent-type-imports' : [ {
1010 disallowTypeAnnotations : false ,
1111 fixStyle : 'inline-type-imports' ,
1212 } ] ,
13- '@typescript-eslint/no-unnecessary-type-assertion' : 'warn' ,
13+ '@typescript-eslint/no-unnecessary-type-assertion' : true ,
1414 } ) ,
1515 } ,
1616 workspace : {
17- 'missing-dependency' ( { typescript : ts , sourceFile , reportError , languageServiceHost } ) {
18- const { noEmit } = languageServiceHost . getCompilationSettings ( ) ;
17+ 'missing-dependency' ( { typescript : ts , file , program , report } ) {
18+ const { noEmit } = program . getCompilerOptions ( ) ;
1919 if ( noEmit ) {
2020 return ;
2121 }
22- const packageJsonPath = ts . findConfigFile ( sourceFile . fileName , ts . sys . fileExists , 'package.json' ) ;
22+ const packageJsonPath = ts . findConfigFile ( file . fileName , ts . sys . fileExists , 'package.json' ) ;
2323 if ( ! packageJsonPath ) {
2424 return ;
2525 }
@@ -35,7 +35,7 @@ export default defineConfig({
3535 const parentPackageJson = ! ! parentPackageJsonPath && parentPackageJsonPath !== packageJsonPath
3636 ? JSON . parse ( ts . sys . readFile ( parentPackageJsonPath ) ?? '' )
3737 : { } ;
38- ts . forEachChild ( sourceFile , function visit ( node ) {
38+ ts . forEachChild ( file , function visit ( node ) {
3939 if (
4040 ts . isImportDeclaration ( node )
4141 && ! node . importClause ?. isTypeOnly
@@ -57,9 +57,9 @@ export default defineConfig({
5757 && ! packageJson . dependencies ?. [ moduleName ]
5858 && ! packageJson . peerDependencies ?. [ moduleName ]
5959 ) {
60- reportError (
60+ report (
6161 `Module '${ moduleName } ' should be in the dependencies.` ,
62- node . getStart ( sourceFile ) ,
62+ node . getStart ( file ) ,
6363 node . getEnd ( ) ,
6464 ) ;
6565 }
0 commit comments