Commit 310121f8 authored by Jérome Perrin's avatar Jérome Perrin

monaco_editor: lint javascript with typescript compiler

Because typescript is a subset of javascript, running typescript
compiler on javascript files can already report several issues.

https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html
parent c133fa43
...@@ -112,6 +112,20 @@ ...@@ -112,6 +112,20 @@
} }
); );
// Annotations for javascript
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntaxValidation: false
});
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ES6,
allowNonTsExtensions: true,
checkJs: true,
allowJs: true,
module: monaco.languages.typescript.ModuleKind.UMD
});
// Type mapping for Nexedi libraries // Type mapping for Nexedi libraries
function addExtraLibrary(script_name, lib_name) { function addExtraLibrary(script_name, lib_name) {
return fetch(script_name) return fetch(script_name)
......
...@@ -136,6 +136,19 @@ $script.onload = function() { ...@@ -136,6 +136,19 @@ $script.onload = function() {
}, },
}); });
// lint javascript with typescript compiler
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntaxValidation: false
});
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ES6,
allowNonTsExtensions: true,
checkJs: true,
allowJs: true,
module: monaco.languages.typescript.ModuleKind.UMD
});
// Type mapping for Nexedi libraries // Type mapping for Nexedi libraries
function addExtraLibrary(script_name, lib_name) { function addExtraLibrary(script_name, lib_name) {
return fetch(script_name) return fetch(script_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment