@@ -5,7 +5,7 @@ import makeSynchronous from "make-synchronous"
55import { findOneFile } from "./utils.cjs"
66import type { GlobifiedEntry } from "globify-gitignore"
77
8- const tsFiles = [ "**/*.tsx" , "**/*.ts" ]
8+ const tsFiles = [ "**/*.tsx" , "**/*.ts" , "**/*.mts" , "**/*.cts" ]
99const project = [ "**/tsconfig.json" , "!**/node_modules/**/tsconfig.json" ]
1010
1111function globifyGitIgnoreFileWithDeps ( cwd : string , include : boolean ) {
@@ -20,9 +20,11 @@ const globifyGitIgnoreFileSync = makeSynchronous(globifyGitIgnoreFileWithDeps) a
2020
2121/** Check if there are any tsconfig.json files */
2222function disableProjectBasedRules ( ) {
23+ const cwd = process . cwd ( )
24+
2325 // get all the files that are ignored by git
2426 const ignore =
25- globifyGitIgnoreFileSync ( "." , true ) ?. map ( ( entry ) => {
27+ globifyGitIgnoreFileSync ( cwd , true ) ?. map ( ( entry ) => {
2628 if ( entry . included ) {
2729 return `!${ entry . glob } `
2830 }
@@ -38,13 +40,15 @@ function disableProjectBasedRules() {
3840 )
3941
4042 // 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
4246 if ( ! hasTsFile ) {
4347 return true
4448 }
4549
4650 // check if there is a tsconfig.json file
47- const hasTsConfig = findOneFile ( process . cwd ( ) , project , ignore )
51+ const hasTsConfig = findOneFile ( cwd , project , ignore )
4852
4953 // if there is no tsconfig.json file, but there are ts files, disable the project-based rules
5054 const disable = ! hasTsConfig && hasTsFile
0 commit comments