Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
0b7ed9ad
Commit
0b7ed9ad
authored
Nov 09, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monaco_editor: also lint javascript with jslint
parent
9b86cf7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.html
...l_skins/erp5_monaco_editor/monaco-editor.gadget.html.html
+1
-0
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js
...ortal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js
+29
-2
No files found.
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.html
View file @
0b7ed9ad
...
...
@@ -7,6 +7,7 @@
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"jslint.js"
type=
"text/javascript"
></script>
<script
src=
"monaco-editor/prettier@1.14.0/standalone.js"
></script>
<script
src=
"monaco-editor/prettier@1.14.0/parser-babylon.js"
></script>
...
...
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js
View file @
0b7ed9ad
/*jslint nomen: true, indent: 2 */
/*global window, rJS, monaco*/
/*global window, rJS, monaco
, JSLINT
*/
(
function
(
window
,
rJS
,
monaco
)
{
'
use strict
'
;
...
...
@@ -49,6 +49,29 @@
editor
.
getModel
().
onDidChangeContent
(
deferNotifyChange
);
})
.
declareJob
(
'
runJsLint
'
,
function
()
{
var
context
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
delay
(
500
);
})
.
push
(
function
()
{
if
(
context
.
state
.
model_language
===
'
javascript
'
)
{
JSLINT
(
context
.
editor
.
getValue
(),
{});
monaco
.
editor
.
setModelMarkers
(
context
.
editor
.
getModel
(),
'
jslint
'
,
JSLINT
.
data
()
.
errors
.
filter
(
Boolean
)
.
map
(
err
=>
({
startLineNumber
:
err
.
line
,
startColumn
:
err
.
character
,
message
:
err
.
reason
,
severity
:
monaco
.
Severity
.
Error
,
source
:
'
jslint
'
}))
);
}
});
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
model_language
,
state_dict
=
{
...
...
@@ -112,7 +135,11 @@
}
);
// Annotations for javascript
// lint with jslint
this
.
editor
.
getModel
().
onDidChangeContent
(
this
.
runJsLint
.
bind
(
this
));
this
.
runJsLint
();
// lint with typescript compiler
monaco
.
languages
.
typescript
.
javascriptDefaults
.
setDiagnosticsOptions
({
noSemanticValidation
:
false
,
noSyntaxValidation
:
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment