Skip to content

Commit

Permalink
fix: im not sure
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjiaxuan committed Mar 13, 2023
1 parent 20790a2 commit d4d5d39
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.experimental.useFlatConfig": true
}
7 changes: 7 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// import lvjiaxuan from '@lvjiaxuan/eslint-plugin/flat'

// /** @type {import('eslint').Linter.FlatConfig} */
// export default lvjiaxuan.configs.recommended

const lvjiaxuan = require('@lvjiaxuan/eslint-plugin/flat')
module.exports = lvjiaxuan.configs.recommended
299 changes: 168 additions & 131 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,24 @@
]
},
"scripts": {
"compile": "tsup src/extension.ts --external=vscode --format=cjs --shims=false --clean",
"compile": "tsup src/extension.ts --external=vscode --clean",
"dev": "nr compile --watch",
"vscode:prepublish": "nr compile",
"pretest": "nr compile && nr lint",
"lint": "eslint .",
"pack": "vsce package",
"publish": "vsce publish",
"release": "nx jiti release.ts"
"publish": "vsce publish"
},
"dependencies": {
"vscode-languageserver": "^8.1.0"
},
"devDependencies": {
"@lvjiaxuan/eslint-plugin": "^0.8.3",
"@lvjiaxuan/eslint-plugin": "^0.10.1",
"@types/eslint": "^8.21.1",
"@types/node": "^18.14.6",
"@types/node": "^18.15.0",
"@types/vscode": "1.60.0",
"eslint": "^8.35.0",
"eslint": "^8.36.0",
"tsup": "^6.6.3",
"typescript": "^4.9.5"
},
"eslintConfig": {
"extends": "plugin:@lvjiaxuan/recommended"
}
}
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type LineNumber = number
type LineRules = Set<string>
const lintingCache = new Map<FileName, Map<LineNumber, LineRules>>()

let reLintingTimer: NodeJS.Timeout
let reLintingTimer: ReturnType<typeof setTimeout>

let extensionContext: ExtensionContext

Expand Down
2 changes: 1 addition & 1 deletion src/statusBarItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const showStatusBarItem = (text: string, time = 5000) => {
time > 0 && hideStatusBarItem(time)
}

let hideTimer: NodeJS.Timeout
let hideTimer: ReturnType<typeof setTimeout>
export const hideStatusBarItem = (delay = 5000) => {
clearTimeout(hideTimer)
hideTimer = setTimeout(() => statusBarItem.hide(), delay)
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export const getTextBylines = (startLine: number, endLine?: number) =>

export function existFile(file: string): Promise<boolean> {
return new Promise<boolean>((resolve, _reject) => {
// keep
// console.log(file)
fs.stat(file, (error, stats) => {
if (error !== null) {
resolve(false)
}
resolve(stats.isFile())
resolve(stats?.isFile() ?? false)
})
})
}

0 comments on commit d4d5d39

Please sign in to comment.