Skip to content

Commit 15697e0

Browse files
Merge pull request #428 from Gillespie59/development
1.6.0
2 parents a6a473c + 163fe59 commit 15697e0

24 files changed

+988
-25
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@ These rules prevent you from using deprecated angular features.
136136
These rules help you to specify several naming conventions.
137137
138138
* [component-name](docs/component-name.md) - require and specify a prefix for all component names
139+
* [constant-name](docs/constant-name.md) - require and specify a prefix for all constant names ([y125](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125))
139140
* [controller-name](docs/controller-name.md) - require and specify a prefix for all controller names ([y123](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y123), [y124](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y124))
140141
* [directive-name](docs/directive-name.md) - require and specify a prefix for all directive names ([y073](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y073), [y126](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y126))
142+
* [factory-name](docs/factory-name.md) - require and specify a prefix for all factory names ([y125](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125))
141143
* [file-name](docs/file-name.md) - require and specify a consistent component name pattern ([y120](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y120), [y121](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y121))
142144
* [filter-name](docs/filter-name.md) - require and specify a prefix for all filter names
143145
* [module-name](docs/module-name.md) - require and specify a prefix for all module names ([y127](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y127))
146+
* [provider-name](docs/provider-name.md) - require and specify a prefix for all provider names ([y125](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125))
144147
* [service-name](docs/service-name.md) - require and specify a prefix for all service names ([y125](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125))
148+
* [value-name](docs/value-name.md) - require and specify a prefix for all value names ([y125](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125))
145149
146150
### Conventions
147151

docs/constant-name.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/constant-name.js', 'examples/constant-name.js'). -->
2+
3+
# constant-name - require and specify a prefix for all constant names
4+
5+
All your constants should have a name starting with the parameter you can define in your config object.
6+
The second parameter can be a Regexp wrapped in quotes.
7+
You can not prefix your constants by "$" (reserved keyword for AngularJS services) ("constant-name": [2, "ng"])
8+
*
9+
10+
**Styleguide Reference**
11+
12+
* [y125 by johnpapa - Naming - Factory and Service Names](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125)
13+
14+
## Examples
15+
16+
The following patterns are **not** considered problems when configured `"prefix"`:
17+
18+
/*eslint angular/constant-name: [2,"prefix"]*/
19+
20+
// valid
21+
angular.module('myModule').constant('prefixConstant', function () {
22+
// ...
23+
});
24+
25+
The following patterns are considered problems when configured `"/^xyz/"`:
26+
27+
/*eslint angular/constant-name: [2,"/^xyz/"]*/
28+
29+
// invalid
30+
angular.module('myModule').constant('otherConstant', function () {
31+
// ...
32+
}); // error: The otherConstant constant should follow this pattern: /^xyz/
33+
34+
The following patterns are **not** considered problems when configured `"/^xyz/"`:
35+
36+
/*eslint angular/constant-name: [2,"/^xyz/"]*/
37+
38+
// valid
39+
angular.module('myModule').constant('xyzConstant', function () {
40+
// ...
41+
});
42+
43+
The following patterns are considered problems when configured `"xyz"`:
44+
45+
/*eslint angular/constant-name: [2,"xyz"]*/
46+
47+
// invalid
48+
angular.module('myModule').constant('myConstant', function () {
49+
// ...
50+
}); // error: The myConstant constant should be prefixed by xyz
51+
52+
## Version
53+
54+
This rule was introduced in eslint-plugin-angular 0.1.0
55+
56+
## Links
57+
58+
* [Rule source](../rules/constant-name.js)
59+
* [Example source](../examples/constant-name.js)

docs/factory-name.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/factory-name.js', 'examples/factory-name.js'). -->
2+
3+
# factory-name - require and specify a prefix for all factory names
4+
5+
All your factorys should have a name starting with the parameter you can define in your config object.
6+
The second parameter can be a Regexp wrapped in quotes.
7+
You can not prefix your factorys by "$" (reserved keyword for AngularJS services) ("factory-name": [2, "ng"])
8+
*
9+
10+
**Styleguide Reference**
11+
12+
* [y125 by johnpapa - Naming - Factory and Service Names](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125)
13+
14+
## Examples
15+
16+
The following patterns are **not** considered problems when configured `"prefix"`:
17+
18+
/*eslint angular/factory-name: [2,"prefix"]*/
19+
20+
// valid
21+
angular.module('myModule').factory('prefixFactory', function () {
22+
// ...
23+
});
24+
25+
The following patterns are considered problems when configured `"/^xyz/"`:
26+
27+
/*eslint angular/factory-name: [2,"/^xyz/"]*/
28+
29+
// invalid
30+
angular.module('myModule').factory('otherFactory', function () {
31+
// ...
32+
}); // error: The otherFactory factory should follow this pattern: /^xyz/
33+
34+
The following patterns are **not** considered problems when configured `"/^xyz/"`:
35+
36+
/*eslint angular/factory-name: [2,"/^xyz/"]*/
37+
38+
// valid
39+
angular.module('myModule').factory('xyzFactory', function () {
40+
// ...
41+
});
42+
43+
The following patterns are considered problems when configured `"xyz"`:
44+
45+
/*eslint angular/factory-name: [2,"xyz"]*/
46+
47+
// invalid
48+
angular.module('myModule').factory('myFactory', function () {
49+
// ...
50+
}); // error: The myFactory factory should be prefixed by xyz
51+
52+
## Version
53+
54+
This rule was introduced in eslint-plugin-angular 0.1.0
55+
56+
## Links
57+
58+
* [Rule source](../rules/factory-name.js)
59+
* [Example source](../examples/factory-name.js)

docs/provider-name.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/provider-name.js', 'examples/provider-name.js'). -->
2+
3+
# provider-name - require and specify a prefix for all provider names
4+
5+
All your providers should have a name starting with the parameter you can define in your config object.
6+
The second parameter can be a Regexp wrapped in quotes.
7+
You can not prefix your providers by "$" (reserved keyword for AngularJS services) ("provider-name": [2, "ng"])
8+
*
9+
10+
**Styleguide Reference**
11+
12+
* [y125 by johnpapa - Naming - Factory and Service Names](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125)
13+
14+
## Examples
15+
16+
The following patterns are **not** considered problems when configured `"prefix"`:
17+
18+
/*eslint angular/provider-name: [2,"prefix"]*/
19+
20+
// valid
21+
angular.module('myModule').provider('prefixProvider', function () {
22+
// ...
23+
});
24+
25+
The following patterns are considered problems when configured `"/^xyz/"`:
26+
27+
/*eslint angular/provider-name: [2,"/^xyz/"]*/
28+
29+
// invalid
30+
angular.module('myModule').provider('otherProvider', function () {
31+
// ...
32+
}); // error: The otherProvider provider should follow this pattern: /^xyz/
33+
34+
The following patterns are **not** considered problems when configured `"/^xyz/"`:
35+
36+
/*eslint angular/provider-name: [2,"/^xyz/"]*/
37+
38+
// valid
39+
angular.module('myModule').provider('xyzProvider', function () {
40+
// ...
41+
});
42+
43+
The following patterns are considered problems when configured `"xyz"`:
44+
45+
/*eslint angular/provider-name: [2,"xyz"]*/
46+
47+
// invalid
48+
angular.module('myModule').provider('myProvider', function () {
49+
// ...
50+
}); // error: The myProvider provider should be prefixed by xyz
51+
52+
## Version
53+
54+
This rule was introduced in eslint-plugin-angular 0.1.0
55+
56+
## Links
57+
58+
* [Rule source](../rules/provider-name.js)
59+
* [Example source](../examples/provider-name.js)

docs/service-name.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,39 @@ You can not prefix your services by "$" (reserved keyword for AngularJS services
1515

1616
## Examples
1717

18-
The following patterns are **not** considered problems when configured `"prefix"`:
18+
The following patterns are **not** considered problems when configured `"prefix"` and `{"oldBehavior":false}`:
1919

20-
/*eslint angular/service-name: [2,"prefix"]*/
20+
/*eslint angular/service-name: [2,"prefix",{"oldBehavior":false}]*/
2121

2222
// valid
23-
angular.module('myModule').factory('prefixService', function () {
23+
angular.module('myModule').service('prefixService', function () {
2424
// ...
2525
});
2626

27-
The following patterns are considered problems when configured `"/^xyz/"`:
27+
The following patterns are considered problems when configured `"/^xyz/"` and `{"oldBehavior":false}`:
2828

29-
/*eslint angular/service-name: [2,"/^xyz/"]*/
29+
/*eslint angular/service-name: [2,"/^xyz/",{"oldBehavior":false}]*/
3030

3131
// invalid
32-
angular.module('myModule').factory('otherService', function () {
32+
angular.module('myModule').service('otherService', function () {
3333
// ...
3434
}); // error: The otherService service should follow this pattern: /^xyz/
3535

36-
The following patterns are **not** considered problems when configured `"/^xyz/"`:
36+
The following patterns are **not** considered problems when configured `"/^xyz/"` and `{"oldBehavior":false}`:
3737

38-
/*eslint angular/service-name: [2,"/^xyz/"]*/
38+
/*eslint angular/service-name: [2,"/^xyz/",{"oldBehavior":false}]*/
3939

4040
// valid
41-
angular.module('myModule').factory('xyzService', function () {
41+
angular.module('myModule').service('xyzService', function () {
4242
// ...
4343
});
4444

45-
The following patterns are considered problems when configured `"xyz"`:
45+
The following patterns are considered problems when configured `"xyz"` and `{"oldBehavior":false}`:
4646

47-
/*eslint angular/service-name: [2,"xyz"]*/
47+
/*eslint angular/service-name: [2,"xyz",{"oldBehavior":false}]*/
4848

4949
// invalid
50-
angular.module('myModule').factory('myService', function () {
50+
angular.module('myModule').service('myService', function () {
5151
// ...
5252
}); // error: The myService service should be prefixed by xyz
5353

docs/value-name.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/value-name.js', 'examples/value-name.js'). -->
2+
3+
# value-name - require and specify a prefix for all value names
4+
5+
All your values should have a name starting with the parameter you can define in your config object.
6+
The second parameter can be a Regexp wrapped in quotes.
7+
You can not prefix your values by "$" (reserved keyword for AngularJS services) ("value-name": [2, "ng"])
8+
*
9+
10+
**Styleguide Reference**
11+
12+
* [y125 by johnpapa - Naming - Factory and Service Names](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y125)
13+
14+
## Examples
15+
16+
The following patterns are **not** considered problems when configured `"prefix"`:
17+
18+
/*eslint angular/value-name: [2,"prefix"]*/
19+
20+
// valid
21+
angular.module('myModule').value('prefixValue', function () {
22+
// ...
23+
});
24+
25+
The following patterns are considered problems when configured `"/^xyz/"`:
26+
27+
/*eslint angular/value-name: [2,"/^xyz/"]*/
28+
29+
// invalid
30+
angular.module('myModule').value('otherValue', function () {
31+
// ...
32+
}); // error: The otherValue value should follow this pattern: /^xyz/
33+
34+
The following patterns are **not** considered problems when configured `"/^xyz/"`:
35+
36+
/*eslint angular/value-name: [2,"/^xyz/"]*/
37+
38+
// valid
39+
angular.module('myModule').value('xyzValue', function () {
40+
// ...
41+
});
42+
43+
The following patterns are considered problems when configured `"xyz"`:
44+
45+
/*eslint angular/value-name: [2,"xyz"]*/
46+
47+
// invalid
48+
angular.module('myModule').value('myValue', function () {
49+
// ...
50+
}); // error: The myValue value should be prefixed by xyz
51+
52+
## Version
53+
54+
This rule was introduced in eslint-plugin-angular 0.1.0
55+
56+
## Links
57+
58+
* [Rule source](../rules/value-name.js)
59+
* [Example source](../examples/value-name.js)

examples/constant-name.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// example - valid: true, options: ["prefix"]
2+
angular.module('myModule').constant('prefixConstant', function () {
3+
// ...
4+
});
5+
6+
// example - valid: true, options: ["/^xyz/"]
7+
angular.module('myModule').constant('xyzConstant', function () {
8+
// ...
9+
});
10+
11+
// example - valid: false, options: ["xyz"], errorMessage: "The myConstant constant should be prefixed by xyz"
12+
angular.module('myModule').constant('myConstant', function () {
13+
// ...
14+
});
15+
16+
// example - valid: false, options: ["/^xyz/"], errorMessage: "The otherConstant constant should follow this pattern\: /^xyz/"
17+
angular.module('myModule').constant('otherConstant', function () {
18+
// ...
19+
});

examples/factory-name.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// example - valid: true, options: ["prefix"]
2+
angular.module('myModule').factory('prefixFactory', function () {
3+
// ...
4+
});
5+
6+
// example - valid: true, options: ["/^xyz/"]
7+
angular.module('myModule').factory('xyzFactory', function () {
8+
// ...
9+
});
10+
11+
// example - valid: false, options: ["xyz"], errorMessage: "The myFactory factory should be prefixed by xyz"
12+
angular.module('myModule').factory('myFactory', function () {
13+
// ...
14+
});
15+
16+
// example - valid: false, options: ["/^xyz/"], errorMessage: "The otherFactory factory should follow this pattern\: /^xyz/"
17+
angular.module('myModule').factory('otherFactory', function () {
18+
// ...
19+
});

examples/provider-name.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// example - valid: true, options: ["prefix"]
2+
angular.module('myModule').provider('prefixProvider', function () {
3+
// ...
4+
});
5+
6+
// example - valid: true, options: ["/^xyz/"]
7+
angular.module('myModule').provider('xyzProvider', function () {
8+
// ...
9+
});
10+
11+
// example - valid: false, options: ["xyz"], errorMessage: "The myProvider provider should be prefixed by xyz"
12+
angular.module('myModule').provider('myProvider', function () {
13+
// ...
14+
});
15+
16+
// example - valid: false, options: ["/^xyz/"], errorMessage: "The otherProvider provider should follow this pattern\: /^xyz/"
17+
angular.module('myModule').provider('otherProvider', function () {
18+
// ...
19+
});

examples/service-name.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
// example - valid: true, options: ["prefix"]
2-
angular.module('myModule').factory('prefixService', function () {
1+
// example - valid: true, options: ["prefix", {oldBehavior: false}]
2+
angular.module('myModule').service('prefixService', function () {
33
// ...
44
});
55

6-
// example - valid: true, options: ["/^xyz/"]
7-
angular.module('myModule').factory('xyzService', function () {
6+
// example - valid: true, options: ["/^xyz/", {oldBehavior: false}]
7+
angular.module('myModule').service('xyzService', function () {
88
// ...
99
});
1010

11-
// example - valid: false, options: ["xyz"], errorMessage: "The myService service should be prefixed by xyz"
12-
angular.module('myModule').factory('myService', function () {
11+
// example - valid: false, options: ["xyz", {oldBehavior: false}], errorMessage: "The myService service should be prefixed by xyz"
12+
angular.module('myModule').service('myService', function () {
1313
// ...
1414
});
1515

16-
// example - valid: false, options: ["/^xyz/"], errorMessage: "The otherService service should follow this pattern\: /^xyz/"
17-
angular.module('myModule').factory('otherService', function () {
16+
// example - valid: false, options: ["/^xyz/", {oldBehavior: false}], errorMessage: "The otherService service should follow this pattern\: /^xyz/"
17+
angular.module('myModule').service('otherService', function () {
1818
// ...
1919
});
2020

0 commit comments

Comments
 (0)