GeezerVison is showing github.com — Add eslint configure and tweak code · AuxControl/SRL-JavaScript@f41b991
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +node_modules | | 2 | +coverage |
Collapse file Copy file name to clipboard +165Lines changed: 165 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "ecmaFeatures": { | | 3 | + "modules": true | | 4 | + }, | | 5 | + "env": { | | 6 | + "node": true, | | 7 | + "es6": true, | | 8 | + "mocha": true | | 9 | + }, | | 10 | + "rules": { | | 11 | + // Possible Errors | | 12 | + "comma-dangle": [ 2, "never" ], | | 13 | + "no-cond-assign": 0, | | 14 | + "no-console": 1, | | 15 | + "no-constant-condition": 1, | | 16 | + "no-control-regex": 0, | | 17 | + "no-debugger": 1, | | 18 | + "no-dupe-args": 2, | | 19 | + "no-dupe-keys": 2, | | 20 | + "no-duplicate-case": 2, | | 21 | + "no-empty": 1, | | 22 | + "no-ex-assign": 1, | | 23 | + "no-extra-boolean-cast": 1, | | 24 | + "no-extra-parens": 0, | | 25 | + "no-extra-semi": 1, | | 26 | + "no-func-assign": 1, | | 27 | + "no-inner-declarations": 1, | | 28 | + "no-invalid-regexp": 2, | | 29 | + "no-irregular-whitespace": 2, | | 30 | + "no-negated-in-lhs": 2, | | 31 | + "no-obj-calls": 1, | | 32 | + "no-regex-spaces": 1, | | 33 | + "no-sparse-arrays": 2, | | 34 | + "no-unreachable": 2, | | 35 | + "use-isnan": 2, | | 36 | + "valid-jsdoc": 0, | | 37 | + "valid-typeof": 2, | | 38 | + | | 39 | + // Best Practices | | 40 | + "accessor-pairs": 0, | | 41 | + "block-scoped-var": 1, | | 42 | + "complexity": 0, | | 43 | + "consitent-return": 0, | | 44 | + "curly": 1, | | 45 | + "default-case": 0, | | 46 | + "dot-notation": [ 1, { "allowKeywords": false } ], | | 47 | + "dot-location": [ 1, "property" ], | | 48 | + "eqeqeq": [ 2, "smart" ], | | 49 | + "guard-for-in": 0, | | 50 | + "no-alert": 2, | | 51 | + "no-caller": 2, | | 52 | + "no-div-regex": 1, | | 53 | + "no-else-return": 0, | | 54 | + "no-eq-null": 1, | | 55 | + "no-eval": 0, | | 56 | + "no-extend-native": 2, | | 57 | + "no-extra-bind": 2, | | 58 | + "no-fallthrough": 1, | | 59 | + "no-floating-decimal": 1, | | 60 | + "no-implied-eval": 2, | | 61 | + "no-iterator": 2, | | 62 | + "no-labels": [ 1, { allowLoop: true } ], | | 63 | + "no-lone-blocks": 2, | | 64 | + "no-loop-func": 0, | | 65 | + "no-multi-spaces": 2, | | 66 | + "no-multi-str": 1, | | 67 | + "no-native-reassign": 2, | | 68 | + "no-new-func": 0, | | 69 | + "no-new-wrappers": 1, | | 70 | + "no-new": 1, | | 71 | + "no-octal-escape": 1, | | 72 | + "no-octal": 0, | | 73 | + "no-param-reassign": 0, | | 74 | + "no-process-env": 2, | | 75 | + "no-proto": 2, | | 76 | + "no-redeclare": 2, | | 77 | + "no-return-assign": 1, | | 78 | + "no-script-url": 2, | | 79 | + "no-self-compare": 2, | | 80 | + "no-sequences": 0, | | 81 | + "no-throw-literal": 1, | | 82 | + "no-unused-expressions": 1, | | 83 | + "no-void": 2, | | 84 | + "no-warning-comments": 0, | | 85 | + "no-with": 2, | | 86 | + "radix": 0, | | 87 | + "vars-on-top": 0, | | 88 | + "wrap-iife": 1, | | 89 | + "yoda": [ 1, "never", { "exceptRange": true } ], | | 90 | + | | 91 | + // Variables | | 92 | + "no-catch-shadow": 1, | | 93 | + "no-delete-var": 2, | | 94 | + "no-label-var": 2, | | 95 | + "no-shadow-restricted-names": 1, | | 96 | + "no-shadow": 0, | | 97 | + "no-undef-init": 1, | | 98 | + "no-undef": 2, | | 99 | + "no-undefined": 0, | | 100 | + "no-unused-vars": 1, | | 101 | + "no-use-before-define": 0, | | 102 | + | | 103 | + // Code style | | 104 | + "brace-style": [ 2, "1tbs", { "allowSingleLine": true } ], | | 105 | + "camelcase": [ 1, { "properties": "never" } ], | | 106 | + "comma-spacing": [ 2, { "before": false, "after": true } ], | | 107 | + "comma-style": [ 2, "last" ], | | 108 | + "consistent-this": 0, | | 109 | + "eol-last": 1, | | 110 | + "func-names": 0, | | 111 | + "func-style": 0, | | 112 | + "indent": [ 1, 4 ], | | 113 | + "key-spacing": [ 1, { "beforeColon": false, "afterColon": true } ], | | 114 | + "lines-around-comment": 0, | | 115 | + "max-nested-callbacks": [1, 4], | | 116 | + "new-cap": 0, | | 117 | + "new-parens": 1, | | 118 | + "newline-after-var": 0, | | 119 | + "no-array-constructor": 1, | | 120 | + "no-continue": 0, | | 121 | + "no-inline-comments": 0, | | 122 | + "no-lonely-if": 1, | | 123 | + "no-mixed-spaces-and-tabs": 2, | | 124 | + "no-multiple-empty-lines": 1, | | 125 | + "no-nested-ternary": 1, | | 126 | + "no-new-object": 1, | | 127 | + "no-spaced-func": 1, | | 128 | + "no-ternary": 0, | | 129 | + "no-trailing-spaces": [ 1, { "skipBlankLines": true } ], | | 130 | + "no-underscore-dangle": 0, | | 131 | + "no-unneeded-ternary": 1, | | 132 | + "object-curly-spacing": [ 1, "always" ], | | 133 | + "one-var": 0, | | 134 | + "operator-assignment": 0, | | 135 | + "operator-linebreak": [ 1, "after" ], | | 136 | + "padded-blocks": 0, | | 137 | + "quote-props": 0, | | 138 | + "quotes": [ 1, "single" ], | | 139 | + "semi-spacing": 0, | | 140 | + "semi": [ 1, "never" ], | | 141 | + "sort-vars": 0, | | 142 | + "keyword-spacing": 1, | | 143 | + "space-before-blocks": [ 1, "always" ], | | 144 | + "space-before-function-paren": [ 1, { "anonymous": "always", "named": "never" } ], | | 145 | + "space-in-parens": [ 1, "never" ], | | 146 | + "space-infix-ops": [ 1, { "int32Hint": false } ], | | 147 | + "space-unary-ops": [ 1, { "words": true, "nonwords": false } ], | | 148 | + "spaced-comment": 0, | | 149 | + "wrap-regex": 0, | | 150 | + | | 151 | + // EMCAScript 6 | | 152 | + "generator-star-spacing": [ 1, "before" ], | | 153 | + "no-var": 1, | | 154 | + "object-shorthand": [ 1, "always" ], | | 155 | + "prefer-const": 1, | | 156 | + | | 157 | + // Legacy | | 158 | + "max-depth": [ 1, 5 ], | | 159 | + "max-len": 0, | | 160 | + "max-params": [ 1, 5 ], | | 161 | + "max-statements": 0, | | 162 | + "no-bitwise": 0, | | 163 | + "no-plusplus": 0 | | 164 | + } | | 165 | +} |
Collapse file Copy file name to clipboardExpand all lines: .travis.yml +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | - node_modules | 6 | 6 | install: | 7 | 7 | - npm install | | 8 | + - npm install -g eslint | 8 | 9 | - npm install -g codecov | 9 | 10 | script: | | 11 | + - eslint . | 10 | 12 | - istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec | 11 | 13 | - codecov | 12 | 14 |
|
Collapse file Copy file name to clipboardExpand all lines: lib/Builder.js +8-11Lines changed: 8 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,9 +8,9 @@ const NON_LITERAL_CHARACTERS = '[\\^$.|?*+()/' | 8 | 8 | const METHOD_TYPE_BEGIN = 0b00001 | 9 | 9 | const METHOD_TYPE_CHARACTER = 0b00010 | 10 | 10 | const METHOD_TYPE_GROUP = 0b00100 | 11 | | -const METHOD_TYPE_QUANTIFIER = 0b01000; | 12 | | -const METHOD_TYPE_ANCHOR = 0b10000; | 13 | | -const METHOD_TYPE_UNKNOWN = 0b11111; | | 11 | +const METHOD_TYPE_QUANTIFIER = 0b01000 | | 12 | +const METHOD_TYPE_ANCHOR = 0b10000 | | 13 | +const METHOD_TYPE_UNKNOWN = 0b11111 | 14 | 14 | const METHOD_TYPES_ALLOWED_FOR_CHARACTERS = METHOD_TYPE_BEGIN | METHOD_TYPE_ANCHOR | METHOD_TYPE_GROUP | METHOD_TYPE_QUANTIFIER | METHOD_TYPE_CHARACTER | 15 | 15 |
| 16 | 16 | const simpleMapper = { | @@ -145,7 +145,7 @@ class Builder { | 145 | 145 | */ | 146 | 146 | literally(chars) { | 147 | 147 | this._validateAndAddMethodType(METHOD_TYPE_CHARACTER, METHOD_TYPES_ALLOWED_FOR_CHARACTERS) | 148 | | - let result = chars.split('').map((character) => this.escape(character)).join('') | | 148 | + const result = chars.split('').map((character) => this.escape(character)).join('') | 149 | 149 |
| 150 | 150 | return this.add(`(?:${result})`) | 151 | 151 | } | @@ -369,10 +369,7 @@ class Builder { | 369 | 369 | * @return {Builder} | 370 | 370 | */ | 371 | 371 | until(toCondition) { | 372 | | - try { | 373 | | - this.lazy() | 374 | | - } catch (e) {} | 375 | | - | | 372 | + this.lazy() | 376 | 373 | this._validateAndAddMethodType(METHOD_TYPE_GROUP, METHOD_TYPES_ALLOWED_FOR_CHARACTERS) | 377 | 374 |
| 378 | 375 | return this._addClosure(new Builder(), toCondition) | @@ -475,7 +472,7 @@ class Builder { | 475 | 472 | * @return {string} | 476 | 473 | */ | 477 | 474 | getModifiers() { | 478 | | - return this._modifiers; | | 475 | + return this._modifiers | 479 | 476 | } | 480 | 477 |
| 481 | 478 | /** | @@ -512,7 +509,7 @@ class Builder { | 512 | 509 | }[this._lastMethodType] | 513 | 510 |
| 514 | 511 | throw new ImplementationException( | 515 | | - `Method ${methodName} is not allowed ${messgae || 'here'}` | | 512 | + `Method ${methodName} is not allowed ${message || 'here'}` | 516 | 513 | ) | 517 | 514 | } | 518 | 515 |
| @@ -558,7 +555,7 @@ class Builder { | 558 | 555 | _addClosure(builder, conditions) { | 559 | 556 | if (typeof conditions === 'string') { | 560 | 557 | builder.literally(conditions) | 561 | | - } else if(conditions instanceof Builder) { | | 558 | + } else if (conditions instanceof Builder) { | 562 | 559 | builder.raw(conditions.getRawRegex()) | 563 | 560 | } else { | 564 | 561 | conditions(builder) | |
Collapse file Copy file name to clipboardExpand all lines: lib/Builder/Capture.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,4 +11,4 @@ class Capture extends Builder { | 11 | 11 | } | 12 | 12 | } | 13 | 13 |
| 14 | | -module.exports = Capture | | 14 | +module.exports = Capture |
Collapse file Copy file name to clipboardExpand all lines: lib/Builder/EitherOf.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,4 +14,4 @@ class EitherOf extends Builder { | 14 | 14 | } | 15 | 15 | } | 16 | 16 |
| 17 | | -module.exports = EitherOf | | 17 | +module.exports = EitherOf |
Collapse file Copy file name to clipboardExpand all lines: lib/Builder/NegativeLookahead.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,4 +11,4 @@ class NegativeLookahead extends Builder { | 11 | 11 | } | 12 | 12 | } | 13 | 13 |
| 14 | | -module.exports = NegativeLookahead | | 14 | +module.exports = NegativeLookahead |
Collapse file Copy file name to clipboardExpand all lines: lib/Builder/NonCapture.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,4 +11,4 @@ class NonCapture extends Builder { | 11 | 11 | } | 12 | 12 | } | 13 | 13 |
| 14 | | -module.exports = NonCapture | | 14 | +module.exports = NonCapture |
Collapse file Copy file name to clipboardExpand all lines: lib/Builder/Optional.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,4 +11,4 @@ class Optional extends Builder { | 11 | 11 | } | 12 | 12 | } | 13 | 13 |
| 14 | | -module.exports = Optional | | 14 | +module.exports = Optional |
Collapse file Copy file name to clipboardExpand all lines: lib/Builder/PositiveLookahead.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,4 +11,4 @@ class PositiveLookahead extends Builder { | 11 | 11 | } | 12 | 12 | } | 13 | 13 |
| 14 | | -module.exports = PositiveLookahead | | 14 | +module.exports = PositiveLookahead |
|