diff --git a/.eslintrc.json b/.eslintrc.json index 9c05f4f8..5865c1a2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,212 +1,228 @@ { + "parser": "espree", + "ecmaFeatures": {}, "env": { "node": true }, "rules": { - "no-alert": 2, - "no-array-constructor": 2, - "no-bitwise": 0, - "no-caller": 2, - "no-case-declarations": 2, - "no-catch-shadow": 2, - "no-class-assign": 2, - "no-cond-assign": 2, - "no-confusing-arrow": 2, - "no-console": 2, - "no-const-assign": 2, - "no-constant-condition": 2, - "no-continue": 2, - "no-control-regex": 2, - "no-debugger": 2, - "no-delete-var": 2, - "no-div-regex": 2, - "no-dupe-class-members": 2, - "no-dupe-keys": 2, - "no-dupe-args": 2, - "no-duplicate-case": 2, - "no-else-return": 2, - "no-empty": 2, - "no-empty-character-class": 2, - "no-empty-function": 0, - "no-empty-pattern": 2, - "no-eq-null": 2, - "no-eval": 2, - "no-ex-assign": 2, - "no-extend-native": 2, - "no-extra-bind": 2, - "no-extra-boolean-cast": 2, - "no-extra-label": 2, - "no-extra-parens": 0, - "no-extra-semi": 2, - "no-fallthrough": 2, - "no-floating-decimal": 2, - "no-func-assign": 2, - "no-implicit-coercion": [2, {"boolean": false, "number": true, "string": true}], - "no-implicit-globals": 2, - "no-implied-eval": 2, - "no-inline-comments": 0, - "no-inner-declarations": [2, "functions"], - "no-invalid-regexp": 2, - "no-invalid-this": 0, - "no-irregular-whitespace": 2, - "no-iterator": 2, - "no-label-var": 2, - "no-labels": 2, - "no-lone-blocks": 2, - "no-lonely-if": 2, - "no-loop-func": 2, - "no-mixed-requires": [2, false], - "no-mixed-spaces-and-tabs": [2, false], - "linebreak-style": [0, "unix"], - "no-multi-spaces": 2, - "no-multi-str": 2, - "no-multiple-empty-lines": [2, {"max": 2}], - "no-native-reassign": 2, - "no-negated-condition": 0, - "no-negated-in-lhs": 2, - "no-nested-ternary": 0, - "no-new": 2, - "no-new-func": 2, - "no-new-object": 2, - "no-new-require": 2, - "no-new-symbol": 2, - "no-new-wrappers": 2, - "no-obj-calls": 2, - "no-octal": 2, - "no-octal-escape": 2, - "no-param-reassign": 0, - "no-path-concat": 2, - "no-plusplus": 0, - "no-process-env": 2, - "no-process-exit": 2, - "no-proto": 2, - "no-redeclare": 2, - "no-regex-spaces": 2, - "no-restricted-imports": 2, - "no-restricted-modules": 2, - "no-restricted-syntax": 2, - "no-return-assign": 2, - "no-script-url": 2, - "no-self-assign": 2, - "no-self-compare": 2, - "no-sequences": 2, - "no-shadow": 2, - "no-shadow-restricted-names": 2, - "no-whitespace-before-property": 2, - "no-spaced-func": 2, - "no-sparse-arrays": 2, - "no-sync": 0, - "no-ternary": 0, - "no-trailing-spaces": 2, - "no-this-before-super": 2, - "no-throw-literal": 2, - "no-undef": 2, - "no-undef-init": 2, - "no-undefined": 0, - "no-unexpected-multiline": 2, - "no-underscore-dangle": 2, - "no-unmodified-loop-condition": 2, - "no-unneeded-ternary": 2, - "no-unreachable": 2, - "no-unused-expressions": 2, - "no-unused-labels": 2, - "no-unused-vars": [2, {"vars": "all", "args": "after-used"}], - "no-use-before-define": 2, - "no-useless-call": 2, - "no-useless-concat": 2, - "no-useless-constructor": 2, - "no-void": 2, - "no-var": 0, - "no-warning-comments": [2, { "terms": ["todo", "fixme", "xxx"], "location": "start" }], - "no-with": 2, - "no-magic-numbers": 0, - - "array-bracket-spacing": [2, "always"], - "array-callback-return": 2, - "arrow-body-style": [2, "as-needed"], - "arrow-parens": 2, - "arrow-spacing": 2, - "accessor-pairs": 2, - "block-scoped-var": 2, - "block-spacing": 2, - "brace-style": [2, "1tbs"], - "callback-return": 0, - "camelcase": 2, - "comma-dangle": [2, "never"], - "comma-spacing": 2, - "comma-style": 2, - "complexity": [2, 11], - "computed-property-spacing": [2, "never"], - "consistent-return": 0, - "consistent-this": [2, "that"], - "constructor-super": 2, - "curly": [2, "all"], - "default-case": 2, - "dot-location": [2, "property"], - "dot-notation": [2, { "allowKeywords": true }], - "eol-last": 2, - "eqeqeq": 2, - "func-names": 2, - "func-style": [2, "declaration"], - "generator-star-spacing": 2, - "global-require": 0, - "guard-for-in": 2, - "handle-callback-err": 2, - "id-length": 0, - "indent": [2, 2, {"SwitchCase": 1}], - "init-declarations": 2, - "jsx-quotes": [2, "prefer-double"], - "key-spacing": [2, { "beforeColon": false, "afterColon": true }], - "keyword-spacing": 2, - "lines-around-comment": 0, - "max-depth": [2, 4], - "max-len": [2, 80, 4], - "max-nested-callbacks": [2, 3], - "max-params": [2, 5], - "max-statements": [2, 21], - "new-cap": 2, - "new-parens": 2, - "newline-after-var": 0, - "newline-per-chained-call": 0, - "object-curly-spacing": [2, "always"], - "object-shorthand": 0, - "one-var": [2, "never"], - "one-var-declaration-per-line": 2, - "operator-assignment": [2, "always"], - "operator-linebreak": [2, "after"], - "padded-blocks": 0, - "prefer-arrow-callback": 0, - "prefer-const": 0, - "prefer-reflect": 0, - "prefer-rest-params": 0, - "prefer-spread": 0, - "prefer-template": 0, - "quote-props": 2, - "quotes": [2, "double"], - "radix": 2, - "id-match": 2, - "id-blacklist": 2, - "require-jsdoc": 0, - "require-yield": 2, - "semi": 2, - "semi-spacing": [2, {"before": false, "after": true}], - "sort-vars": 0, - "sort-imports": 2, - "space-before-blocks": [2, "always"], - "space-before-function-paren": [2, "never"], - "space-in-parens": [2, "never"], - "space-infix-ops": 2, - "space-unary-ops": [2, { "words": true, "nonwords": false }], - "spaced-comment": 2, - "strict": [2, "global"], - "template-curly-spacing": 2, - "use-isnan": 2, - "valid-jsdoc": 2, - "valid-typeof": 2, - "vars-on-top": 0, - "wrap-iife": 2, - "wrap-regex": 0, - "yield-star-spacing": 2, - "yoda": [2, "never"] + "no-alert": "error", + "no-array-constructor": "error", + "no-bitwise": "off", + "no-caller": "error", + "no-case-declarations": "error", + "no-catch-shadow": "error", + "no-class-assign": "error", + "no-cond-assign": "error", + "no-confusing-arrow": "error", + "no-console": "error", + "no-const-assign": "error", + "no-constant-condition": "error", + "no-continue": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-div-regex": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-duplicate-imports": "error", + "no-else-return": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-function": "off", + "no-empty-pattern": "error", + "no-eq-null": "error", + "no-eval": "error", + "no-ex-assign": "error", + "no-extend-native": "error", + "no-extra-bind": "error", + "no-extra-boolean-cast": "error", + "no-extra-label": "error", + "no-extra-parens": "off", + "no-extra-semi": "error", + "no-fallthrough": "error", + "no-floating-decimal": "error", + "no-func-assign": "error", + "no-implicit-coercion": "off", + "no-implicit-globals": "error", + "no-implied-eval": "error", + "no-inline-comments": "error", + "no-inner-declarations": "error", + "no-invalid-regexp": "error", + "no-invalid-this": "off", + "no-irregular-whitespace": "error", + "no-iterator": "error", + "no-label-var": "error", + "no-labels": "error", + "no-lone-blocks": "error", + "no-lonely-if": "error", + "no-loop-func": "error", + "no-magic-numbers": "off", + "no-mixed-operators": "error", + "no-mixed-requires": "error", + "no-mixed-spaces-and-tabs": "error", + "no-multi-spaces": "error", + "no-multi-str": "error", + "no-multiple-empty-lines": "error", + "no-native-reassign": "error", + "no-negated-condition": "error", + "no-negated-in-lhs": "error", + "no-nested-ternary": "off", + "no-new": "error", + "no-new-func": "error", + "no-new-object": "error", + "no-new-require": "error", + "no-new-symbol": "error", + "no-new-wrappers": "error", + "no-obj-calls": "error", + "no-octal": "error", + "no-octal-escape": "error", + "no-param-reassign": "off", + "no-path-concat": "error", + "no-plusplus": "off", + "no-process-env": "error", + "no-process-exit": "error", + "no-proto": "error", + "no-prototype-builtins": "error", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-restricted-globals": "error", + "no-restricted-imports": "error", + "no-restricted-modules": "error", + "no-restricted-syntax": "error", + "no-return-assign": "error", + "no-script-url": "error", + "no-self-assign": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-shadow": "error", + "no-shadow-restricted-names": "error", + "no-whitespace-before-property": "error", + "no-spaced-func": "error", + "no-sparse-arrays": "error", + "no-sync": "off", + "no-ternary": "off", + "no-trailing-spaces": "error", + "no-this-before-super": "error", + "no-throw-literal": "error", + "no-undef": "error", + "no-undef-init": "error", + "no-undefined": "off", + "no-unexpected-multiline": "error", + "no-underscore-dangle": "error", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unused-expressions": "error", + "no-unused-labels": "error", + "no-unused-vars": "error", + "no-use-before-define": "error", + "no-useless-call": "error", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-constructor": "error", + "no-useless-escape": "error", + "no-useless-rename": "error", + "no-void": "error", + "no-var": "off", + "no-warning-comments": "error", + "no-with": "error", + "array-bracket-spacing": ["error", "always"], + "array-callback-return": "error", + "arrow-body-style": "error", + "arrow-parens": "error", + "arrow-spacing": "error", + "accessor-pairs": "error", + "block-scoped-var": "error", + "block-spacing": "error", + "brace-style": "error", + "callback-return": "off", + "camelcase": "error", + "comma-dangle": "error", + "comma-spacing": "error", + "comma-style": "error", + "complexity": "error", + "computed-property-spacing": "error", + "consistent-return": "off", + "consistent-this": "error", + "constructor-super": "error", + "curly": "error", + "default-case": "error", + "dot-location": ["error", "property"], + "dot-notation": "error", + "eol-last": "error", + "eqeqeq": "error", + "func-names": "error", + "func-style": ["error", "declaration"], + "generator-star-spacing": "error", + "global-require": "off", + "guard-for-in": "error", + "handle-callback-err": "error", + "id-blacklist": "error", + "id-length": "off", + "id-match": "error", + "indent": ["error", 2, { "SwitchCase": 1 }], + "init-declarations": "error", + "jsx-quotes": "error", + "key-spacing": "error", + "keyword-spacing": "error", + "linebreak-style": "off", + "lines-around-comment": "off", + "max-depth": "error", + "max-len": "error", + "max-lines": "off", + "max-nested-callbacks": "error", + "max-params": ["error", 5], + "max-statements": ["error", 21], + "max-statements-per-line": "error", + "new-cap": "error", + "new-parens": "error", + "newline-after-var": "off", + "newline-before-return": "off", + "newline-per-chained-call": "off", + "object-curly-newline": "off", + "object-curly-spacing": ["error", "always"], + "object-property-newline": "error", + "object-shorthand": "off", + "one-var": "off", + "one-var-declaration-per-line": "error", + "operator-assignment": "error", + "operator-linebreak": ["error", "after"], + "padded-blocks": "off", + "prefer-arrow-callback": "off", + "prefer-const": "off", + "prefer-reflect": "off", + "prefer-rest-params": "off", + "prefer-spread": "off", + "prefer-template": "off", + "quote-props": "error", + "quotes": "error", + "radix": "error", + "require-jsdoc": "off", + "require-yield": "error", + "rest-spread-spacing": "error", + "semi": "error", + "semi-spacing": "error", + "sort-imports": "error", + "sort-vars": "error", + "space-before-blocks": "error", + "space-before-function-paren": ["error", "never"], + "space-in-parens": "error", + "space-infix-ops": "error", + "space-unary-ops": "error", + "spaced-comment": "error", + "strict": "error", + "template-curly-spacing": "error", + "unicode-bom": "error", + "use-isnan": "error", + "valid-jsdoc": "error", + "valid-typeof": "error", + "vars-on-top": "off", + "wrap-iife": "error", + "wrap-regex": "off", + "yield-star-spacing": "error", + "yoda": "error" } } diff --git a/lib/markdownlint.js b/lib/markdownlint.js index 2183e95c..0432d050 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -32,7 +32,7 @@ rules.forEach(function forRule(rule) { // }); // Class for results with toString for pretty display -function Results() { } +function Results() {} Results.prototype.toString = function resultsToString(useAlias) { var that = this; var results = []; diff --git a/lib/rules.js b/lib/rules.js index ef376677..cf76c691 100644 --- a/lib/rules.js +++ b/lib/rules.js @@ -861,8 +861,8 @@ module.exports = [ errors.push(child.lineNumber); } lastChildRightSpaceLineNumber = - (child.content.trimRight().length !== child.content.length) ? - child.lineNumber : 0; + (child.content.trimRight().length === child.content.length) ? + 0 : child.lineNumber; index++; } });