Javascript linting with interactive-linter in brackets


Brackets is a great web editor that extraordinarily manages editing the gang of four of web development languages, JavaScript, HTML, CSS and JSON (not to be neglected), just in one place (or pane). What I also very much appreciate aside of that, is the built-in availability of language linting, like one may know it from PyCharm using Python-PEP’s already. However, using language linting, especially for JavaScript, takes a couple of decisions first, in particular what linting approach to employ and how to fit the selected approach to one’s needs.

To me, there are essentially four widely known approaches to JavaScript linting (jsx unregarded): jslint, jshint, jscs and eslint. jslint is the great-grandfahter of this ancestry (iff you like), originally trying to safeguard the developer against the sloppyness that is possible coding JavaScript. jslint is quite strict in judging what code performs in quality and what lines do not. Some people do get really bugged along with jslint from time to time such that jshint came up, taking things much more relaxed by being more configurable and introducing code format analysis in addition. Code format analysis then, important in team development above all, was the main topic of jscs, extending what was already available in jshint even to modern patterns of web development. eslint, eventually, may be seen as a current fork merge of jshint and jscs, taking the best of both worlds and additionally offering user-defined linting rules. In fact, the implied ancestry may become a carved picture regarding pages like jslinterrors where you can look up different rule names for the same semantics of linting in jslint, jshint and eslint, respectively.

Returning back to Brackets, the editor comes with a jslint linter included. Iff you do not like the demanding way jslint enforces code quality, you may need to have a look at the extensions for Brackets. Me, I choosed InteractiveLinter from Miguel Castillo to go on with because it offers yet another languages to lint, most notable HTML, CSS and JSON. To put InteractiveLinter into action, do add the following settings to your personal Brackets configuration file (~/.config/Brackets/brackets.json):

{
  "interactive-linter.javascript": [ "eslint", "jshint", "jscs" ],
  "interactive-linter.html": [ "htmlhint" ],
  "interactive-linter.css": [ "csslint" ],
  "interactive-linter.json": [ "jsonlint" ]
}

These settings will overwrite any original Brackets settings concerning linting for the given languages, you do not need to touch any of the "linting.*" settings you may spot in the default Brackets configuration file (~/.config/Brackets/defaultPreferences.json). However, there is one detail to delve into because some circumstance indeed puzzled me for quite a while until I dived into the code and found out eventually. That is, you see, one may supply more that one linter for a language with the above settings. Having specified more than one linter does though not execute the given linters in order (what I expected, at a first place). Only the first linter takes any effect ever (and is even read in the code). Knowing about that, one may on the other hand leave any other than the prefered linter in the settings, just following up. Knowing also, that InteractiveLinter permanently listens to changes against the personal Brackets configuration file, one may reset the linter in use on the fly. Last but not least, providing null als the prefered linter, yet even switches InteractiveLinter linting off and resets Brackets to use the original linting scheme, jslint here.

{
  "interactive-linter.javascript": [ null, "eslint", "jshint", "jscs" ]
}

Since lately, eslint is the default linter with InteractiveLinter and the extension comes with a rules file ready to start off. Anyway, I was curious to learn what is available though and what may fit my requirements best. I was also interested in persisting any findings into my own rules files such that some migration to another editor or extensions may become a lightweight operation.

Any rules files that InteractiveLinter ships, do reside with the personal extension directory (~/.config/Brackets/extensions/user/interactive-linter/plugins/default) in a file called /default.json. In addition, InteractiveLinter respects any .jshintrc or .jslintrc etc. files in your project tree. You may also opt to specify the files on lookup in detail, using a setting in the respective /settings.json files. Me, I choosed to have InteractiveLinter search for .json files because the files contents is JSON anyway and I wanted to have it readily linted in Brackets / InteractiveLinter, right? Finally, I cleared any contents from the /default.json files, not knowing what will happen for overlapping or outdated rule semantics.

What follows next is just my view on a proper rules collection for eslint, jshint and jscs with InteractiveLinter. The collection is up-to-date with the primary web resources (see above) at the time of writing around august / september 2015, having Brackets 1.4 and InteractiveLinter 1.0.5 installed. Please note that some rules have been commented because InteractiveLinter does not (yet) accept them for various reasons, mostly non-implemented newer rules or rule features. Feel free to adopt it, adapt it to your needs or blame me for having a poor understanding of web development language quality and style (iff you like :~§, I won’t care).

  • eslint.json
// pewe - crafted around aug/sep 2015 for InteractiveLinter(1.0.5)@Brackets(1.4)
// see: https://github.com/MiguelCastillo/Brackets-InteractiveLinter
// see: http://eslint.org/docs/rules/
// see: http://eslint.org/docs/user-guide/configuring.html
// see: https://jslinterrors.com/?linter=eslint
// 0 - turn the rule off
// 1 - turn the rule on as a warning (doesn't affect exit code)
// 2 - turn the rule on as an error (exit code is 1 when triggered)
{
    // Specifying Environments - global vars predefed ---------------------------------------------
    "env": {
        "browser": true,                    // browser global variables
        "jquery": true                      // jquery global variables
    },
    // Global variables - trued / falsed for overwriting
    "globals": {
        "rwVar": true,                      // global var that might be written
        "roVar": false                      // global var that might only be read
    },
    "rules": {
        // Possible Errors - mostly recommended ---------------------------------------------------
        "comma-dangle": [2, "never"],       // do not have trailing commas in lists
        "no-cond-assign": [2, "never"],     // no combined assignment and ifing
        "no-console": 0,                    // do allow console output from code
        "no-constant-condition": 2,         // no ifing against constant values
        "no-control-regex": 2,              // no 0-31 chars (non-print) in regexps
        "no-debugger": 2,                   // do not allow debugger launch from code
        "no-dupe-args": 2,                  // no duplicate function argument names
        "no-dupe-keys": 2,                  // no duplicate keys in object literals
        "no-duplicate-case": 2,             // no duplicate labels in case stmts
        "no-empty-character-class": 2,      // no empty char classes in regexps
        "no-empty": 2,                      // no empty stmts due to e.g. refactoring
        "no-ex-assign": 2,                  // no exces ref assignment for a lost cause
        "no-extra-boolean-cast": 2,         // no double negation for boolean casts
        "no-extra-parens": 2,               // no redundant parens around exprs
        "no-extra-semi": 2,                 // no redundant semis atfer stmts
        "no-func-assign": 2,                // do not overwrite declared func idents
        "no-inner-declarations": [2, "functions"], // only top block level func decls (block-scoped-var)
        "no-invalid-regexp": 2,             // validate the arguments to `RegExp`
        "no-irregular-whitespace": 2,       // do not allow other wspc than space/tab
        "no-negated-in-lhs": 2,             // prevent unintentional coercing in ifing
        "no-obj-calls": 2,                  // do not call `Math` and `JSON` as functions
        "no-regex-spaces": 2,               // no redundant/unintended spaces in regexps
        "no-sparse-arrays": 2,              // prevent no-value array items due to `,,`
        "no-unreachable": 2,                // prevent unreachable code segments
        "use-isnan": 2,                     // no operator evals against `NaN` in ifing
        "valid-jsdoc": 0,                   // jsdoc usage not yet specified
        "valid-typeof": 2,                  // only use valid type name idents
        "no-unexpected-multiline": 2,       // stupid asi approach, for what use ever?
        // Best Practices - avoid footguns --------------------------------------------------------
        "accessor-pairs": 0,                // Enforces getter/setter pairs in objects
        "block-scoped-var": 2,              // emulate C*/Java-style var block scoping
        "complexity": 0,                    // maximum cyclomatic complexity in a program
        "consistent-return": 2,             // require return to always/never specify values
        "curly": [2, "multi-or-nest"],      // curly brace for multiline control stmts
        "default-case": 0,                  // require default case in switch statements
        "dot-notation": 2,                  // use of dot notation whenever possible
        "dot-location": [2, "property"],    // require dots with props on newlines
        "eqeqeq": 2,                        // require the use of === and !==
        "guard-for-in": 2,                  // have for-in loops provide the right keys
        "no-alert": 2,                      // disallow the use of alert, confirm, and prompt
        "no-caller": 2,                     // disallow deprecated arguments.caller/callee
        "no-div-regex": 2,                  // no div oper puzzling at beginning of a regexp
        "no-else-return": 2,                // superfluous else after a return when ifing
        "no-empty-label": 2,                // no labels for anything other than loops/switches
        "no-eq-null": 2,                    // no test to null without type-checking (undefined)
        "no-eval": 2,                       // disallow use of `eval()` for eval === evil
        "no-extend-native": 2,              // disallow adding to/overriding in native types
        "no-extra-bind": 2,                 // unnecessary function binding for no `this` used
        "no-fallthrough": 2,                // enforce `break`/comment in case statements
        "no-floating-decimal": 2,           // always surround literal dec points with numbers
        "no-implicit-coercion": 2,          // disallow cryptic type conversions notations
        "no-implied-eval": 2,               // no use of `eval()`-like methods or use func params
        "no-invalid-this": 2,               // no `this` outside of classes or likely objects
        "no-iterator": 2,                   // disallow deprecated __iterator__ prop
        "no-labels": 2,                     // disallow use of labeled statements (no-empty-label)
        "no-lone-blocks": 2,                // disallow unnecessary nested (empty) blocks
        "no-loop-func": 2,                  // disallow creation of functions within loops
        "no-multi-spaces": 2,               // disallow use of multiple consecutive spaces
        "no-multi-str": 2,                  // no multiline strings using `\` not concating
        "no-native-reassign": 2,            // disallow reassignments to native objects
        "no-new-func": 2,                   // no new operator for `Function` much like eval
        "no-new-wrappers": 2,               // no tricky vars by `new` `String`|`Number`|`Boolean`
        "no-new": 2,                        // disallow `new` when not assignment to some var
        "no-octal-escape": 2,               // no deprecated octal escape sequences in string lits
        "no-octal": 2,                      // disallow use of octal literals (recommended)
        "no-param-reassign": [2, {"props": false}], // no assignment of func params, except props
        "no-process-env": 2,                // no use of process.env for node.js configuration
        "no-proto": 2,                      // use `getPrototypeOf` instead of `__proto__` prop
        "no-redeclare": [2, {"builtinGlobals": true}], // do not declare a var 1+ times, globally
        "no-return-assign": 2,              // disallow side effect assigns in `return` stmts
        "no-script-url": 2,                 // disallow use of javascript: urls.
        "no-self-compare": 2,               // no typo comps where both sides are exactly the same
        "no-sequences": 2,                  // disallow use of the comma operator, except in `for`
        "no-throw-literal": 2,              // try to restrict what can be thrown as an exception
        "no-unused-expressions": 2,         // disallow expressions in statement position
        "no-useless-call": 2,               // disallow unnecessary .call() and .apply(), hhm
        "no-void": 2,                       // disallow use of the `void` operator for `undefined`
        "no-warning-comments": [1, {"terms": ["todo", "fixme"], "location": "anywhere"}], // warning terms
        "no-with": 2,                       // no use `with` for overlappingn ident names
        "radix": 2,                         // require use of the second argument for `parseInt()`
        "vars-on-top": 0,                   // not all vars at the scope's top (block-scoped-var)
        "wrap-iife": 2,                     // have immediate func invoc in parens, expr via decl
        "yoda": [2, "never"],               // disallow yoda conditions, const @ left
        // Strict Mode ----------------------------------------------------------------------------
        "strict": [2, "function"],          // function bodies are strict mode code, not global
        // Variables - variable declarations ------------------------------------------------------
        "init-declarations": 0,             // nor this / that, declare when appropriate
        "no-catch-shadow": 0,               // no need to support IE 8 and earlier
        "no-delete-var": 2,                 // no use of `delete` on variables
        "no-label-var": 2,                  // whoever still needs labels ???
        "no-shadow-restricted-names": 2,    // do not rename global values or identifiers
        "no-shadow": [2, {"builtinGlobals": true, "hoist": "all"}], // embedded script freedom
        "no-undef-init": 2,                 // do not set `undefined` for `undefined`
        "no-undef": 2,                      // explicit global variable naming in /*global */
        "no-undefined": 0,                  // do not disallow the usage of `undefined`
        "no-unused-vars": [2, {"vars": "local", "args": "all"}], // no unused vars and funcs
        "no-use-before-define": [2, "nofunc"], // declare vars before use, may use funcs however
        // Node.js - not yet used -----------------------------------------------------------------
        "callback-return": 0,               // default options, iff any, deactivated
        "handle-callback-err": 0,           // default options, iff any, deactivated
        "no-mixed-requires": [0, false],    // default options, iff any, deactivated
        "no-new-require": 0,                // default options, iff any, deactivated
        "no-path-concat": 0,                // default options, iff any, deactivated
        "no-process-exit": 0,               // default options, iff any, deactivated
        "no-restricted-modules": 0,         // default options, iff any, deactivated
        "no-sync": 0,                       // default options, iff any, deactivated
        // Stylistic Issues - subjective linting --------------------------------------------------
        "array-bracket-spacing": [2, "never"], // consistent no spacing in array brackets
        //rule-def-not-found "block-spacing": [2, "never"], // consistent no spacing in blocks
        "brace-style": [2, "1tbs", {"allowSingleLine": true}], // one true brace style with singles
        "camelcase": 2,                     // all camelcase idents, except CONST_ANTS
        "comma-spacing": [2, {"before": false, "after": true}], // as usual, not?
        "comma-style": [2, "last"],         // as usual, not?
        "computed-property-spacing": [2, "never"], // again no spacing for consistancy
        "consistent-this": [0, "self"],     // singleton name for the exec context carrier var
        "eol-last": 2,                      // close file with additional empty newline
        "func-names": 0,                    // no extra func names for debugging porposes
        "func-style": [2, "declaration"],   // favour func declarations over expressions
        "id-length": 0,                     // not used but recorded for completeness
        "id-match": 0,                      // not used but recorded for completeness
        "indent": [2, 4, {"SwitchCase": 1}], // 4 spaces indent, including `switch` and `case`
        "key-spacing": [2, {"beforeColon": false, "afterColon": true}], // spaces and colon
        "lines-around-comment": 0,          // not used but recorded for completeness
        "linebreak-style": 0,               // not used but recorded for completeness
        "max-nested-callbacks": [2, 3],     // max nesting depth callback pattern exprs
        "new-cap": 2,                       // `new` calls only on init-cap funcs
        "new-parens": 2,                    // do use parens even when no args used
        "newline-after-var": 0,             // not used but recorded for completeness
        "no-array-constructor": 2,          // `Array` construction for size args only
        "no-continue": 2,                   // favour `if`-`then` over `continue` in loops
        "no-inline-comments": 0,            // not used but recorded for completeness
        "no-lonely-if": 2,                  // favour `else if ()` over `else { if () {} }`
        "no-mixed-spaces-and-tabs": [2, false], // actually no tabs at all
        "no-multiple-empty-lines": 2,       // no multi empty lines at all
        "no-nested-ternary": 0,             // have really interesting expressions
        "no-new-object": 2,                 // literal syntax preferred, like python
        "no-spaced-func": 2,                // compact func parens write up style
        "no-ternary": 0,                    // don't think so, shortest `if` possible
        "no-trailing-spaces": 2,            // actually an editor feature but ok
        "no-underscore-dangle": 2,          // does'nt have a compiled effect anyway
        "no-unneeded-ternary": 2,           // but may have parens around for clarity
        "object-curly-spacing": [2, "never"], // again no spacing for consistancy
        "one-var": [2, "always"],           // convention over configuration, not?
        "operator-assignment": [2, "always"], // compact again
        "operator-linebreak": [2, "after", {"overrides": { ".": "before" }}], // `.` before only
        "padded-blocks": [2, "never"],      // compact again
        "quote-props": [2, "as-needed"],    // curious if i will ever need to, `1e2` :-]
        "quotes": [2, "single", "avoid-escape"], // most comfortable, not?
        "semi-spacing": [2, {"before": false, "after": true}], // non-empty content following
        "semi": [2, "always"],              // convention over configuration, not?
        "sort-vars": 0,                     // not used but recorded for completeness
        "space-after-keywords": [2, "always"], // consistent spacing after the keywords
        "space-before-blocks": [2, "always"], // consistent spacing before block starts
        "space-before-function-paren": [2, "never"], // consistent spacing before func paren
        "space-in-parens": [2, "never"],    // consistent no spacing in expr parens
        "space-infix-ops": 2,               // spaces around ops to distinct the args
        "space-return-throw-case": 2,       // wondering what is imaginable to miswrite
        "space-unary-ops": [2, {"words": true, "nonwords": false}], // like before for clarity
        "spaced-comment": [2, "always"],    // easier to read indeed, need to kick the editor
        "wrap-regex": 2,                    // i like wrapping in parens, like ternary above
        // ECMAScript 6 - to come -----------------------------------------------------------------
        "arrow-parens": [0, "always"],      // default options, iff any, deactivated
        "arrow-spacing": [0, { "before": true, "after": true }], // default options, iff any, deactivated
        "constructor-super": 0,             // default options, iff any, deactivated
        "generator-star-spacing": [0, {"before": true, "after": false}], // default options, iff any, deactivated
        "no-class-assign": 0,               // default options, iff any, deactivated
        "no-const-assign": 0,               // default options, iff any, deactivated
        //rule-def-not-found "no-dupe-class-members": 0, // default options, iff any, deactivated
        "no-this-before-super": 0,          // default options, iff any, deactivated
        "no-var": 0,                        // must be inactive for clashing with `var`
        "object-shorthand": [0, "always"],  // default options, iff any, deactivated
        //rule-def-not-found "prefer-arrow-callback": 2, // default options, iff any, deactivated
        "prefer-const": 0,                  // default options, iff any, deactivated
        "prefer-spread": 0,                 // default options, iff any, deactivated
        "prefer-reflect": 0,                // default options, iff any, deactivated
        //rule-def-not-found "prefer-template": 0, // default options, iff any, deactivated
        "require-yield": 0,                 // default options, iff any, deactivated
        // Legacy - compatibility with JSHint and JSLint ------------------------------------------
        "max-depth": [2, 4],                // max logic block nesting depth allowed
        "max-len": [2, 100, 4],             // max line length with generic tab length
        "max-params": [0, 10],              // max params per func, not used
        "max-statements": [0, 10],          // max stmts per block, not used
        "no-bitwise": 2,                    // in fact, no bit mangling done ever in js
        "no-plusplus": 0                    // allow unary operators, `++` and `--`
    }
}
  • jshint.json
// pewe - crafted around aug/sep 2015 for InteractiveLinter(1.0.5)@Brackets(1.4)
// see: https://github.com/MiguelCastillo/Brackets-InteractiveLinter
// see: http://jshint.com/docs/options
// see: https://jslinterrors.com/options/
// see: https://jslinterrors.com/?linter=jshint
{
    // Enforcing options - Something JSHint does not apply by default
    "curly": true,          // Require {} for every new block or scope
    "eqeqeq": true,         // Require triple equals, e.g. `===`
    "forin": true,          // Requires all for in loops to filter object's items
    "freeze": true,         // Prohibits overwriting prototypes of native objects
    "globals": {            // Whitelist of global variables
    },
    "latedef": "nofunc",    // Prohibits the use of a variable before it was defined
    "noarg": true,          // Prohibit use of `arguments.caller` and `arguments.callee`
    "undef": true,          // Require all non-global variables be declared before they are use
    "strict": true,         // Require `use strict` pragma in every file
    // Relaxing options - Make JSHint produce fewer warnings about your code
    "plusplus": false,      // Allow the use of unary increment and decrement operators
    // Environments - Let JSHint know about pre-defined global variables
    "browser": true,        // Browser globals, e.g. `window`, `document`
    "devel": false,         // Allow poor-man's debugging, e.g. `console.log();`
    "jquery": true          // Define globals exposed by the jQuery JavaScript library
}
  • jscs.json
// pewe - crafted around aug/sep 2015 for InteractiveLinter(1.0.5)@Brackets(1.4)
// see: https://github.com/MiguelCastillo/Brackets-InteractiveLinter
// see http://jscs.info/rules.html
{
    // Disallows empty blocks (except for catch blocks)
    "disallowEmptyBlocks": true,
    // Requires lines to not contain both spaces and tabs consecutively
    "disallowMixedSpacesAndTabs": true,
    // Disallows multiple blank lines in a row
    "disallowMultipleLineBreaks": true,
    // Disallows multiple indent characters between identifiers, keywords or other token
    "disallowMultipleSpaces": { "allowEOLComments": true },
    // Disallows strings that span multiple lines without using concatenation
    "disallowMultipleLineStrings": true,
    // Disallows newline before opening curly brace of all block statements
    "disallowNewlineBeforeBlockStatements": true,
    // Requires putting certain operators on the next line before a line break
    "disallowOperatorBeforeLineBreak": ["."],
    // Disallows newline before line comments
    "disallowPaddingNewLinesBeforeLineComments": true,
    // Disallows quoted keys in object if possible
    "disallowQuotedKeysInObjects": true,
    // Disallows space after object keys
    "disallowSpaceAfterObjectKeys": true,
    // Requires sticking unary operators to the left and right, where applicable
    "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
    "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
    // Disallows space before `()` or `{}` in function expressions
    "disallowSpacesInAnonymousFunctionExpression": {
        "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
    "disallowSpacesInFunctionExpression": {
        "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
    "disallowSpacesInFunctionDeclaration": {
        "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
    "disallowSpacesInFunction": {
        "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
    "disallowSpacesInNamedFunctionExpression": {
        "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
    // Disallows space before `()` in call expressions
    "disallowSpacesInCallExpression": true,
    // Disallows space after opening square bracket and before closing
    "disallowSpacesInsideBrackets": { "allExcept": [ "[", "]", "{", "}" ] },
    // Disallows space after opening object curly brace and before closing
    "disallowSpacesInsideObjectBrackets": { "allExcept": [ "}", ")" ] },
    // Disallows space after opening round bracket and before closing
    "disallowSpacesInsideParentheses": true,
    // Disallows an extra comma after the final element of (array | object literal)
    "disallowTrailingComma": true,
    // Requires all lines to end on a non-whitespace character
    "disallowTrailingWhitespace": true,
    // Requires all lines to be at most the number of characters specified
    "maximumLineLength": 100,
    // Requires constructors to be capitalized (except for `this`)
    "requireCapitalizedConstructors": true,
    "requireCamelCaseOrUpperCaseIdentifiers": true,
    // Requires commas as last token on a line in lists
    "requireCommaBeforeLineBreak": true,
    // Requires curly braces after statements
    "requireCurlyBraces": true,
    // Requires member expressions to use dot notation when possible
    "requireDotNotation": true,
    // Requires function declarations not just assignment of func exprs to vars
    "requireFunctionDeclarations": true,
    // Requires placing line feed after assigning a variable
    "requireLineBreakAfterVariableAssignment": true,
    // Requires placing line feed at file end
    "requireLineFeedAtFileEnd": true,
    // Requires multiple `var` declaration, may except for `require`
    "requireMultipleVarDecl": true,
    // Requires operators to appear before line breaks and not after
    "requireOperatorBeforeLineBreak": [ "?", "=", "+", "-", "/", "*", "==", "===",
                                       "!=", "!==", ">", ">=", "<", "<=" ],
    // Requires parentheses around immediately invoked function expressions
    "requireParenthesesAroundIIFE": true,
    // Requires semicolon after declarations and statements
    "requireSemicolons": true,
    // Disallows sticking binary operators to the left / right
    "requireSpaceAfterBinaryOperators": [ "=", ",", "+", "-", "/", "*", "==", "===",
                                         "!=", "!==" ],
    "requireSpaceBeforeBinaryOperators": [ "=", "+", "-", "/", "*", "==", "===", "!=",
                                          "!==" ],
    // Requires space after the given keywords
    "requireSpaceAfterKeywords": [ "do", "for", "if", "else", "switch", "case", "try",
                                  "catch", "void", "while", "with", "return", "typeof" ],
    // Requires that a line comment `//` be followed by a space
    "requireSpaceAfterLineComment": true,
    // Requires space before the given keywords
    "requireSpaceBeforeKeywords": [ "else", "while", "catch" ],
    // Requires space after object keys
    "requireSpaceBeforeObjectValues": true,
    // Ensure there are spaces after argument separators in call expressions
    "requireSpaceBetweenArguments": true,
    // Requires space before and/or after `?` or `:` in conditional expressions
    "requireSpacesInConditionalExpression": true,
    // Requires spaces inbetween for statement
    "requireSpacesInForStatement": true,
    // Validates indentation for switch statements and block statements
    "validateIndentation": 4,
    // Requires all quote marks to be either the supplied or consistent if `true`
    "validateQuoteMarks": { "mark": "'", "escape": true },
    // Enable validation of separators between function params, ignores newlines
    "validateParameterSeparator": ", "
    
    // rules currently unsupported by i-l in general ?!
    //"disallowSpaceBeforeComma": true
    //"disallowSpaceBeforeSemicolon": true
    //"requireArrowFunctions": true
    //"requireMatchingFunctionName": true
    //"requireNumericLiterals": true
    //"requireVarDeclFirst": true

    // rules currently not working with newer parameters in i-l ?!
    // Requires the variable to be on the left when doing a boolean comparison
    ,"disallowYodaConditions": true //[ "==", "===", "!=", "!==" ],
    // Requires blocks to begin and end with a newline
    ,"requireBlocksOnNewline": 1 //{ "includeComments": false, "minLines": 1 }
}

Have fun, Peter

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s