Skip to content

Commit d2bf0ec

Browse files
committed
Merge pull request #345 from remcohaszing/remove-rulesconfig
Remove default configurations
2 parents 5eea5cf + d60e9f6 commit d2bf0ec

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Users may use the shareable [eslint-config-angular](https://github.com/dustinspe
104104
"angular/controller-as": 0,
105105
"angular/controller-as-route": 0,
106106
"angular/controller-as-vm": [0, "vm"],
107-
"angular/controller-name": [0, "/[A-Z].*Controller$/"],
107+
"angular/controller-name": 0,
108108
"angular/deferred": 0,
109109
"angular/definedundefined": 0,
110110
"angular/di": [0, "function"],

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ rulesConfiguration.addRule('component-limit', [0, 1]);
77
rulesConfiguration.addRule('controller-as', 0);
88
rulesConfiguration.addRule('controller-as-route', 0);
99
rulesConfiguration.addRule('controller-as-vm', [0, 'vm']);
10-
rulesConfiguration.addRule('controller-name', [0, /[A-Z].*Controller$/]);
10+
rulesConfiguration.addRule('controller-name', 0);
1111
rulesConfiguration.addRule('deferred', 0);
1212
rulesConfiguration.addRule('definedundefined', 0);
1313
rulesConfiguration.addRule('di', [0, 'function']);

rules/controller-name.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ module.exports = function(context) {
1818
return {
1919

2020
CallExpression: function(node) {
21-
var prefix = context.options[0];
21+
var prefix = context.options[0] || '/[A-Z].*Controller$/';
2222
var convertedPrefix; // convert string from JSON .eslintrc to regex
2323

24-
if (prefix === undefined) {
25-
return;
26-
}
27-
2824
convertedPrefix = utils.convertPrefixToRegex(prefix);
2925

3026
var callee = node.callee;
@@ -55,3 +51,9 @@ module.exports = function(context) {
5551
}
5652
};
5753
};
54+
55+
module.exports.schema = [
56+
{
57+
type: 'string'
58+
}
59+
];

test/controller-name.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@ eslintTester.run('controller-name', rule, {
1919
options: ['eslint']
2020
}, {
2121
code: 'app.controller("eslintController", function() {});',
22-
options: [/^eslint/]
23-
}, {
24-
code: 'app.controller("eslintController", function() {});',
25-
options: [undefined]
22+
options: ['/^eslint/']
2623
}, {
2724
code: 'app.controller("EslintController", function() {});',
28-
options: [/[A-Z].*Controller$/]
25+
options: ['/[A-Z].*Controller$/']
2926
}, {
3027
code: 'app.controller("EslintController", function() {});',
3128
options: ['/[A-Z].*Controller$/']
@@ -49,17 +46,17 @@ eslintTester.run('controller-name', rule, {
4946
},
5047
{
5148
code: 'app.controller("Controller", function() {});',
52-
options: [/^eslint/],
49+
options: ['/^eslint/'],
5350
errors: [{message: 'The Controller controller should follow this pattern: /^eslint/'}]
5451
},
5552
{
5653
code: 'app.controller("customers", function() {});',
57-
options: [/[A-Z].*Controller$/],
54+
options: ['/[A-Z].*Controller$/'],
5855
errors: [{message: 'The customers controller should follow this pattern: /[A-Z].*Controller$/'}]
5956
},
6057
{
6158
code: 'app.controller("customersController", function() {});',
62-
options: [/[A-Z].*Controller$/],
59+
options: ['/[A-Z].*Controller$/'],
6360
errors: [{message: 'The customersController controller should follow this pattern: /[A-Z].*Controller$/'}]
6461
}, {
6562
code: 'app.controller("eslintController", function() {});',

0 commit comments

Comments
 (0)