Skip to content

Commit

Permalink
Fix a few website issues (#491)
Browse files Browse the repository at this point in the history
* Lint wasn't running on all files, so enable it and fix some existing lint
  errors.
* Disable in-editor suggestion diagnostics.
* Enable optional chaining and nullish coalescing in Babel and TypeScript
  config.
  • Loading branch information
alangpierce committed Dec 28, 2019
1 parent 4f8efe9 commit b475b8c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
],
"import/no-mutable-exports": "off",
"import/prefer-default-export": "off",
"import/no-unresolved": "off",
"lines-between-class-members": "off",
"max-classes-per-file": "off",
"no-await-in-loop": "off",
Expand Down
2 changes: 1 addition & 1 deletion script/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function checkProject(path: string): Promise<void> {
await Promise.all([
run(`${TSC} --project ${path} --noEmit`),
run(`${TSLINT} --project ${path}`),
run(`${ESLINT} '${path}/src/**/*.ts'`),
run(`${ESLINT} '${path}/src/**/*.{ts,tsx}'`),
]);
}

Expand Down
5 changes: 3 additions & 2 deletions website/src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export default class Editor extends Component<EditorProps> {
setTimeout(this.invalidate, 0);
}

_editorDidMount: EditorDidMount = (editor, monaco) => {
this.editor = editor;
_editorDidMount: EditorDidMount = (monacoEditor, monaco) => {
this.editor = monacoEditor;
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
noSemanticValidation: true,
noSyntaxValidation: true,
noSuggestionDiagnostics: true,
});
this.invalidate();
};
Expand Down
4 changes: 3 additions & 1 deletion website/src/Worker.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ function runBabel(): {code: string; time: number | null} {
"proposal-export-namespace-from",
"proposal-numeric-separator",
"proposal-optional-catch-binding",
"proposal-nullish-coalescing-operator",
"proposal-optional-chaining",
"dynamic-import-node",
],
parserOpts: {
Expand Down Expand Up @@ -159,7 +161,7 @@ function runTypeScript(): {code: string; time: number | null} {
compilerOptions: {
module: config.selectedTransforms.imports ? ModuleKind.CommonJS : ModuleKind.ESNext,
jsx: config.selectedTransforms.jsx ? JsxEmit.React : JsxEmit.Preserve,
target: ScriptTarget.ESNext,
target: ScriptTarget.ES2020,
},
}).outputText,
);
Expand Down

0 comments on commit b475b8c

Please sign in to comment.