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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
ff7bb55d
Commit
ff7bb55d
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
310121f8
Changes
2
Show 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 @
ff7bb55d
...
...
@@ -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 @
ff7bb55d
/*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
.
MarkerSeverity
.
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