Skip to content

Commit

Permalink
Merge pull request #262 from dwyl/no-useless-return
Browse files Browse the repository at this point in the history
add no-useless-return rule
  • Loading branch information
nelsonic authored Nov 3, 2016
2 parents 9350193 + 341a865 commit 8d16fd3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "goodparts",
"description": "An ESLint Style that only allows JavaScript the Good Parts (and \"Better Parts\") in your codebase.",
"version": "1.1.2",
"version": "1.1.3",
"main": ".eslintrc.js",
"scripts": {
"test": "tape test/index.js",
Expand All @@ -15,7 +15,7 @@
"tape": "^4.6.0"
},
"dependencies": {
"eslint": "^3.6.1"
"eslint": "^3.9.1"
},
"bin": "./bin/cmd.js",
"contributors": [
Expand Down
3 changes: 2 additions & 1 deletion rules/best_practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ module.exports = {
'no-useless-escape': 'error', // https://github.com/dwyl/goodparts/issues/116
'no-warning-comments': 'off', // https://github.com/dwyl/goodparts/issues/117
'radix': ['error', 'always'], // https://github.com/dwyl/goodparts/issues/118
'wrap-iife': ['error', 'inside'] // https://github.com/dwyl/goodparts/issues/124
'wrap-iife': ['error', 'inside'], // https://github.com/dwyl/goodparts/issues/124
'no-useless-return': 'error' // https://github.com/dwyl/goodparts/issues/261
};
6 changes: 5 additions & 1 deletion test/fixtures/best_practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,9 @@ module.exports = {
'no-useless-call': { fail: ['foo.call(null, 1, 2, 3);'] },
'no-useless-escape': { fail: ['"\\a";'] },
'no-warning-comments': null,
'radix': { fail: ['var num = parseInt("071'] }
'radix': { fail: ['var num = parseInt("071'] },
'no-useless-return': {
fail: [read('./no-useless-return.fail')],
pass: [read('./no-useless-return.pass')]
}
};
1 change: 1 addition & 0 deletions test/fixtures/no-useless-return.fail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function foo() { return; }
1 change: 1 addition & 0 deletions test/fixtures/no-useless-return.pass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function foo() { return 5; }

0 comments on commit 8d16fd3

Please sign in to comment.