1
1
import { defineConfig } from '@tsslint/config' ;
2
- import { convertRules } from '@tsslint/eslint' ;
2
+ import { defineRules } from '@tsslint/eslint' ;
3
3
import * as path from 'node:path' ;
4
4
5
5
export default defineConfig ( {
6
6
rules : {
7
7
semantic : {
8
- ...await convertRules ( {
9
- '@typescript-eslint/consistent-type-imports' : [ 'warn' , {
8
+ ...await defineRules ( {
9
+ '@typescript-eslint/consistent-type-imports' : [ {
10
10
disallowTypeAnnotations : false ,
11
11
fixStyle : 'inline-type-imports' ,
12
12
} ] ,
13
- '@typescript-eslint/no-unnecessary-type-assertion' : 'warn' ,
13
+ '@typescript-eslint/no-unnecessary-type-assertion' : true ,
14
14
} ) ,
15
15
} ,
16
16
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 ( ) ;
19
19
if ( noEmit ) {
20
20
return ;
21
21
}
22
- const packageJsonPath = ts . findConfigFile ( sourceFile . fileName , ts . sys . fileExists , 'package.json' ) ;
22
+ const packageJsonPath = ts . findConfigFile ( file . fileName , ts . sys . fileExists , 'package.json' ) ;
23
23
if ( ! packageJsonPath ) {
24
24
return ;
25
25
}
@@ -35,7 +35,7 @@ export default defineConfig({
35
35
const parentPackageJson = ! ! parentPackageJsonPath && parentPackageJsonPath !== packageJsonPath
36
36
? JSON . parse ( ts . sys . readFile ( parentPackageJsonPath ) ?? '' )
37
37
: { } ;
38
- ts . forEachChild ( sourceFile , function visit ( node ) {
38
+ ts . forEachChild ( file , function visit ( node ) {
39
39
if (
40
40
ts . isImportDeclaration ( node )
41
41
&& ! node . importClause ?. isTypeOnly
@@ -57,9 +57,9 @@ export default defineConfig({
57
57
&& ! packageJson . dependencies ?. [ moduleName ]
58
58
&& ! packageJson . peerDependencies ?. [ moduleName ]
59
59
) {
60
- reportError (
60
+ report (
61
61
`Module '${ moduleName } ' should be in the dependencies.` ,
62
- node . getStart ( sourceFile ) ,
62
+ node . getStart ( file ) ,
63
63
node . getEnd ( ) ,
64
64
) ;
65
65
}
0 commit comments