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
+3-10Lines changed: 3 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,8 +31,6 @@ Since the 0.0.4 release, some rules defined in [John Papa's Guideline](https://g
31
31
32
32
## Usage with [shareable](http://eslint.org/docs/developer-guide/shareable-configs.html) config
33
33
34
-
Users may use the shareable [eslint-config-angular](https://github.com/dustinspecker/eslint-config-angular) to quickly setup eslint-plugin-angular. It also marks Angular as a global variable and defines required ESLint rules to use this plugin.
35
-
36
34
1. Install `eslint` as a dev-dependency:
37
35
38
36
```shell
@@ -45,16 +43,10 @@ Users may use the shareable [eslint-config-angular](https://github.com/dustinspe
45
43
npm install --save-dev eslint-plugin-angular
46
44
```
47
45
48
-
3. Install `eslint-config-angular` as a dev-dependency:
49
-
50
-
```shell
51
-
npm install --save-dev eslint-config-angular
52
-
```
53
-
54
-
4. Use the shareable config by adding it to your `.eslintrc`:
46
+
3. Use the shareable config by adding it to your `.eslintrc`:
55
47
56
48
```yaml
57
-
extends: angular
49
+
extends: plugin:angular/johnpapa
58
50
```
59
51
60
52
@@ -100,6 +92,7 @@ Rules in eslint-plugin-angular are divided into several categories to help you b
100
92
101
93
The following rules detect patterns that can lead to errors.
102
94
95
+
* [avoid-scope-typos](docs/avoid-scope-typos.md) - Avoid mistakes when naming methods defined on the scope object
103
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))
104
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))
105
98
* [no-private-call](docs/no-private-call.md) - disallow use of internal angular properties prefixed with $$
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/avoid-scope-typos.js', 'examples/avoid-scope-typos.js'). -->
2
+
3
+
# avoid-scope-typos - Avoid mistakes when naming methods defined on the scope object
4
+
5
+
For example, you want to use $scope.$watch instead of $scope.watch
6
+
7
+
**Rule based on Angular 1.x**
8
+
9
+
## Examples
10
+
11
+
The following patterns are considered problems;
12
+
13
+
/*eslint angular/avoid-scope-typos: 2*/
14
+
15
+
// invalid
16
+
$scope.apply.forEach(function (watcher) {
17
+
// ...
18
+
}); // error: The apply method should be replaced by $apply, or you should rename it in order to avoid confusions
19
+
20
+
// invalid
21
+
$rootScope.apply.forEach(function (watcher) {
22
+
// ...
23
+
}); // error: The apply method should be replaced by $apply, or you should rename it in order to avoid confusions
24
+
25
+
The following patterns are **not** considered problems;
26
+
27
+
/*eslint angular/avoid-scope-typos: 2*/
28
+
29
+
// valid
30
+
$scope.$apply();
31
+
32
+
// valid
33
+
$rootScope.$apply();
34
+
35
+
## Version
36
+
37
+
This rule was introduced in eslint-plugin-angular 2.3.0
0 commit comments