updated monaco , Added intellisense and linting to report editor js

This commit is contained in:
2022-01-12 20:05:10 +00:00
parent 879ba591f1
commit 8fe3a31d70
6 changed files with 110 additions and 17 deletions

View File

@@ -778,7 +778,73 @@ TODO: 1 BETA DOCS:
This would have caught Joyce's errors in js code, also maybe there is a linter for other things too which woudl help with css issues etc This would have caught Joyce's errors in js code, also maybe there is a linter for other things too which woudl help with css issues etc
working version:
"monaco-editor": "^0.21.3",
"monaco-editor-webpack-plugin": "^2.1.0",
https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin
monaco-editor@0.19.2 '0.19.2'
monaco-editor@0.19.3 '0.19.3'
monaco-editor@0.20.0 '0.20.0'
monaco-editor@0.21.0 '0.21.0'
monaco-editor@0.21.1 '0.21.1'
monaco-editor@0.21.2 '0.21.2'
monaco-editor@0.21.3 '0.21.3'
monaco-editor@0.22.0 '0.22.0'
monaco-editor@0.22.1 '0.22.1'
monaco-editor@0.22.2 '0.22.2'
monaco-editor@0.22.3 '0.22.3'
monaco-editor@0.23.0 '0.23.0'
monaco-editor@0.24.0 '0.24.0'
monaco-editor@0.25.0 '0.25.0'
monaco-editor@0.25.1 '0.25.1'
monaco-editor@0.25.2 '0.25.2'
monaco-editor@0.26.0 '0.26.0'
monaco-editor@0.26.1 '0.26.1'
monaco-editor@0.27.0 '0.27.0'
monaco-editor@0.28.0 '0.28.0'
monaco-editor@0.28.1 '0.28.1'
monaco-editor@0.29.0 '0.29.0'
monaco-editor@0.29.1 '0.29.1'
monaco-editor@0.30.0 '0.30.0'
monaco-editor@0.30.1 '0.30.1'
monaco-editor@0.31.0 '0.31.0'
monaco-editor@0.31.1 '0.31.1'
C:\data\code\raven-client\ayanova>npm show monaco-editor-webpack-plugin@* version
monaco-editor-webpack-plugin@1.0.0 '1.0.0'
monaco-editor-webpack-plugin@1.1.0 '1.1.0'
monaco-editor-webpack-plugin@1.2.0 '1.2.0'
monaco-editor-webpack-plugin@1.2.1 '1.2.1'
monaco-editor-webpack-plugin@1.3.0 '1.3.0'
monaco-editor-webpack-plugin@1.4.0 '1.4.0'
monaco-editor-webpack-plugin@1.5.0 '1.5.0'
monaco-editor-webpack-plugin@1.5.1 '1.5.1'
monaco-editor-webpack-plugin@1.5.2 '1.5.2'
monaco-editor-webpack-plugin@1.5.3 '1.5.3'
monaco-editor-webpack-plugin@1.5.4 '1.5.4'
monaco-editor-webpack-plugin@1.6.0 '1.6.0'
monaco-editor-webpack-plugin@1.7.0 '1.7.0'
monaco-editor-webpack-plugin@1.8.0 '1.8.0'
monaco-editor-webpack-plugin@1.8.1 '1.8.1'
monaco-editor-webpack-plugin@1.8.2 '1.8.2'
monaco-editor-webpack-plugin@1.9.0 '1.9.0'
monaco-editor-webpack-plugin@1.9.1 '1.9.1'
monaco-editor-webpack-plugin@2.0.0 '2.0.0'
monaco-editor-webpack-plugin@2.1.0 '2.1.0'
monaco-editor-webpack-plugin@3.0.0 '3.0.0'
monaco-editor-webpack-plugin@3.0.1 '3.0.1'
monaco-editor-webpack-plugin@3.1.0 '3.1.0'
monaco-editor-webpack-plugin@4.0.0 '4.0.0'
monaco-editor-webpack-plugin@4.1.0 '4.1.0'
monaco-editor-webpack-plugin@4.1.1 '4.1.1'
monaco-editor-webpack-plugin@4.1.2 '4.1.2'
monaco-editor-webpack-plugin@4.2.0 '4.2.0'
monaco-editor-webpack-plugin@5.0.0 '5.0.0'
monaco-editor-webpack-plugin@6.0.0 '6.0.0'
monaco-editor-webpack-plugin@7.0.0 '7.0.0'
monaco-editor-webpack-plugin@7.0.1 '7.0.1'
- 1: Report templates code - 1: Report templates code
go through every report, look at javascript in preparedata and determine if any weirdnesses go through every report, look at javascript in preparedata and determine if any weirdnesses
for example the customer z_replaceCarriage return with space code is using an undeclared variable n (which is also redundant anyway) ((javascript is insanely forgiving)) for example the customer z_replaceCarriage return with space code is using an undeclared variable n (which is also redundant anyway) ((javascript is insanely forgiving))

View File

@@ -21,8 +21,8 @@
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"luxon": "^1.28.0", "luxon": "^1.28.0",
"marked": "^1.2.9", "marked": "^1.2.9",
"monaco-editor": "^0.21.3", "monaco-editor": "^0.22.3",
"monaco-editor-webpack-plugin": "^2.1.0", "monaco-editor-webpack-plugin": "^3.1.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"register-service-worker": "^1.7.2", "register-service-worker": "^1.7.2",
"vue": "^2.6.14", "vue": "^2.6.14",
@@ -10126,19 +10126,19 @@
} }
}, },
"node_modules/monaco-editor": { "node_modules/monaco-editor": {
"version": "0.21.3", "version": "0.22.3",
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.21.3.tgz", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.22.3.tgz",
"integrity": "sha512-9N7wATLpi+googstvtm6IKg97vPQ77FDYEpkow5tLriM/VJ0DaTRyUP4UVzcoH7KlPDX+e/rE7/imcOUeGkT6g==" "integrity": "sha512-RM559z2CJbczZ3k2b+ouacMINkAYWwRit4/vs0g2X/lkYefDiu0k2GmgWjAuiIpQi+AqASPOKvXNmYc8KUSvVQ=="
}, },
"node_modules/monaco-editor-webpack-plugin": { "node_modules/monaco-editor-webpack-plugin": {
"version": "2.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-2.1.0.tgz", "resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-3.1.0.tgz",
"integrity": "sha512-DG7Dpo/ItWEOl/BG2egc/UIiHoCbHjq0EOF0E6eJQT+6QNZBOfSVU4GxaXG+kQJXB8rauxli96Xp1ITnNLZtSw==", "integrity": "sha512-TP5NkCAV0OeFTry5k/d60KR7CkhTXL4kgJKtE3BzjgbDb5TGEPEhoKmHBrSa6r7Oc0sNbPLZhKD/TP2ig7A+/A==",
"dependencies": { "dependencies": {
"loader-utils": "^2.0.0" "loader-utils": "^2.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"monaco-editor": "0.21.x", "monaco-editor": "0.22.x || 0.23.x || 0.24.x",
"webpack": "^4.5.0 || 5.x" "webpack": "^4.5.0 || 5.x"
} }
}, },
@@ -24759,14 +24759,14 @@
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
}, },
"monaco-editor": { "monaco-editor": {
"version": "0.21.3", "version": "0.22.3",
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.21.3.tgz", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.22.3.tgz",
"integrity": "sha512-9N7wATLpi+googstvtm6IKg97vPQ77FDYEpkow5tLriM/VJ0DaTRyUP4UVzcoH7KlPDX+e/rE7/imcOUeGkT6g==" "integrity": "sha512-RM559z2CJbczZ3k2b+ouacMINkAYWwRit4/vs0g2X/lkYefDiu0k2GmgWjAuiIpQi+AqASPOKvXNmYc8KUSvVQ=="
}, },
"monaco-editor-webpack-plugin": { "monaco-editor-webpack-plugin": {
"version": "2.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-2.1.0.tgz", "resolved": "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-3.1.0.tgz",
"integrity": "sha512-DG7Dpo/ItWEOl/BG2egc/UIiHoCbHjq0EOF0E6eJQT+6QNZBOfSVU4GxaXG+kQJXB8rauxli96Xp1ITnNLZtSw==", "integrity": "sha512-TP5NkCAV0OeFTry5k/d60KR7CkhTXL4kgJKtE3BzjgbDb5TGEPEhoKmHBrSa6r7Oc0sNbPLZhKD/TP2ig7A+/A==",
"requires": { "requires": {
"loader-utils": "^2.0.0" "loader-utils": "^2.0.0"
}, },

View File

@@ -22,8 +22,8 @@
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"luxon": "^1.28.0", "luxon": "^1.28.0",
"marked": "^1.2.9", "marked": "^1.2.9",
"monaco-editor": "^0.21.3", "monaco-editor": "^0.22.3",
"monaco-editor-webpack-plugin": "^2.1.0", "monaco-editor-webpack-plugin": "^3.1.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"register-service-worker": "^1.7.2", "register-service-worker": "^1.7.2",
"vue": "^2.6.14", "vue": "^2.6.14",

View File

@@ -315,6 +315,7 @@
v-if="showWiki()" v-if="showWiki()"
:cols="currentView == view.SPLIT_VIEW ? 6 : 12" :cols="currentView == view.SPLIT_VIEW ? 6 : 12"
> >
<!-- eslint-disable vue/no-v-html -->
<div <div
:style="wikiStyle()" :style="wikiStyle()"
class="markdown-body" class="markdown-body"

View File

@@ -340,6 +340,7 @@
</v-list-item-avatar> </v-list-item-avatar>
<v-list-item-content> <v-list-item-content>
<v-list-item-title>{{ item.name }}</v-list-item-title> <v-list-item-title>{{ item.name }}</v-list-item-title>
<!-- eslint-disable vue/no-v-html -->
<v-list-item-subtitle <v-list-item-subtitle
v-html="item.viz" v-html="item.viz"
></v-list-item-subtitle> ></v-list-item-subtitle>

View File

@@ -554,6 +554,30 @@ export default {
await fetchReportData(vm); await fetchReportData(vm);
//--------------- //---------------
//setup the editor and models //setup the editor and models
//https://github.com/microsoft/monaco-editor/issues/2147
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntaxValidation: false,
noSuggestionDiagnostics: false,
diagnosticCodesToIgnore: [2393]
});
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ES6,
allowNonTsExtensions: true
});
monaco.languages.typescript.javascriptDefaults.addExtraLib(
[
"export declare global function ayGetTranslations(keys:Array): promise<void>;",
"export declare global function ayPrepareData(ayData:object): ayPrepareData: object;",
"export declare global function ayGroupByKey(reportDataArray:Array, groupByKeyName:string): Array",
"export declare global function ayGetFromAPI(route:string,token?:string): promise<object>;",
"export declare global function ayPostToAPI(route:string,data?:object,token?:string): promise<result:object>;",
"export declare global function ayGetTranslations(keys:Array): promise<void>;",
"export declare global declare namespace Handlebars {export function registerHelper(name: string, fn: HelperDelegate): void; export function registerHelper(name: HelperDeclareSpec): void;}"
].join("\n"),
"filename/facts.d.ts"
);
//Created editor models for each type of report element that can be edited //Created editor models for each type of report element that can be edited
vm.editData.template.model = monaco.editor.createModel( vm.editData.template.model = monaco.editor.createModel(
@@ -583,6 +607,7 @@ export default {
editor = monaco.editor.create(document.getElementById("editContainer"), { editor = monaco.editor.create(document.getElementById("editContainer"), {
model: vm.editData.template.model model: vm.editData.template.model
}); });
//save the initial state because we're going to move away from it immediately //save the initial state because we're going to move away from it immediately
vm.editData.template.state = editor.saveViewState(); vm.editData.template.state = editor.saveViewState();