|
1 | 1 | import { eslintRulesExtra } from "./official-eslint-rules" |
2 | 2 | import { pluginImportRulesExtra, pluginImportTypeScriptRulesExtra } from "./plugin-import-rules" |
3 | 3 | import { pluginNodeRules } from "./plugin-node-rules" |
4 | | -import { globifyGitIgnoreFile } from "globify-gitignore" |
5 | 4 | import makeSynchronous from "make-synchronous" |
6 | 5 | import { findOneFile } from "./utils" |
7 | 6 |
|
8 | 7 | const tsFiles = ["**/*.tsx", "**/*.ts"] |
9 | 8 | const project = ["**/tsconfig.json", "!**/node_modules/**/tsconfig.json"] |
10 | 9 |
|
| 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 | + |
11 | 16 | /** Check if there are any tsconfig.json files */ |
12 | | -async function disableProjectBasedRules() { |
| 17 | +function disableProjectBasedRules() { |
13 | 18 | // get all the files that are ignored by git |
14 | | - const ignore = (await globifyGitIgnoreFile(".", true)).map((entry) => { |
| 19 | + const ignore = globifyGitIgnoreFileSync(".", true).map((entry) => { |
15 | 20 | if (entry.included) { |
16 | 21 | return `!${entry.glob}` |
17 | 22 | } |
@@ -75,7 +80,7 @@ const pluginTypeScriptRulesExtra = { |
75 | 80 | // "@typescript-eslint/prefer-string-starts-ends-with": "error", |
76 | 81 | } |
77 | 82 |
|
78 | | -const pluginTypeScriptProjectRules = makeSynchronous(disableProjectBasedRules)() |
| 83 | +const pluginTypeScriptProjectRules = disableProjectBasedRules() |
79 | 84 | ? {} |
80 | 85 | : { |
81 | 86 | "@typescript-eslint/no-floating-promises": "error", |
|
0 commit comments