Permalink
Browse files

Replace jshint and jscs with eslint

eslint provides rules for both, style and checking for possible errors.
See .eslintrc for the configured rules.
  • Loading branch information...
1 parent f0b8d9a commit 45bb9160b0aa2ed3bc5755d906024eb0337169a2 @gilligan gilligan committed with gilligan Nov 21, 2015
Showing with 258 additions and 90 deletions.
  1. +7 −0 .eslintignore
  2. +115 −0 .eslintrc
  3. +1 −1 lib/bench/isset.bench.js
  4. +4 −2 lib/sauce/ie8-shim.js
  5. +1 −1 lib/sauce/mocharun.js
  6. +3 −5 package.json
  7. +4 −5 scripts/bookmarklet.tmpl.js
  8. +3 −3 scripts/build
  9. +1 −0 scripts/template.js
  10. +2 −1 src/dropWhile.js
  11. +2 −1 src/evolve.js
  12. +3 −1 src/fromPairs.js
  13. +1 −1 src/internal/_arity.js
  14. +3 −1 src/internal/_containsWith.js
  15. +4 −1 src/internal/_filter.js
  16. +3 −3 src/internal/_forceReduced.js
  17. +5 −1 src/internal/_makeFlat.js
  18. +3 −2 src/internal/_reduce.js
  19. +1 −1 src/internal/_stepCat.js
  20. +1 −1 src/internal/_xall.js
  21. +1 −1 src/internal/_xany.js
  22. +1 −1 src/internal/_xaperture.js
  23. +1 −1 src/internal/_xdrop.js
  24. +1 −1 src/internal/_xdropLast.js
  25. +1 −1 src/internal/_xdropLastWhile.js
  26. +1 −1 src/internal/_xdropRepeatsWith.js
  27. +1 −1 src/internal/_xdropWhile.js
  28. +1 −1 src/internal/_xfilter.js
  29. +1 −1 src/internal/_xfind.js
  30. +1 −1 src/internal/_xfindIndex.js
  31. +1 −1 src/internal/_xfindLast.js
  32. +1 −1 src/internal/_xfindLastIndex.js
  33. +1 −1 src/internal/_xgroupBy.js
  34. +1 −1 src/internal/_xmap.js
  35. +1 −1 src/internal/_xtake.js
  36. +1 −1 src/internal/_xtakeWhile.js
  37. +2 −1 src/intersectionWith.js
  38. +2 −1 src/keys.js
  39. +2 −1 src/keysIn.js
  40. +4 −1 src/mapAccum.js
  41. +3 −1 src/mapAccumRight.js
  42. +2 −1 src/once.js
  43. +3 −1 src/scan.js
  44. +3 −1 src/splitWhen.js
  45. +2 −1 src/takeWhile.js
  46. +12 −8 src/uniqBy.js
  47. +4 −2 src/uniqWith.js
  48. +2 −1 src/useWith.js
  49. +2 −1 src/valuesIn.js
  50. +3 −1 src/zipObj.js
  51. +3 −1 src/zipWith.js
  52. +1 −1 test/countBy.js
  53. +1 −1 test/dropRepeatsWith.js
  54. +2 −1 test/helpers/test.examplesRunner.js
  55. +1 −3 test/is.js
  56. +2 −2 test/isEmpty.js
  57. +2 −2 test/length.js
  58. +1 −1 test/mean.js
  59. +1 −1 test/median.js
  60. +3 −3 test/toString.js
  61. +0 −1 test/type.js
  62. +2 −1 test/xprod.js
  63. +7 −2 test/zip.js
  64. +3 −1 test/zipWith.js
View
@@ -0,0 +1,7 @@
+**/*.min.js
+test/index.html
+test/bundle.js
+dist/**
+lib/test/**
+node_modules/**
+bower_components/**
View
@@ -0,0 +1,115 @@
+{
+ "env": {
+ "node": true,
+ "mocha": true
+ },
+ "globals": {
+ "Symbol": true
+ },
+ "rules": {
+ "no-eval": 2,
+ "eqeqeq": 0,
+ "no-eq-null": 0,
+ "new-cap": 0,
+ "no-plusplus": 2,
+ "no-undef": 2,
+ "no-unused-vars": 2,
+ "brace-style": [
+ 2,
+ "1tbs",
+ {
+ "allowSingleLine": true
+ }
+ ],
+ "no-mixed-spaces-and-tabs": 2,
+ "no-multi-str": 2,
+ "one-var": [
+ 2,
+ {
+ "uninitialized": "always",
+ "initialized": "never"
+ }
+ ],
+ "quote-props": [
+ 2,
+ "as-needed",
+ {
+ "keywords": true
+ }
+ ],
+ "key-spacing": 0,
+ "space-unary-ops": 0,
+ "no-spaced-func": 2,
+ "space-before-function-paren": [
+ 2,
+ "never"
+ ],
+ "spaced-comment": [
+ 2,
+ "always"
+ ],
+ "array-bracket-spacing": [
+ 2,
+ "never",
+ {
+ "singleValue": false
+ }
+ ],
+ "space-in-parens": [
+ 2,
+ "never"
+ ],
+ "no-trailing-spaces": 2,
+ "yoda": [
+ 2,
+ "never"
+ ],
+ "comma-style": [
+ 2,
+ "last"
+ ],
+ "curly": [
+ 2,
+ "all"
+ ],
+ "dot-notation": 0,
+ "eol-last": 2,
+ "wrap-iife": [
+ 2,
+ "outside"
+ ],
+ "space-infix-ops": 2,
+ "space-return-throw-case": 0,
+ "space-after-keywords": [
+ 2,
+ "always"
+ ],
+ "lines-around-comment": 0,
+ "space-before-blocks": [
+ 2,
+ "always"
+ ],
+ "indent": [
+ 2,
+ 2,
+ {
+ "SwitchCase": 1
+ }
+ ],
+ "quotes": [
+ 2,
+ "single",
+ "avoid-escape"
+ ],
+ "comma-dangle": [
+ 2,
+ "never"
+ ],
+ "no-debugger": 2,
+ "no-dupe-args": 2,
+ "no-dupe-keys": 2,
+ "no-duplicate-case": 2,
+ "no-extra-semi": 2,
+ "no-unreachable": 2
+ }
+}
@@ -19,6 +19,6 @@ module.exports = {
},
'isSet(sortedSet)': function() {
isSet(sortedSet);
- },
+ }
}
};
@@ -1,4 +1,4 @@
-/* jshint browser: true */
+/* eslint-env browser */
// redefine `require` since old IE is too dumb to handle shadowing the `R` variable in the required modules.
window.ramda = window.R;
@@ -16,7 +16,9 @@ window.require = function require(path) {
if (typeof document.getElementsByClassName !== 'function') {
document.getElementsByClassName = function(className, nodeName) {
- var result = [], tag = nodeName || '*', node, seek, i;
+ var result = [];
+ var tag = nodeName || '*';
+ var node, seek, i;
if (document.evaluate) {
seek = '//' + tag + '[@class="' + className + '"]';
seek = document.evaluate(seek, document, null, 0, null);
@@ -1,4 +1,4 @@
-/* jshint browser: true */
+/* eslint-env browser */
(function() {
function onload() {
var runner = window.mocha.run();
View
@@ -38,9 +38,8 @@
"bookmarklet": "scripts/bookmarklet",
"build": "make && make dist/ramda.min.js",
"clean": "rimraf dist/*",
- "jscs": "jscs scripts/bookmarklet scripts/build **/*.js **/**/*.js",
- "jshint": "jshint scripts/bookmarklet scripts/build **/*.js **/**/*.js",
- "pretest": "npm install && npm run jshint && npm run jscs && npm run clean && npm run build",
+ "lint": "eslint scripts/bookmarklet scripts/build src/*.js src/internal/*.js test/*.js test/**/*.js lib/sauce/*.js lib/bench/*.js",
+ "pretest": "npm install && npm run lint && npm run clean && npm run build",
"test": "node scripts/testfiles | node_modules/.bin/mocha --reporter spec",
"posttest": "git checkout -- dist"
},
@@ -54,10 +53,9 @@
"dox": "latest",
"envvar": "1.x.x",
"escodegen": "1.4.x",
+ "eslint": "^1.10.1",
"handlebars": "3.0.x",
"js-yaml": "^3.2.5",
- "jscs": "1.13.x",
- "jshint": "2.7.x",
"mocha": "2.x.x",
"q": "^1.1.1",
"ramda": "0.17.x",
@@ -1,16 +1,15 @@
-/* global window, document */
+/* eslint-env browser */
+/* global ramda:false */
(function(window, document) {
var version = '???';
if (typeof window.R !== 'undefined') {
return showMsg('This page already using ramda');
}
- // jscs:disable
- /* jshint ignore:start */
+ /* eslint-disable space-before-blocks */
{{{ramda}}}
version = '{{{version}}}';
- /* jshint ignore:end*/
- // jscs:enable
+ /* eslint-enable space-before-blocks */
showMsg('Ramda v' + version + ' loaded');
function showMsg(msg) {
View
@@ -98,17 +98,17 @@ var warnIgnoredTopLevel = R.tap(R.pipe(
// abortIfNotSorted :: List[{*}] -> List[{*}]
var abortIfNotSorted = R.tap(R.cond([[
- R.complement(R.pipe(
+ R.complement(R.pipe(
R.pluck('id'),
R.pluck('name'),
R.converge(R.equals, R.identity, R.sortBy(R.identity))
)),
- R.pipe(
+ R.pipe(
R.path(['0', 'loc', 'source']),
R.concat('Dependencies not declared in alphabetical order in '),
abort
)
- ]])
+]])
);
// abortIfExportNotLast :: {*} -> {*}
View
@@ -3,6 +3,7 @@
'use strict';
/* global R */
+ /* eslint-env amd */
/* TEST_ENTRY_POINT */
View
@@ -30,7 +30,8 @@ var _xdropWhile = require('./internal/_xdropWhile');
* R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1]
*/
module.exports = _curry2(_dispatchable('dropWhile', _xdropWhile, function dropWhile(pred, list) {
- var idx = 0, len = list.length;
+ var idx = 0;
+ var len = list.length;
while (idx < len && pred(list[idx])) {
idx += 1;
}
View
@@ -29,7 +29,8 @@ var _curry2 = require('./internal/_curry2');
* R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123}
*/
module.exports = _curry2(function evolve(transformations, object) {
- var transformation, key, type, result = {};
+ var result = {};
+ var transformation, key, type;
for (key in object) {
transformation = transformations[key];
type = typeof transformation;
View
@@ -18,7 +18,9 @@ var _isArray = require('./internal/_isArray');
* R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3}
*/
module.exports = _curry1(function fromPairs(pairs) {
- var idx = 0, len = pairs.length, out = {};
+ var idx = 0;
+ var len = pairs.length;
+ var out = {};
while (idx < len) {
if (_isArray(pairs[idx]) && pairs[idx].length) {
out[pairs[idx][0]] = pairs[idx][1];
@@ -1,5 +1,5 @@
module.exports = function _arity(n, fn) {
- // jshint unused:vars
+ /* eslint-disable no-unused-vars */
switch (n) {
case 0: return function() { return fn.apply(this, arguments); };
case 1: return function(a0) { return fn.apply(this, arguments); };
@@ -1,5 +1,7 @@
module.exports = function _containsWith(pred, x, list) {
- var idx = 0, len = list.length;
+ var idx = 0;
+ var len = list.length;
+
while (idx < len) {
if (pred(x, list[idx])) {
return true;
@@ -1,5 +1,8 @@
module.exports = function _filter(fn, list) {
- var idx = 0, len = list.length, result = [];
+ var idx = 0;
+ var len = list.length;
+ var result = [];
+
while (idx < len) {
if (fn(list[idx])) {
result[result.length] = list[idx];
@@ -1,6 +1,6 @@
module.exports = function _forceReduced(x) {
return {
- '@@transducer/value': x,
- '@@transducer/reduced': true
- };
+ '@@transducer/value': x,
+ '@@transducer/reduced': true
+ };
};
@@ -9,7 +9,11 @@ var isArrayLike = require('../isArrayLike');
*/
module.exports = function _makeFlat(recursive) {
return function flatt(list) {
- var value, result = [], idx = 0, j, ilen = list.length, jlen;
+ var value, jlen, j;
+ var result = [];
+ var idx = 0;
+ var ilen = list.length;
+
while (idx < ilen) {
if (isArrayLike(list[idx])) {
value = recursive ? flatt(list[idx]) : list[idx];
@@ -5,7 +5,8 @@ var isArrayLike = require('../isArrayLike');
module.exports = (function() {
function _arrayReduce(xf, acc, list) {
- var idx = 0, len = list.length;
+ var idx = 0;
+ var len = list.length;
while (idx < len) {
acc = xf['@@transducer/step'](acc, list[idx]);
if (acc && acc['@@transducer/reduced']) {
@@ -53,4 +54,4 @@ module.exports = (function() {
}
throw new TypeError('reduce: list must be array or iterable');
};
-})();
+}());
@@ -43,4 +43,4 @@ module.exports = (function() {
}
throw new Error('Cannot create transformer for ' + obj);
};
-})();
+}());
@@ -25,4 +25,4 @@ module.exports = (function() {
};
return _curry2(function _xall(f, xf) { return new XAll(f, xf); });
-})();
+}());
@@ -25,4 +25,4 @@ module.exports = (function() {
};
return _curry2(function _xany(f, xf) { return new XAny(f, xf); });
-})();
+}());
@@ -33,4 +33,4 @@ module.exports = (function() {
};
return _curry2(function _xaperture(n, xf) { return new XAperture(n, xf); });
-})();
+}());
@@ -18,4 +18,4 @@ module.exports = (function() {
};
return _curry2(function _xdrop(n, xf) { return new XDrop(n, xf); });
-})();
+}());
@@ -31,4 +31,4 @@ module.exports = (function() {
};
return _curry2(function _xdropLast(n, xf) { return new XDropLast(n, xf); });
-})();
+}());
@@ -32,4 +32,4 @@ module.exports = (function() {
};
return _curry2(function _xdropLastWhile(fn, xf) { return new XDropLastWhile(fn, xf); });
-})();
+}());
@@ -26,4 +26,4 @@ module.exports = (function() {
};
return _curry2(function _xdropRepeatsWith(pred, xf) { return new XDropRepeatsWith(pred, xf); });
-})();
+}());
@@ -20,4 +20,4 @@ module.exports = (function() {
};
return _curry2(function _xdropWhile(f, xf) { return new XDropWhile(f, xf); });
-})();
+}());
@@ -14,4 +14,4 @@ module.exports = (function() {
};
return _curry2(function _xfilter(f, xf) { return new XFilter(f, xf); });
-})();
+}());
@@ -25,4 +25,4 @@ module.exports = (function() {
};
return _curry2(function _xfind(f, xf) { return new XFind(f, xf); });
-})();
+}());
@@ -27,4 +27,4 @@ module.exports = (function() {
};
return _curry2(function _xfindIndex(f, xf) { return new XFindIndex(f, xf); });
-})();
+}());
Oops, something went wrong.

0 comments on commit 45bb916

Please sign in to comment.