Skip to content

Commit 25a1acd

Browse files
committed
fix: fix globifyGitIgnoreFileSync synchronous call
1 parent 637f76d commit 25a1acd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/typescript.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
import { eslintRulesExtra } from "./official-eslint-rules"
22
import { pluginImportRulesExtra, pluginImportTypeScriptRulesExtra } from "./plugin-import-rules"
33
import { pluginNodeRules } from "./plugin-node-rules"
4-
import { globifyGitIgnoreFile } from "globify-gitignore"
54
import makeSynchronous from "make-synchronous"
65
import { findOneFile } from "./utils"
76

87
const tsFiles = ["**/*.tsx", "**/*.ts"]
98
const project = ["**/tsconfig.json", "!**/node_modules/**/tsconfig.json"]
109

10+
async function globifyGitIgnoreFileWithDeps(cwd: string, include: boolean) {
11+
const { globifyGitIgnoreFile } = require("globify-gitignore") as typeof import("globify-gitignore")
12+
return globifyGitIgnoreFile(cwd, include)
13+
}
14+
const globifyGitIgnoreFileSync = makeSynchronous(globifyGitIgnoreFileWithDeps)
15+
1116
/** Check if there are any tsconfig.json files */
12-
async function disableProjectBasedRules() {
17+
function disableProjectBasedRules() {
1318
// get all the files that are ignored by git
14-
const ignore = (await globifyGitIgnoreFile(".", true)).map((entry) => {
19+
const ignore = globifyGitIgnoreFileSync(".", true).map((entry) => {
1520
if (entry.included) {
1621
return `!${entry.glob}`
1722
}
@@ -75,7 +80,7 @@ const pluginTypeScriptRulesExtra = {
7580
// "@typescript-eslint/prefer-string-starts-ends-with": "error",
7681
}
7782

78-
const pluginTypeScriptProjectRules = makeSynchronous(disableProjectBasedRules)()
83+
const pluginTypeScriptProjectRules = disableProjectBasedRules()
7984
? {}
8085
: {
8186
"@typescript-eslint/no-floating-promises": "error",

0 commit comments

Comments
 (0)