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
+59-59Lines changed: 59 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,95 +92,95 @@ Rules in eslint-plugin-angular are divided into several categories to help you b
92
92
93
93
The following rules detect patterns that can lead to errors.
94
94
95
-
* [avoid-scope-typos](docs/avoid-scope-typos.md) - Avoid mistakes when naming methods defined on the scope object
96
-
* [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/blob/master/a1/README.md#style-y022))
97
-
* [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/blob/master/a1/README.md#style-y021))
98
-
* [no-private-call](docs/no-private-call.md) - disallow use of internal angular properties prefixed with $$
95
+
* [avoid-scope-typos](docs/rules/avoid-scope-typos.md) - Avoid mistakes when naming methods defined on the scope object
96
+
* [module-getter](docs/rules/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/blob/master/a1/README.md#style-y022))
97
+
* [module-setter](docs/rules/module-setter.md) - disallow to assign modules to variables (linked to [module-getter](docs/module-getter.md) ([y021](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y021))
98
+
* [no-private-call](docs/rules/no-private-call.md) - disallow use of internal angular properties prefixed with $$
99
99
100
100
### Best Practices
101
101
102
102
These are rules designed to prevent you from making mistakes. They either prescribe a better way of doing something or help you avoid footguns..
103
103
104
-
* [component-limit](docs/component-limit.md) - limit the number of angular components per file ([y001](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y001))
105
-
* [controller-as-route](docs/controller-as-route.md) - require the use of controllerAs in routes or states ([y031](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y031))
106
-
* [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/blob/master/a1/README.md#style-y032))
107
-
* [controller-as](docs/controller-as.md) - disallow assignments to `$scope`in controllers ([y031](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y031))
108
-
* [deferred](docs/deferred.md) - use `$q(function(resolve, reject){})` instead of `$q.deferred`
109
-
* [di-unused](docs/di-unused.md) - disallow unused DI parameters
110
-
* [directive-restrict](docs/directive-restrict.md) - disallow any other directive restrict than 'A' or 'E' ([y074](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y074))
* [no-controller](docs/no-controller.md) - disallow use of controllers (according to the component first pattern)
113
-
* [no-inline-template](docs/no-inline-template.md) - disallow the use of inline templates
114
-
* [no-run-logic](docs/no-run-logic.md) - keep run functions clean and simple ([y171](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y171))
115
-
* [no-services](docs/no-services.md) - disallow DI of specified services for other angular components (`$http`for controllers, filters and directives)
116
-
* [on-watch](docs/on-watch.md) - require `$on` and `$watch` deregistration callbacks to be saved in a variable
117
-
* [prefer-component](docs/prefer-component.md) -
104
+
* [component-limit](docs/rules/component-limit.md) - limit the number of angular components per file ([y001](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y001))
105
+
* [controller-as-route](docs/rules/controller-as-route.md) - require the use of controllerAs in routes or states ([y031](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y031))
106
+
* [controller-as-vm](docs/rules/controller-as-vm.md) - require and specify a capture variable for`this`in controllers ([y032](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y032))
107
+
* [controller-as](docs/rules/controller-as.md) - disallow assignments to `$scope`in controllers ([y031](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y031))
108
+
* [deferred](docs/rules/deferred.md) - use `$q(function(resolve, reject){})` instead of `$q.deferred`
109
+
* [di-unused](docs/rules/di-unused.md) - disallow unused DI parameters
110
+
* [directive-restrict](docs/rules/directive-restrict.md) - disallow any other directive restrict than 'A' or 'E' ([y074](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y074))
* [no-controller](docs/rules/no-controller.md) - disallow use of controllers (according to the component first pattern)
113
+
* [no-inline-template](docs/rules/no-inline-template.md) - disallow the use of inline templates
114
+
* [no-run-logic](docs/rules/no-run-logic.md) - keep run functions clean and simple ([y171](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y171))
115
+
* [no-services](docs/rules/no-services.md) - disallow DI of specified services for other angular components (`$http`for controllers, filters and directives)
116
+
* [on-watch](docs/rules/on-watch.md) - require `$on` and `$watch` deregistration callbacks to be saved in a variable
These rules prevent you from using deprecated angular features.
122
122
123
-
* [no-cookiestore](docs/no-cookiestore.md) - use `$cookies` instead of `$cookieStore`
124
-
* [no-directive-replace](docs/no-directive-replace.md) - disallow the deprecated directive replace property
125
-
* [no-http-callback](docs/no-http-callback.md) - disallow the `$http` methods `success()` and `error()`
123
+
* [no-cookiestore](docs/rules/no-cookiestore.md) - use `$cookies` instead of `$cookieStore`
124
+
* [no-directive-replace](docs/rules/no-directive-replace.md) - disallow the deprecated directive replace property
125
+
* [no-http-callback](docs/rules/no-http-callback.md) - disallow the `$http` methods `success()` and `error()`
126
126
127
127
### Naming
128
128
129
129
These rules help you to specify several naming conventions.
130
130
131
-
* [component-name](docs/component-name.md) - require and specify a prefix for all component names
132
-
* [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))
133
-
* [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))
134
-
* [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))
135
-
* [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))
136
-
* [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))
137
-
* [filter-name](docs/filter-name.md) - require and specify a prefix for all filter names
138
-
* [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))
139
-
* [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))
140
-
* [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))
141
-
* [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))
131
+
* [component-name](docs/rules/component-name.md) - require and specify a prefix for all component names
132
+
* [constant-name](docs/rules/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))
133
+
* [controller-name](docs/rules/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))
134
+
* [directive-name](docs/rules/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))
135
+
* [factory-name](docs/rules/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))
136
+
* [file-name](docs/rules/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))
137
+
* [filter-name](docs/rules/filter-name.md) - require and specify a prefix for all filter names
138
+
* [module-name](docs/rules/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))
139
+
* [provider-name](docs/rules/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))
140
+
* [service-name](docs/rules/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))
141
+
* [value-name](docs/rules/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))
142
142
143
143
### Conventions
144
144
145
145
Angular often provide multi ways to to something. These rules help you to define convention for your project.
146
146
147
-
* [di-order](docs/di-order.md) - require DI parameters to be sorted alphabetically
148
-
* [di](docs/di.md) - require a consistent DI syntax
149
-
* [dumb-inject](docs/dumb-inject.md) - unittest `inject` functions should only consist of assignments from injected values to describe block variables
150
-
* [function-type](docs/function-type.md) - require and specify a consistent functionstylefor components ('named' or 'anonymous') ([y024](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y024))
151
-
* [module-dependency-order](docs/module-dependency-order.md) - require a consistent order of module dependencies
152
-
* [no-service-method](docs/no-service-method.md) - use `factory()` instead of `service()` ([y040](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y040))
153
-
* [one-dependency-per-line](docs/one-dependency-per-line.md) - require all DI parameters to be located in their own line
154
-
* [rest-service](docs/rest-service.md) - disallow different rest service and specify one of '$http', '$resource', 'Restangular'
155
-
* [watchers-execution](docs/watchers-execution.md) - require and specify consistent use `$scope.digest()` or `$scope.apply()`
147
+
* [di-order](docs/rules/di-order.md) - require DI parameters to be sorted alphabetically
148
+
* [di](docs/rules/di.md) - require a consistent DI syntax
149
+
* [dumb-inject](docs/rules/dumb-inject.md) - unittest `inject` functions should only consist of assignments from injected values to describe block variables
150
+
* [function-type](docs/rules/function-type.md) - require and specify a consistent functionstylefor components ('named' or 'anonymous') ([y024](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y024))
151
+
* [module-dependency-order](docs/rules/module-dependency-order.md) - require a consistent order of module dependencies
152
+
* [no-service-method](docs/rules/no-service-method.md) - use `factory()` instead of `service()` ([y040](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y040))
153
+
* [one-dependency-per-line](docs/rules/one-dependency-per-line.md) - require all DI parameters to be located in their own line
154
+
* [rest-service](docs/rules/rest-service.md) - disallow different rest service and specify one of '$http', '$resource', 'Restangular'
155
+
* [watchers-execution](docs/rules/watchers-execution.md) - require and specify consistent use `$scope.digest()` or `$scope.apply()`
156
156
157
157
### Angular Wrappers
158
158
159
159
These rules help you to enforce the usage of angular wrappers.
160
160
161
-
* [angularelement](docs/angularelement.md) - use `angular.element` instead of `$` or `jQuery`
162
-
* [definedundefined](docs/definedundefined.md) - use `angular.isDefined` and `angular.isUndefined` instead of other undefined checks
163
-
* [document-service](docs/document-service.md) - use `$document` instead of `document` ([y180](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y180))
164
-
* [foreach](docs/foreach.md) - use `angular.forEach` instead of native `Array.prototype.forEach`
165
-
* [interval-service](docs/interval-service.md) - use `$interval` instead of `setInterval` ([y181](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y181))
166
-
* [json-functions](docs/json-functions.md) - use `angular.fromJson` and 'angular.toJson' instead of `JSON.parse` and `JSON.stringify`
167
-
* [log](docs/log.md) - use the `$log` service instead of the `console` methods
168
-
* [no-angular-mock](docs/no-angular-mock.md) - require to use `angular.mock` methods directly
169
-
* [no-jquery-angularelement](docs/no-jquery-angularelement.md) - disallow to wrap `angular.element` objects with `jQuery` or `$`
170
-
* [timeout-service](docs/timeout-service.md) - use `$timeout` instead of `setTimeout` ([y181](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y181))
171
-
* [typecheck-array](docs/typecheck-array.md) - use `angular.isArray` instead of `typeof` comparisons
172
-
* [typecheck-date](docs/typecheck-date.md) - use `angular.isDate` instead of `typeof` comparisons
173
-
* [typecheck-function](docs/typecheck-function.md) - use `angular.isFunction` instead of `typeof` comparisons
174
-
* [typecheck-number](docs/typecheck-number.md) - use `angular.isNumber` instead of `typeof` comparisons
175
-
* [typecheck-object](docs/typecheck-object.md) - use `angular.isObject` instead of `typeof` comparisons
176
-
* [typecheck-string](docs/typecheck-string.md) - use `angular.isString` instead of `typeof` comparisons
177
-
* [window-service](docs/window-service.md) - use `$window` instead of `window` ([y180](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y180))
161
+
* [angularelement](docs/rules/angularelement.md) - use `angular.element` instead of `$` or `jQuery`
162
+
* [definedundefined](docs/rules/definedundefined.md) - use `angular.isDefined` and `angular.isUndefined` instead of other undefined checks
163
+
* [document-service](docs/rules/document-service.md) - use `$document` instead of `document` ([y180](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y180))
164
+
* [foreach](docs/rules/foreach.md) - use `angular.forEach` instead of native `Array.prototype.forEach`
165
+
* [interval-service](docs/rules/interval-service.md) - use `$interval` instead of `setInterval` ([y181](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y181))
166
+
* [json-functions](docs/rules/json-functions.md) - use `angular.fromJson` and 'angular.toJson' instead of `JSON.parse` and `JSON.stringify`
167
+
* [log](docs/rules/log.md) - use the `$log` service instead of the `console` methods
168
+
* [no-angular-mock](docs/rules/no-angular-mock.md) - require to use `angular.mock` methods directly
169
+
* [no-jquery-angularelement](docs/rules/no-jquery-angularelement.md) - disallow to wrap `angular.element` objects with `jQuery` or `$`
170
+
* [timeout-service](docs/rules/timeout-service.md) - use `$timeout` instead of `setTimeout` ([y181](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y181))
171
+
* [typecheck-array](docs/rules/typecheck-array.md) - use `angular.isArray` instead of `typeof` comparisons
172
+
* [typecheck-date](docs/rules/typecheck-date.md) - use `angular.isDate` instead of `typeof` comparisons
173
+
* [typecheck-function](docs/rules/typecheck-function.md) - use `angular.isFunction` instead of `typeof` comparisons
174
+
* [typecheck-number](docs/rules/typecheck-number.md) - use `angular.isNumber` instead of `typeof` comparisons
175
+
* [typecheck-object](docs/rules/typecheck-object.md) - use `angular.isObject` instead of `typeof` comparisons
176
+
* [typecheck-string](docs/rules/typecheck-string.md) - use `angular.isString` instead of `typeof` comparisons
177
+
* [window-service](docs/rules/window-service.md) - use `$window` instead of `window` ([y180](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y180))
178
178
179
179
### Misspelling
180
180
181
181
These rules help you avoiding misspellings.
182
182
183
-
* [on-destroy](docs/on-destroy.md) - Check for common misspelling $on('destroy', ...).
183
+
* [on-destroy](docs/rules/on-destroy.md) - Check for common misspelling $on('destroy', ...).
0 commit comments