@@ -5,7 +5,7 @@ import makeSynchronous from "make-synchronous"
5
5
import { findOneFile } from "./utils.cjs"
6
6
import type { GlobifiedEntry } from "globify-gitignore"
7
7
8
- const tsFiles = [ "**/*.tsx" , "**/*.ts" ]
8
+ const tsFiles = [ "**/*.tsx" , "**/*.ts" , "**/*.mts" , "**/*.cts" ]
9
9
const project = [ "**/tsconfig.json" , "!**/node_modules/**/tsconfig.json" ]
10
10
11
11
function globifyGitIgnoreFileWithDeps ( cwd : string , include : boolean ) {
@@ -20,9 +20,11 @@ const globifyGitIgnoreFileSync = makeSynchronous(globifyGitIgnoreFileWithDeps) a
20
20
21
21
/** Check if there are any tsconfig.json files */
22
22
function disableProjectBasedRules ( ) {
23
+ const cwd = process . cwd ( )
24
+
23
25
// get all the files that are ignored by git
24
26
const ignore =
25
- globifyGitIgnoreFileSync ( "." , true ) ?. map ( ( entry ) => {
27
+ globifyGitIgnoreFileSync ( cwd , true ) ?. map ( ( entry ) => {
26
28
if ( entry . included ) {
27
29
return `!${ entry . glob } `
28
30
}
@@ -38,13 +40,15 @@ function disableProjectBasedRules() {
38
40
)
39
41
40
42
// check if there are any ts files
41
- const hasTsFile = findOneFile ( process . cwd ( ) , tsFiles , ignore )
43
+ const hasTsFile = findOneFile ( cwd , tsFiles , ignore )
44
+
45
+ // return if there are no ts files
42
46
if ( ! hasTsFile ) {
43
47
return true
44
48
}
45
49
46
50
// check if there is a tsconfig.json file
47
- const hasTsConfig = findOneFile ( process . cwd ( ) , project , ignore )
51
+ const hasTsConfig = findOneFile ( cwd , project , ignore )
48
52
49
53
// if there is no tsconfig.json file, but there are ts files, disable the project-based rules
50
54
const disable = ! hasTsConfig && hasTsFile
0 commit comments