diff --git a/.eslintrc b/.eslintrc index 0a7204e88d..8c566faa36 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,6 @@ { "parser": "babel-eslint", + "extends": "eslint:recommended", "rules": { "quotes": [2, "double", "avoid-escape"], "strict": 0, @@ -21,7 +22,8 @@ "no-unreachable": 0, "no-labels": 0, "no-process-exit": 0, - "camelcase": 0 + "camelcase": 0, + "no-console": 0 }, "env": { "node": true diff --git a/package.json b/package.json index beb46d0f6f..a229b833f1 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,11 @@ "private": true, "devDependencies": { "babel": "5.8.19", - "babel-eslint": "^3.1.19", + "babel-eslint": "^4.0.6", "browserify": "^11.0.0", "chai": "^2.2.0", "es5-shim": "^4.1.7", - "eslint": "^0.21.2", + "eslint": "^1.1.0", "fs-readdir-recursive": "^0.1.2", "istanbul": "^0.3.5", "lodash": "^3.10.0", diff --git a/packages/babel-cli/src/babel-plugin/templates/index.js b/packages/babel-cli/src/babel-plugin/templates/index.js index 3dc6bc100a..ca31cf0b24 100644 --- a/packages/babel-cli/src/babel-plugin/templates/index.js +++ b/packages/babel-cli/src/babel-plugin/templates/index.js @@ -1,3 +1,4 @@ +/* eslint no-unused-vars:0 */ export default function ({ Plugin, types: t }) { return new Plugin("NAME", { visitor: { diff --git a/packages/babel-core/src/transformation/transformers/es6/for-of.js b/packages/babel-core/src/transformation/transformers/es6/for-of.js index fc817ef2aa..41fe945cfd 100644 --- a/packages/babel-core/src/transformation/transformers/es6/for-of.js +++ b/packages/babel-core/src/transformation/transformers/es6/for-of.js @@ -52,7 +52,7 @@ export var visitor = { * [Please add a description.] */ -export function _ForOfStatementArray(node, scope, file) { +export function _ForOfStatementArray(node, scope) { var nodes = []; var right = node.right; diff --git a/packages/babel-core/src/transformation/transformers/filters.js b/packages/babel-core/src/transformation/transformers/filters.js index 6966f3b685..c4bdc8b35e 100644 --- a/packages/babel-core/src/transformation/transformers/filters.js +++ b/packages/babel-core/src/transformation/transformers/filters.js @@ -4,7 +4,7 @@ import includes from "lodash/collection/includes"; * [Please add a description.] */ -export function internal(transformer, opts) { +export function internal(transformer) { if (transformer.key[0] === "_") return true; } diff --git a/packages/babel-core/src/util.js b/packages/babel-core/src/util.js index 896408ad80..94cfc0dff8 100644 --- a/packages/babel-core/src/util.js +++ b/packages/babel-core/src/util.js @@ -126,7 +126,8 @@ export function shouldIgnore(filename: string, ignore: Array, only): boolean { } /** - * [Please add a description.] + * Returns result of calling function with filename if pattern is a function. + * Otherwise returns result of matching pattern Regex with filename. */ function _shouldIgnore(pattern, filename) { diff --git a/packages/babel-core/test/util.js b/packages/babel-core/test/util.js index b57c84bf61..67a51b4d5d 100644 --- a/packages/babel-core/test/util.js +++ b/packages/babel-core/test/util.js @@ -121,5 +121,11 @@ suite("util", function () { assert.equal(util.shouldIgnore("test-fnIgnore.js", [fnIgnore]), true); assert.equal(util.shouldIgnore("test-fnIgnore.js", [reIgnore]), false); + + assert.equal(util.shouldIgnore("test-reIgnore.js", [], [fnIgnore]), true); + assert.equal(util.shouldIgnore("test-reIgnore.js", [], [reIgnore]), false); + + assert.equal(util.shouldIgnore("test-fnIgnore.js", [], [fnIgnore]), false); + assert.equal(util.shouldIgnore("test-fnIgnore.js", [], [reIgnore]), true); }); }); diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 7872f86d16..7fed8141d6 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -22,7 +22,7 @@ export function ArrayTypeAnnotation(node, print) { * Prints BooleanTypeAnnotation. */ -export function BooleanTypeAnnotation(node) { +export function BooleanTypeAnnotation() { this.push("bool"); } @@ -383,6 +383,6 @@ export function TypeCastExpression(node, print) { * Prints VoidTypeAnnotation. */ -export function VoidTypeAnnotation(node) { +export function VoidTypeAnnotation() { this.push("void"); } diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index 990b9e41bd..c61fc1b96f 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -129,7 +129,7 @@ export { ArrayExpression as ArrayPattern }; * Prints Literal, prints value, regex, raw, handles val type. */ -export function Literal(node, print) { +export function Literal(node) { this.push(""); // hack: catch up indentation this._push(this._Literal(node)); } diff --git a/packages/babel-traverse/src/path/inference/inferers.js b/packages/babel-traverse/src/path/inference/inferers.js index a785ac1c64..94eca85d43 100644 --- a/packages/babel-traverse/src/path/inference/inferers.js +++ b/packages/babel-traverse/src/path/inference/inferers.js @@ -120,7 +120,7 @@ export function ConditionalExpression() { * [Please add a description.] */ -export function SequenceExpression(node) { +export function SequenceExpression() { return this.get("expressions").pop().getTypeAnnotation(); } @@ -128,7 +128,7 @@ export function SequenceExpression(node) { * [Please add a description.] */ -export function AssignmentExpression(node) { +export function AssignmentExpression() { return this.get("right").getTypeAnnotation(); } diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index 7546f24fb4..b019cd3870 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -93,6 +93,7 @@ export const TYPES = Object.keys(t.VISITOR_KEYS).concat(Object.keys(t.FLIPPED_AL */ // @TODO should `skipAliasCheck` be removed? +/*eslint-disable no-unused-vars */ export function is(type: string, node: Object, opts?: Object, skipAliasCheck?: boolean): boolean { if (!node) return false; @@ -105,6 +106,7 @@ export function is(type: string, node: Object, opts?: Object, skipAliasCheck?: b return t.shallowEqual(node, opts); } } +/*eslint-enable no-unused-vars */ /** * Test if a `nodeType` is a `targetType` or if `targetType` is an alias of `nodeType`.