Skip to content

Commit

Permalink
New: enforce-return-in-getter
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Apr 14, 2017
1 parent fac5389 commit bd9c4c0
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
3 changes: 2 additions & 1 deletion conf/eslint-recommended.js
Expand Up @@ -40,6 +40,7 @@ module.exports = {
"default-case": "off",
"dot-location": "off",
"dot-notation": "off",
"enforce-return-in-getter": "off",
"eol-last": "off",
"eqeqeq": "off",
"func-call-spacing": "off",
Expand Down Expand Up @@ -262,4 +263,4 @@ module.exports = {
"yield-star-spacing": "off",
"yoda": "off"
}
};
};
37 changes: 37 additions & 0 deletions lib/rules/enforce-return-in-getter.js
@@ -0,0 +1,37 @@
/**
* @fileoverview Enforces that a return statement is present in property getters.
* @author Aladdin-ADD(hh_2013@foxmail.com)
*/
"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------


//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------

module.exports = {
meta: {
docs: {
description: "Enforces that a return statement is present in property getters.",
category: "Possible Errors",
recommended: false
},

schema: []
},

create(context) {

return {

};
}
};
26 changes: 26 additions & 0 deletions tests/lib/rules/enforce-return-in-getter.js
@@ -0,0 +1,26 @@
/**
* @fileoverview Enforces that a return statement is present in property getters.
* @author Aladdin-ADD(hh_2013@foxmail.com)
*/

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const rule = require("../../../lib/rules/enforce-return-in-getter");
const RuleTester = require("../../../lib/testers/rule-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

const ruleTester = new RuleTester();

ruleTester.run("enforce-return-in-getter", rule, {

valid: [],

invalid: []
});

0 comments on commit bd9c4c0

Please sign in to comment.