Skip to content

Commit e96d3be

Browse files
committed
Add configuration files to disable linters.
Remove linters directives from generated JS file. Comments sed commands from the build script file example.
1 parent e0e6254 commit e96d3be

File tree

3 files changed

+76
-9
lines changed

3 files changed

+76
-9
lines changed

examples/js_of_ocaml/.jscsrc

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"fileExtensions": [".js"],
3+
"requireCurlyBraces": [
4+
"if",
5+
"else",
6+
"for",
7+
"while",
8+
"do",
9+
"try",
10+
"catch"
11+
],
12+
"requireSpaceAfterKeywords": [
13+
"if",
14+
"else",
15+
"for",
16+
"while",
17+
"do",
18+
"switch",
19+
"case",
20+
"return",
21+
"try",
22+
"catch",
23+
"function",
24+
"typeof"
25+
],
26+
"excludeFiles": ["**/node_modules/**", "**/bower_components/**", "**/js/todomvc.js"],
27+
"requireSpaceBeforeBlockStatements": true,
28+
"requireParenthesesAroundIIFE": true,
29+
"requireSpacesInConditionalExpression": true,
30+
"disallowSpacesInNamedFunctionExpression": {
31+
"beforeOpeningRoundBrace": true
32+
},
33+
"disallowSpacesInFunctionDeclaration": {
34+
"beforeOpeningRoundBrace": true
35+
},
36+
"disallowMultipleVarDecl": "exceptUndefined",
37+
"requireBlocksOnNewline": 1,
38+
"disallowEmptyBlocks": true,
39+
"disallowSpacesInsideArrayBrackets": true,
40+
"disallowSpacesInsideParentheses": true,
41+
"disallowQuotedKeysInObjects": true,
42+
"disallowSpaceAfterObjectKeys": true,
43+
"requireCommaBeforeLineBreak": true,
44+
"disallowSpaceAfterPrefixUnaryOperators": true,
45+
"disallowSpaceBeforePostfixUnaryOperators": true,
46+
"disallowSpaceBeforeBinaryOperators": [
47+
","
48+
],
49+
"requireSpaceBeforeBinaryOperators": true,
50+
"requireSpaceAfterBinaryOperators": true,
51+
"requireCamelCaseOrUpperCaseIdentifiers": true,
52+
"validateQuoteMarks": "'",
53+
"disallowMixedSpacesAndTabs": true,
54+
"disallowTrailingWhitespace": true,
55+
"disallowTrailingComma": true,
56+
"disallowKeywordsOnNewLine": [ "else" ],
57+
"requireLineFeedAtFileEnd": true,
58+
"requireCapitalizedConstructors": true,
59+
"requireDotNotation": true,
60+
"disallowYodaConditions": true,
61+
"disallowNewlineBeforeBlockStatements": true,
62+
"maximumLineLength": 120,
63+
"validateLineBreaks": "LF",
64+
"validateIndentation": "\t",
65+
"disallowKeywords": ["with"],
66+
"disallowSpacesInsideObjectBrackets": null,
67+
"disallowImplicitTypeConversion": ["string"],
68+
"safeContextKeyword": "self"
69+
}

examples/js_of_ocaml/build.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ ocamlbuild -use-ocamlfind \
1010
# Build JS code from the OCaml bytecode
1111
js_of_ocaml +weak.js --opt 3 -o js/todomvc.js todomvc.byte
1212

13-
# Avoid JS linters (hard to apply for auto generated JS)
14-
sed -i '' '1i\
15-
// jscs:disable
16-
' js/todomvc.js
17-
sed -i '' '1i\
18-
/* jshint ignore:start */
19-
' js/todomvc.js
13+
# To disable JS linters at a file level, you can for instance use sed:
14+
# sed -i '' '1i\
15+
# // jscs:disable
16+
# ' js/todomvc.js
17+
# sed -i '' '1i\
18+
# /* jshint ignore:start */
19+
# ' js/todomvc.js
2020

examples/js_of_ocaml/js/todomvc.js

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)