Skip to content

Commit

Permalink
Breaking: drop support ESLint v1
Browse files Browse the repository at this point in the history
- Revive support Node 0.10 and 0.12.
- Upgrade dependencies.
  • Loading branch information
mysticatea committed Jun 4, 2016
1 parent c431fe3 commit 33dcf05
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 311 deletions.
11 changes: 1 addition & 10 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"extends": "mysticatea/nodejs",
"plugins": ["node"],
"ecmaFeatures": {
"modules": false
},
"extends": ["mysticatea/es5", "mysticatea/node"],
"rules": {
"func-names": 0,
"node/no-missing-require": 2,
"node/no-unpublished-require": 2,
"node/no-unsupported-features": [2, {"version": 4}],
"node/shebang": 2
}
}
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
sudo: false
language: node_js
node_js:
- "0.10"
- "0.12"
- "4"
- "5"
before_install:
- npm install -g npm
- "6"
after_success:
- npm run coveralls
32 changes: 15 additions & 17 deletions lib/rules/arrow-parens.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* See LICENSE file in root directory for full license.
*/

"use strict";
"use strict"

//------------------------------------------------------------------------------
// Helpers
Expand All @@ -16,7 +16,7 @@
* @returns {boolean} `true` when the token is `(`.
*/
function isOpenParen(token) {
return token.type === "Punctuator" && token.value === "(";
return token.type === "Punctuator" && token.value === "("
}

/**
Expand All @@ -26,7 +26,7 @@ function isOpenParen(token) {
* @returns {boolean} `true` when the tokens are at a same line.
*/
function isSameLine(a, b) {
return a.loc.end.line === b.loc.start.line;
return a.loc.end.line === b.loc.start.line
}

//------------------------------------------------------------------------------
Expand All @@ -35,9 +35,9 @@ function isSameLine(a, b) {

module.exports = function(context) {
return {
ArrowFunctionExpression(node) {
const first = context.getFirstToken(node);
const before = context.getTokenBefore(first);
ArrowFunctionExpression: function(node) {
var first = context.getFirstToken(node)
var before = context.getTokenBefore(first)

if (isOpenParen(first)) {
if (node.params.length === 1 &&
Expand All @@ -47,18 +47,16 @@ module.exports = function(context) {
) {
context.report(
node,
"remove redundant parens of the argument list.");
"remove redundant parens of the argument list.")
}
}
else {
if (!isOpenParen(before) || !isSameLine(before, first)) {
context.report(
node,
"enclose the argument with parens.");
}
else if (!isOpenParen(before) || !isSameLine(before, first)) {
context.report(
node,
"enclose the argument with parens.")
}
}
};
};
},
}
}

module.exports.schema = [];
module.exports.schema = []
Loading

0 comments on commit 33dcf05

Please sign in to comment.