#21 edit jshint options to be more lax for semicolons

This commit is contained in:
Cassie Tarakajian 2016-12-13 16:59:47 -05:00
parent f9c7a374d1
commit f3247bd0ef
2 changed files with 18 additions and 13 deletions

View file

@ -4,7 +4,6 @@ import CodeMirror from 'codemirror';
import beautifyJS from 'js-beautify';
const beautifyCSS = beautifyJS.css;
const beautifyHTML = beautifyJS.html;
import 'codemirror/mode/javascript/javascript';
import '../../../utils/p5-javascript';
import 'codemirror/mode/css/css';
import 'codemirror/mode/htmlmixed/htmlmixed';
@ -59,7 +58,10 @@ class Editor extends React.Component {
if (this.props.lintMessages.length > 0 && this.props.lintWarning) {
this.beep.play();
}
}, 2000)
}, 2000),
options: {
asi: true
}
}
});
@ -133,7 +135,7 @@ class Editor extends React.Component {
getFileMode(fileName) {
let mode;
if (fileName.match(/.+\.js$/i)) {
mode = 'p5-javascript';
mode = 'javascript';
} else if (fileName.match(/.+\.css$/i)) {
mode = 'css';
} else if (fileName.match(/.+\.html$/i)) {

View file

@ -17,7 +17,7 @@ function expressionAllowed(stream, state, backUp) {
(state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
}
CodeMirror.defineMode("p5-javascript", function(config, parserConfig) {
CodeMirror.defineMode("javascript", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var statementIndent = parserConfig.statementIndent;
var jsonldMode = parserConfig.jsonld;
@ -830,7 +830,7 @@ CodeMirror.defineMode("p5-javascript", function(config, parserConfig) {
fold: "brace",
closeBrackets: "()[]{}''\"\"``",
helperType: jsonMode ? "json" : "p5-javascript",
helperType: jsonMode ? "json" : "javascript",
jsonldMode: jsonldMode,
jsonMode: jsonMode,
@ -842,14 +842,17 @@ CodeMirror.defineMode("p5-javascript", function(config, parserConfig) {
};
});
CodeMirror.registerHelper("wordChars", "p5-javascript", /[\w$]/);
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
CodeMirror.defineMIME("text/javascript", "p5-javascript");
CodeMirror.defineMIME("text/ecmascript", "p5-javascript");
CodeMirror.defineMIME("application/javascript", "p5-javascript");
CodeMirror.defineMIME("application/x-javascript", "p5-javascript");
CodeMirror.defineMIME("application/ecmascript", "p5-javascript");
CodeMirror.defineMIME("text/typescript", { name: "p5-javascript", typescript: true });
CodeMirror.defineMIME("application/typescript", { name: "p5-javascript", typescript: true });
CodeMirror.defineMIME("text/javascript", "javascript");
CodeMirror.defineMIME("text/ecmascript", "javascript");
CodeMirror.defineMIME("application/javascript", "javascript");
CodeMirror.defineMIME("application/x-javascript", "javascript");
CodeMirror.defineMIME("application/ecmascript", "javascript");
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
});