Skip to content

Commit 7b87848

Browse files
committed
fix type error
1 parent 810a751 commit 7b87848

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"stylelint-config-standard": "^22.0.0",
9797
"svelte": "^3.37.0",
9898
"ts-node": "^10.0.0",
99-
"typescript": "^4.2.4",
99+
"typescript": "^4.4.2",
100100
"vue-eslint-editor": "^1.1.0",
101101
"vue-eslint-parser": "^7.6.0",
102102
"vuepress": "^1.8.2"

src/rules/valid-compile.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ export default createRule("valid-compile", {
344344
return []
345345
}
346346
return result.warnings
347-
} catch (e) {
347+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ignore
348+
} catch (e: any) {
348349
// console.log(code)
349350
return [
350351
{

tests/utils/utils.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,6 @@ function* itrListupInput(rootDir: string): IterableIterator<string> {
149149
}
150150
}
151151

152-
function exists(f: string) {
153-
try {
154-
fs.statSync(f)
155-
return true
156-
} catch (error) {
157-
if (error.code === "ENOENT") {
158-
return false
159-
}
160-
throw error
161-
}
162-
}
163-
164152
function writeFixtures(
165153
ruleName: string,
166154
inputFile: string,
@@ -190,7 +178,7 @@ function writeFixtures(
190178
},
191179
config.filename,
192180
)
193-
if (force || !exists(errorFile)) {
181+
if (force || !fs.existsSync(errorFile)) {
194182
fs.writeFileSync(
195183
errorFile,
196184
`${JSON.stringify(
@@ -206,7 +194,7 @@ function writeFixtures(
206194
)
207195
}
208196

209-
if (force || !exists(outputFile)) {
197+
if (force || !fs.existsSync(outputFile)) {
210198
const output = applyFixes(config.code, result).output
211199

212200
if (plugin.rules[ruleName].meta.fixable != null) {
@@ -229,10 +217,10 @@ function getConfig(ruleName: string, inputFile: string) {
229217
const code = fs.readFileSync(inputFile, "utf8")
230218
let config
231219
let configFile: string = inputFile.replace(/input\.svelte$/u, "config.json")
232-
if (!exists(configFile)) {
220+
if (!fs.existsSync(configFile)) {
233221
configFile = path.join(path.dirname(inputFile), "_config.json")
234222
}
235-
if (exists(configFile)) {
223+
if (fs.existsSync(configFile)) {
236224
config = JSON.parse(fs.readFileSync(configFile, "utf8"))
237225
}
238226
if (config && typeof config === "object") {

0 commit comments

Comments
 (0)