Skip to content

Commit 9e0ae81

Browse files
committed
Merge pull request #320 from Gillespie59/development
0.15.0
2 parents bc06a10 + edc206d commit 9e0ae81

File tree

87 files changed

+1224
-143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1224
-143
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ rules:
118118

119119
# http://eslint.org/docs/rules/#nodejs
120120
callback-return: 2
121+
global-require: 2
121122
handle-callback-err:
122123
- 2
123124
- ^(e|err|error)$

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ language: node_js
22
node_js:
33
- "5.0"
44
- "4.2"
5-
- "0.10"
5+
- "0.12"
66
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"

README.md

Lines changed: 97 additions & 46 deletions
Large diffs are not rendered by default.

docs/dumb-inject.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/dumb-inject.js', 'examples/dumb-inject.js'). -->
2+
3+
# dumb-inject - unittest `inject` functions should only consist of assignments from injected values to describe block variables
4+
5+
`inject` functions in unittests should only contain a sorted mapping of injected values to values in the `describe` block with matching names.
6+
This way the dependency injection setup is separated from the other setup logic, improving readability of the test.
7+
8+
## Examples
9+
10+
The following patterns are considered problems;
11+
12+
/*eslint angular/dumb-inject: 2*/
13+
14+
// invalid
15+
describe(function() {
16+
var $httpBackend;
17+
var $rootScope;
18+
19+
beforeEach(inject(function(_$httpBackend_, _$rootScope_) {
20+
$httpBackend = _$httpBackend_;
21+
$rootScope = _$rootScope_;
22+
23+
$httpBackend.whenGET('/data').respond([]);
24+
}));
25+
}); // error: inject functions may only consist of assignments in the form myService = _myService_
26+
27+
// invalid
28+
describe(function() {
29+
var $httpBackend;
30+
var $rootScope;
31+
32+
beforeEach(inject(function(_$httpBackend_, _$rootScope_) {
33+
$rootScope = _$rootScope_;
34+
$httpBackend = _$httpBackend_;
35+
}));
36+
}); // error: '$httpBackend' must be sorted before '$rootScope'
37+
38+
The following patterns are **not** considered problems;
39+
40+
/*eslint angular/dumb-inject: 2*/
41+
42+
// valid
43+
describe(function() {
44+
var $httpBackend;
45+
var $rootScope;
46+
47+
beforeEach(inject(function(_$httpBackend_, _$rootScope_) {
48+
$httpBackend = _$httpBackend_;
49+
$rootScope = _$rootScope_;
50+
}));
51+
52+
beforeEach(function() {
53+
$httpBackend.whenGET('/data').respond([]);
54+
});
55+
});
56+
57+
## Version
58+
59+
This rule was introduced in eslint-plugin-angular 0.15.0
60+
61+
## Links
62+
63+
* [Rule source](../rules/dumb-inject.js)
64+
* [Example source](../examples/dumb-inject.js)

docs/no-cookiestore.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ The following patterns are considered problems;
1212
/*eslint angular/no-cookiestore: 2*/
1313

1414
// invalid
15-
$cookieStore.put('favoriteMeal', 'pizza'); // error: Since Angular 1.4, the $cookieStore service is depreacted. Please use now the $cookies service.
15+
$cookieStore.put('favoriteMeal', 'pizza'); // error: Since Angular 1.4, the $cookieStore service is deprecated. Please use now the $cookies service.
1616

1717
// invalid
18-
$cookieStore.get('favoriteMeal'); // error: Since Angular 1.4, the $cookieStore service is depreacted. Please use now the $cookies service.
18+
$cookieStore.get('favoriteMeal'); // error: Since Angular 1.4, the $cookieStore service is deprecated. Please use now the $cookies service.
1919

2020
The following patterns are **not** considered problems;
2121

docs/no-digest.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
# no-digest - use `$apply()` instead of `$digest()`
44

5-
DEPRECATED! The scope's $digest() method shouldn't be used.
5+
**This rule is deprecated and will be removed in future versions. Explanation: There is no reason to forbid the use of `$digest()` in general.**
6+
7+
The scope's $digest() method shouldn't be used.
68
You should prefer the $apply method.
79

10+
The `watchers-execution` rule can be configured to enforce the use of `$apply()` or `$digest()`.
11+
812
## Version
913

1014
This rule was introduced in eslint-plugin-angular 0.1.0

docs/no-directive-replace.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/no-directive-replace.js', 'examples/no-directive-replace.js'). -->
2+
3+
# no-directive-replace - disallow the deprecated directive replace property
4+
5+
This rule disallows the replace attribute in a directive definition object.
6+
The replace property of a directive definition object is deprecated since angular 1.3 ([latest angular docs](https://docs.angularjs.org/api/ng/service/$compile).
7+
8+
The option `ignoreReplaceFalse` let you ignore directive definitions with replace set to false.
9+
10+
## Examples
11+
12+
The following patterns are considered problems with default config;
13+
14+
/*eslint angular/no-directive-replace: 2*/
15+
16+
// invalid
17+
angular.module('myModule').directive('helloWorld', function() {
18+
return {
19+
template: '<h2>Hello World!</h2>',
20+
replace: true
21+
};
22+
}); // error: Directive definition property replace is deprecated.
23+
24+
// invalid
25+
angular.module('myModule').directive('helloWorld', function() {
26+
var directiveDefinition = {};
27+
directiveDefinition.templateUrl = 'helloWorld.html';
28+
directiveDefinition.replace = true;
29+
return directiveDefinition;
30+
}); // error: Directive definition property replace is deprecated.
31+
32+
The following patterns are **not** considered problems with default config;
33+
34+
/*eslint angular/no-directive-replace: 2*/
35+
36+
// valid
37+
angular.module('myModule').directive('helloWorld', function() {
38+
return {
39+
template: '<h2>Hello World!</h2>'
40+
};
41+
});
42+
43+
The following patterns are **not** considered problems when configured `{"ignoreReplaceFalse":true}`:
44+
45+
/*eslint angular/no-directive-replace: [2,{"ignoreReplaceFalse":true}]*/
46+
47+
// valid
48+
angular.module('myModule').directive('helloWorld', function() {
49+
return {
50+
template: '<h2>Hello World!</h2>',
51+
replace: false
52+
};
53+
});
54+
55+
The following patterns are considered problems when configured `{"ignoreReplaceFalse":false}`:
56+
57+
/*eslint angular/no-directive-replace: [2,{"ignoreReplaceFalse":false}]*/
58+
59+
// invalid
60+
angular.module('myModule').directive('helloWorld', function() {
61+
return {
62+
template: '<h2>Hello World!</h2>',
63+
replace: true
64+
};
65+
}); // error: Directive definition property replace is deprecated.
66+
67+
## Version
68+
69+
This rule was introduced in eslint-plugin-angular 0.15.0
70+
71+
## Links
72+
73+
* [Rule source](../rules/no-directive-replace.js)
74+
* [Example source](../examples/no-directive-replace.js)

docs/no-run-logic.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!-- WARNING: Generated documentation. Edit docs and examples in the rule and examples file ('rules/no-run-logic.js', 'examples/no-run-logic.js'). -->
2+
3+
# no-run-logic - keep run functions clean and simple
4+
5+
Initialization logic should be moved into a factory or service. This improves testability.
6+
7+
**Styleguide Reference**
8+
9+
* [y171 by johnpapa - Run Blocks](https://github.com/johnpapa/angular-styleguide#style-y171)
10+
11+
## Examples
12+
13+
The following patterns are considered problems with default config;
14+
15+
/*eslint angular/no-run-logic: 2*/
16+
17+
// invalid
18+
angular.module('app').run(function($window) {
19+
$window.addEventListener('deviceready', deviceready);
20+
21+
function deviceready() {}
22+
}); // error: The run function may only contain call expressions
23+
24+
The following patterns are **not** considered problems with default config;
25+
26+
/*eslint angular/no-run-logic: 2*/
27+
28+
// valid
29+
angular.module('app').run(function(KITTENS, kittenService, startup) {
30+
kittenService.prefetchData(KITTENS);
31+
startup('foo', true, 1);
32+
});
33+
34+
The following patterns are considered problems when configured `{"allowParams":false}`:
35+
36+
/*eslint angular/no-run-logic: [2,{"allowParams":false}]*/
37+
38+
// invalid
39+
angular.module('app').run(function(startup) {
40+
startup('foo', true, 1);
41+
}); // error: Run function call expressions may not take any arguments
42+
43+
The following patterns are **not** considered problems when configured `{"allowParams":false}`:
44+
45+
/*eslint angular/no-run-logic: [2,{"allowParams":false}]*/
46+
47+
// valid
48+
angular.module('app').run(function(kittenService, startup) {
49+
kittenService.prefetchData();
50+
startup();
51+
});
52+
53+
## Version
54+
55+
This rule was introduced in eslint-plugin-angular 0.15.0
56+
57+
## Links
58+
59+
* [Rule source](../rules/no-run-logic.js)
60+
* [Example source](../examples/no-run-logic.js)

docs/typecheck-array.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ The following patterns are considered problems;
1313
// invalid
1414
Object.prototype.toString.call(someArray) === '[object Array]'; // error: You should use the angular.isArray method
1515

16+
// invalid
17+
Array.isArray(someArray) // error: You should use the angular.isArray method
18+
1619
The following patterns are **not** considered problems;
1720

1821
/*eslint angular/typecheck-array: 2*/

docs/typecheck-regexp.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# typecheck-regexp - use `angular.isRegexp` instead of other comparisons
44

5-
DEPRECATED! You should use the angular.isRegexp method instead of the default JavaScript implementation (toString.call(/^A/) === "[object RegExp]").
5+
**This rule is deprecated and will be removed in future versions. Explanation: `angular.isRegexp` is no built-in angular method.**
6+
7+
You should use the angular.isRegexp method instead of the default JavaScript implementation (toString.call(/^A/) === "[object RegExp]").
68

79
## Version
810

0 commit comments

Comments
 (0)