Skip to content

Commit

Permalink
fix(website): deduplicate imports
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Mar 30, 2022
1 parent 49a5557 commit 271530a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/website-eslint/src/linter/CompilerHost.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { getDefaultLibFileName } from 'typescript';
import { ScriptKind } from 'typescript';
import {
getDefaultLibFileName,
ScriptKind,
createSourceFile,
ScriptTarget,
} from 'typescript';

function getScriptKind(isJsx, filePath) {
const extension = (/(\.[a-z]+)$/.exec(filePath)?.[0] || '').toLowerCase();
Expand All @@ -20,7 +24,7 @@ function getScriptKind(isJsx, filePath) {

default:
// unknown extension, force typescript to ignore the file extension, and respect the user's setting
return isJsx ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
return isJsx ? ScriptKind.TSX : ScriptKind.TS;
}
}

Expand Down Expand Up @@ -77,10 +81,10 @@ export class CompilerHost {
}

getSourceFile(name) {
return ts.createSourceFile(
return createSourceFile(
name,
this.readFile(name),
ts.ScriptTarget.Latest,
ScriptTarget.Latest,
/* setParentNodes */ true,
getScriptKind(this.isJsx, name),
);
Expand Down

0 comments on commit 271530a

Please sign in to comment.