You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,7 @@ These rules prevent you from using deprecated angular features.
135
135
136
136
These rules help you to specify several naming conventions.
137
137
138
+
* [component-name](docs/component-name.md) - require and specify a prefix for all component names
138
139
* [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))
139
140
* [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))
140
141
* [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))
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/component-name.js', 'examples/component-name.js'). -->
2
+
3
+
# component-name - require and specify a prefix for all component names
4
+
5
+
All your components 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 components by "ng" (reserved keyword for AngularJS components) ("component-name": [2, "ng"])
8
+
9
+
## Examples
10
+
11
+
The following patterns are **not** considered problems when configured `"prefix"`:
12
+
13
+
/*eslint angular/component-name: [2,"prefix"]*/
14
+
15
+
// valid
16
+
angular.module('myModule').component('prefixTabs', function () {
17
+
// ...
18
+
});
19
+
20
+
The following patterns are considered problems when configured `"/^ui/"`:
21
+
22
+
/*eslint angular/component-name: [2,"/^ui/"]*/
23
+
24
+
// invalid
25
+
angular.module('myModule').component('navigation', function () {
26
+
// ...
27
+
}); // error: The navigation component should follow this pattern: /^ui/
28
+
29
+
The following patterns are **not** considered problems when configured `"/^ui/"`:
30
+
31
+
/*eslint angular/component-name: [2,"/^ui/"]*/
32
+
33
+
// valid
34
+
angular.module('myModule').component('uiNavigation', function () {
35
+
// ...
36
+
});
37
+
38
+
The following patterns are considered problems when configured `"ui"`:
39
+
40
+
/*eslint angular/component-name: [2,"ui"]*/
41
+
42
+
// invalid
43
+
angular.module('myModule').component('tabs', function () {
44
+
// ...
45
+
}); // error: The tabs component should be prefixed by ui
46
+
47
+
## Version
48
+
49
+
This rule was introduced in eslint-plugin-angular 0.1.0
0 commit comments