diff --git a/package.json b/package.json index 354bf06..07786df 100644 --- a/package.json +++ b/package.json @@ -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", @@ -15,7 +15,7 @@ "tape": "^4.6.0" }, "dependencies": { - "eslint": "^3.6.1" + "eslint": "^3.9.1" }, "bin": "./bin/cmd.js", "contributors": [ diff --git a/rules/best_practices.js b/rules/best_practices.js index 5567f58..47bf155 100644 --- a/rules/best_practices.js +++ b/rules/best_practices.js @@ -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 }; diff --git a/test/fixtures/best_practices.js b/test/fixtures/best_practices.js index fc28794..5969f86 100644 --- a/test/fixtures/best_practices.js +++ b/test/fixtures/best_practices.js @@ -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')] + } }; diff --git a/test/fixtures/no-useless-return.fail.js b/test/fixtures/no-useless-return.fail.js new file mode 100644 index 0000000..4b0f7dc --- /dev/null +++ b/test/fixtures/no-useless-return.fail.js @@ -0,0 +1 @@ +function foo() { return; } \ No newline at end of file diff --git a/test/fixtures/no-useless-return.pass.js b/test/fixtures/no-useless-return.pass.js new file mode 100644 index 0000000..eb6a7c1 --- /dev/null +++ b/test/fixtures/no-useless-return.pass.js @@ -0,0 +1 @@ +function foo() { return 5; } \ No newline at end of file