Skip to content

Commit

Permalink
fix: state sky
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjiaxuan committed Mar 13, 2023
1 parent 22ff809 commit d1479c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ const resolveESLintPath = () => Files.resolve(`eslint${ useFlatConfig ? '/use-at
})

export const getESLintInstance = async (context: ExtensionContext) => {
let eslintPath = context.workspaceState.get<string>(useFlatConfig ? 'flatESLintPath' : 'eslintPath')
const stateKey = useFlatConfig ? 'flatESLintPath' : 'eslintPath'
let eslintPath = context.workspaceState.get<string>(stateKey)
if (eslintPath && await existFile(eslintPath)) {
log(`${ useFlatConfig ? 'Flat ' : '' }ESLint path found from storage`)
} else {
eslintPath = await resolveESLintPath()
void context.workspaceState.update('eslintPath', eslintPath)
void context.workspaceState.update(stateKey, eslintPath)
}

const eslintModule = await import(path.join(eslintPath)) as {
Expand Down

0 comments on commit d1479c5

Please sign in to comment.