Skip to content

Commit

Permalink
perf: drop ESLint 3 support (seriously?)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Jul 11, 2024
1 parent 5c1a6db commit de353f4
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/utils/export-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export class ExportMap {
return getter
}

const source = makeSourceCode(content, ast)
const source = new SourceCode({ text: content, ast: ast as AST.Program })

function isEsModuleInterop() {
const parserOptions = context.parserOptions || {}
Expand Down Expand Up @@ -1128,16 +1128,3 @@ function makeContextCacheKey(context: RuleContext | ChildContext) {

return hash
}

/**
* sometimes legacy support isn't _that_ hard... right?
*/
function makeSourceCode(text: string, ast: TSESTree.Program) {
if (SourceCode.length > 1) {
// ESLint 3
return new SourceCode(text, ast as AST.Program)
}

// ESLint 4+
return new SourceCode({ text, ast: ast as AST.Program })
}

0 comments on commit de353f4

Please sign in to comment.