Skip to content

Commit

Permalink
Add npm run eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 27, 2015
1 parent d57d1ce commit 0d75a66
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
24 changes: 18 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"block-scoped-var": [0],
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"camelcase": [2],
"comma-dangle": [2, "never"],
"comma-spacing": [2],
"comma-style": [2, "last"],
"complexity": [0, 11],
Expand All @@ -22,11 +23,13 @@
"eol-last": [2],
"eqeqeq": [2],
"func-names": [0],
"func-style": [0, "declaration"],
"func-style": [2, "expression"],
"generator-star-spacing": [2, "after"],
"global-strict": [0, "never"],
"guard-for-in": [0],
"handle-callback-err": [0],
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
"linebreak-style": [2, "unix"],
"quotes": [2, "single", "avoid-escape"],
"max-depth": [0, 4],
"max-len": [0, 80, 4],
Expand All @@ -35,20 +38,23 @@
"max-statements": [0, 10],
"new-parens": [2],
"new-cap": [2],
"newline-after-var": [0],
"no-alert": [2],
"no-array-constructor": [2],
"no-bitwise": [0],
"no-caller": [2],
"no-catch-shadow": [2],
"no-comma-dangle": [2],
"no-cond-assign": [2],
"no-console": [2],
"no-constant-condition": [2],
"no-continue": [2],
"no-control-regex": [2],
"no-debugger": [2],
"no-delete-var": [2],
"no-div-regex": [0],
"no-dupe-args": [2],
"no-dupe-keys": [2],
"no-duplicate-case": [2],
"no-else-return": [0],
"no-empty": [2],
"no-empty-class": [2],
Expand Down Expand Up @@ -80,7 +86,7 @@
"no-mixed-spaces-and-tabs": [2, false],
"no-multi-spaces": [2],
"no-multi-str": [2],
"no-multiple-empty-lines": [0, {"max": 2}],
"no-multiple-empty-lines": [2, {"max": 1}],
"no-native-reassign": [2],
"no-negated-in-lhs": [2],
"no-nested-ternary": [0],
Expand All @@ -92,6 +98,7 @@
"no-obj-calls": [2],
"no-octal": [2],
"no-octal-escape": [2],
"no-param-reassign": [2],
"no-path-concat": [0],
"no-plusplus": [0],
"no-process-env": [0],
Expand All @@ -112,11 +119,13 @@
"no-sparse-arrays": [2],
"no-sync": [0],
"no-ternary": [0],
"no-trailing-spaces": [2],
"no-throw-literal": [2],
"no-trailing-spaces": [2, { "skipBlankLines": false }],
"no-undef": [2],
"no-undef-init": [2],
"no-undefined": [0],
"no-underscore-dangle": [2],
"no-unneeded-ternary": [2],
"no-unreachable": [2],
"no-unused-expressions": [2],
"no-unused-vars": [2, { "vars": "all", "args": "after-used" }],
Expand All @@ -125,14 +134,18 @@
"no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
"no-with": [2],
"no-wrap-func": [2],
"object-shorthand": [2, "never"],
"one-var": [0],
"operator-assignment": [0, "always"],
"operator-linebreak": [2, "none"],
"padded-blocks": [0],
"quote-props": [0],
"radix": [0],
"semi": [2],
"semi-spacing": [2, { "before": false, "after": true }],
"sort-vars": [0],
"space-after-keywords": [2, "always", { "checkFunctionKeyword": true }],
"space-after-keywords": [2, "always"],
"space-before-function-paren": [2, { "anonymous": "always", "named": "never" }],
"space-before-blocks": [0, "always"],
"space-in-brackets": [0, "never", {
"singleValue": true,
Expand All @@ -145,7 +158,6 @@
"space-in-parens": [2, "never"],
"space-infix-ops": [2],
"space-return-throw-case": [2],
"space-after-function-name": [2, "never"],
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"spaced-line-comment": [0, "always"],
"strict": [0],
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ if (hasSymbols) {

module.exports = function isSymbol(value) {
// this environment does not support Symbols.
return false;
return false && value;

This comment has been minimized.

Copy link
@mgthomas99

mgthomas99 Jan 23, 2018

Hi there,
Do you mind explaining what return false && value does? As far as I'm aware, the && value is redundant; is there some sort of weird JS trickery going on here?

This comment has been minimized.

Copy link
@ljharb

ljharb Jan 23, 2018

Author Member

It avoids eslint complaining about an unused argument, without an override comment.

This comment has been minimized.

Copy link
@mgthomas99

mgthomas99 Jan 23, 2018

Haha, that's pretty neat.

Thanks for the help.

};
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"test": "npm run lint && node --es-staging --harmony test/index.js && npm run security",
"coverage": "covert test/index.js",
"coverage:quiet": "covert test/index.js --quiet",
"lint": "jscs *.js */*.js",
"lint": "npm run jscs && npm run eslint",
"jscs": "jscs *.js */*.js",
"eslint": "eslint *.js */*.js",
"security": "nsp package"
},
"repository": {
Expand All @@ -31,7 +33,8 @@
"covert": "^1.1.0",
"jscs": "^1.13.1",
"nsp": "^1.0.1",
"semver": "^4.3.4"
"semver": "^4.3.4",
"eslint": "^0.21.2"
},
"testling": {
"files": "test/index.js",
Expand Down
7 changes: 5 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
var debug = function (value, msg) {
var output = '';
if (hasSymbols) {
try { output += String(value); }
catch (e) { output += Symbol.prototype.toString.call(value); }
try {
output += String(value);
} catch (e) {
output += Symbol.prototype.toString.call(value);
}
if (output === '') {
output = JSON.stringify(value);
}
Expand Down

0 comments on commit 0d75a66

Please sign in to comment.