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
@@ -164,22 +98,22 @@ Users may use the shareable [eslint-config-angular](https://github.com/dustinspe
164
98
Rules in eslint-plugin-angular are divided into several categories to help you better understand their value.
165
99
166
100
167
-
## Possible Errors
101
+
### Possible Errors
168
102
169
103
The following rules detect patterns that can lead to errors.
170
104
171
105
* [module-getter](docs/module-getter.md) - disallow to reference modules with variables and require to use the getter syntax instead `angular.module('myModule')` ([y022](https://github.com/johnpapa/angular-styleguide#style-y022))
172
106
* [module-setter](docs/module-setter.md) - disallow to assign modules to variables (linked to [module-getter](docs/module-getter.md) ([y021](https://github.com/johnpapa/angular-styleguide#style-y021))
173
107
* [no-private-call](docs/no-private-call.md) - disallow use of internal angular properties prefixed with $$
174
108
175
-
## Best Practices
109
+
### Best Practices
176
110
177
111
These are rules designed to prevent you from making mistakes. They either prescribe a better way of doing something or help you avoid footguns..
178
112
179
113
* [component-limit](docs/component-limit.md) - limit the number of angular components per file ([y001](https://github.com/johnpapa/angular-styleguide#style-y001))
180
-
* [controller-as](docs/controller-as.md) - disallow assignments to `$scope`in controllers ([y031](https://github.com/johnpapa/angular-styleguide#style-y031))
181
114
* [controller-as-route](docs/controller-as-route.md) - require the use of controllerAs in routes or states ([y031](https://github.com/johnpapa/angular-styleguide#style-y031))
182
115
* [controller-as-vm](docs/controller-as-vm.md) - require and specify a capture variable for`this`in controllers ([y032](https://github.com/johnpapa/angular-styleguide#style-y032))
116
+
* [controller-as](docs/controller-as.md) - disallow assignments to `$scope`in controllers ([y031](https://github.com/johnpapa/angular-styleguide#style-y031))
183
117
* [deferred](docs/deferred.md) - use `$q(function(resolve, reject){})` instead of `$q.deferred`
184
118
* [di-unused](docs/di-unused.md) - disallow unused DI parameters
185
119
* [directive-restrict](docs/directive-restrict.md) - disallow any other directive restrict than 'A' or 'E' ([y074](https://github.com/johnpapa/angular-styleguide#style-y074))
@@ -190,15 +124,15 @@ These are rules designed to prevent you from making mistakes. They either prescr
190
124
* [no-services](docs/no-services.md) - disallow DI of specified services for other angular components (`$http`for controllers, filters and directives)
191
125
* [on-watch](docs/on-watch.md) - require `$on` and `$watch` deregistration callbacks to be saved in a variable
192
126
193
-
## Deprecated Angular Features
127
+
### Deprecated Angular Features
194
128
195
129
These rules prevent you from using deprecated angular features.
196
130
197
131
* [no-cookiestore](docs/no-cookiestore.md) - use `$cookies` instead of `$cookieStore`
198
132
* [no-directive-replace](docs/no-directive-replace.md) - disallow the deprecated directive replace property
199
133
* [no-http-callback](docs/no-http-callback.md) - disallow the `$http` methods `success()` and `error()`
200
134
201
-
## Naming
135
+
### Naming
202
136
203
137
These rules help you to specify several naming conventions.
204
138
@@ -209,12 +143,12 @@ These rules help you to specify several naming conventions.
209
143
* [module-name](docs/module-name.md) - require and specify a prefix for all module names ([y127](https://github.com/johnpapa/angular-styleguide#style-y127))
210
144
* [service-name](docs/service-name.md) - require and specify a prefix for all service names ([y125](https://github.com/johnpapa/angular-styleguide#style-y125))
211
145
212
-
## Conventions
146
+
### Conventions
213
147
214
148
Angular often provide multi ways to to something. These rules help you to define convention for your project.
215
149
216
-
* [di](docs/di.md) - require a consistent DI syntax
217
150
* [di-order](docs/di-order.md) - require DI parameters to be sorted alphabetically
151
+
* [di](docs/di.md) - require a consistent DI syntax
218
152
* [dumb-inject](docs/dumb-inject.md) - unittest `inject` functions should only consist of assignments from injected values to describe block variables
219
153
* [function-type](docs/function-type.md) - require and specify a consistent functionstylefor components ('named' or 'anonymous') ([y024](https://github.com/johnpapa/angular-styleguide#style-y024))
220
154
* [module-dependency-order](docs/module-dependency-order.md) - require a consistent order of module dependencies
@@ -223,7 +157,7 @@ Angular often provide multi ways to to something. These rules help you to define
223
157
* [rest-service](docs/rest-service.md) - disallow different rest service and specify one of '$http', '$resource', 'Restangular'
224
158
* [watchers-execution](docs/watchers-execution.md) - require and specify consistent use `$scope.digest()` or `$scope.apply()`
225
159
226
-
## Angular Wrappers
160
+
### Angular Wrappers
227
161
228
162
These rules help you to enforce the usage of angular wrappers.
229
163
@@ -245,12 +179,18 @@ These rules help you to enforce the usage of angular wrappers.
245
179
* [typecheck-string](docs/typecheck-string.md) - use `angular.isString` instead of `typeof` comparisons
246
180
* [window-service](docs/window-service.md) - use `$window` instead of `window` ([y180](https://github.com/johnpapa/angular-styleguide#style-y180))
247
181
248
-
## Deprecated rules
249
182
250
-
These rules will be removed in version 1.0.0
251
183
252
-
* [no-digest](docs/no-digest.md) - use `$apply()` instead of `$digest()` (replaced by [watchers-execution](docs/watchers-execution.md))
253
-
* [typecheck-regexp](docs/typecheck-regexp.md) - use `angular.isRegexp` instead of other comparisons (no native angular method)
184
+
## Environments
185
+
186
+
This plugin enables the use of environments targeted at AngularJS. These environments define the globals each situation respectively.
187
+
188
+
```yaml
189
+
env:
190
+
angular/angular: true
191
+
angular/mocks: true
192
+
angular/protractor: true
193
+
```
254
194
255
195
256
196
----
@@ -357,12 +297,10 @@ return {
357
297
358
298
Here is the basic configuration forthe rules definedin the ESLint plugin, in order to be compatible with the guideline provided by @johnpapa :
0 commit comments