Skip to content

Commit 6c736eb

Browse files
committed
travis and eslint upgrade
1 parent cc418ee commit 6c736eb

File tree

7 files changed

+129
-36
lines changed

7 files changed

+129
-36
lines changed

.eslintrc

Lines changed: 80 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"max-nested-callbacks": 0,
2121
"one-var": 0,
2222
"padded-blocks": 0,
23-
"quote-props": 0,
2423
"sort-vars": 0,
2524
"space-before-blocks": 0,
2625
"space-in-brackets": 0,
@@ -32,23 +31,59 @@
3231
"no-undefined": 0,
3332
"func-names": 0,
3433
"consistent-this": 0,
35-
36-
"valid-jsdoc": [1, {
37-
"requireReturn": false,
38-
"prefer": {
39-
"return": "returns"
34+
"valid-jsdoc": [
35+
1,
36+
{
37+
"requireReturn": false,
38+
"prefer": {
39+
"return": "returns"
40+
}
4041
}
41-
}],
42-
43-
"no-comma-dangle": 2,
42+
],
43+
"quote-props": [
44+
2,
45+
"as-needed"
46+
],
47+
"constructor-super": 2,
48+
"no-this-before-super": 2,
49+
"no-unexpected-multiline": 2,
50+
"array-bracket-spacing": [
51+
2,
52+
"never"
53+
],
54+
"arrow-parens": 2,
55+
"arrow-spacing": [
56+
2,
57+
{
58+
"before": true,
59+
"after": true
60+
}
61+
],
62+
"callback-return": 2,
63+
"id-length": [
64+
2,
65+
{
66+
"min": 2
67+
}
68+
],
69+
"no-class-assign": 2,
70+
"no-const-assign": 2,
71+
"no-implicit-coercion": 2,
72+
"no-invalid-this": 2,
73+
"no-useless-call": 2,
74+
"require-yield": 2,
75+
"comma-dangle": [
76+
2,
77+
"never"
78+
],
4479
"no-cond-assign": 2,
4580
"no-console": 2,
4681
"no-constant-condition": 2,
4782
"no-control-regex": 2,
4883
"no-debugger": 2,
4984
"no-dupe-keys": 2,
5085
"no-empty": 2,
51-
"no-empty-class": 2,
86+
"no-empty-character-class": 2,
5287
"no-ex-assign": 2,
5388
"no-extra-boolean-cast": 2,
5489
"no-extra-semi": 2,
@@ -59,7 +94,6 @@
5994
"no-negated-in-lhs": 2,
6095
"no-obj-calls": 2,
6196
"no-regex-spaces": 2,
62-
"no-reserved-keys": 2,
6397
"no-sparse-arrays": 2,
6498
"no-unreachable": 2,
6599
"use-isnan": 2,
@@ -104,9 +138,10 @@
104138
"radix": 2,
105139
"wrap-iife": 2,
106140
"yoda": 2,
107-
"global-strict": 2,
108-
"no-extra-strict": 2,
109-
"strict": 2,
141+
"strict": [
142+
2,
143+
"function"
144+
],
110145
"no-catch-shadow": 2,
111146
"no-delete-var": 2,
112147
"no-label-var": 2,
@@ -125,11 +160,17 @@
125160
"no-sync": 2,
126161
"brace-style": 2,
127162
"camelcase": 2,
128-
"comma-spacing": [2, {
129-
"before": false,
130-
"after": true
131-
}],
132-
"comma-style": [2, "last"],
163+
"comma-spacing": [
164+
2,
165+
{
166+
"before": false,
167+
"after": true
168+
}
169+
],
170+
"comma-style": [
171+
2,
172+
"last"
173+
],
133174
"eol-last": 2,
134175
"key-spacing": 2,
135176
"new-cap": 2,
@@ -139,13 +180,18 @@
139180
"no-mixed-spaces-and-tabs": 2,
140181
"no-nested-ternary": 2,
141182
"no-new-object": 2,
142-
"no-space-before-semi": 2,
183+
"semi-spacing": [
184+
2,
185+
{
186+
"before": false,
187+
"after": true
188+
}
189+
],
143190
"no-spaced-func": 2,
144191
"no-ternary": 2,
145192
"no-trailing-spaces": 2,
146193
"no-multiple-empty-lines": 2,
147194
"no-underscore-dangle": 2,
148-
"no-wrap-func": 2,
149195
"quotes": [
150196
2,
151197
"single",
@@ -155,9 +201,20 @@
155201
"space-after-keywords": 2,
156202
"space-infix-ops": 2,
157203
"space-return-throw-case": 2,
158-
"spaced-line-comment": [2, "never"],
204+
"spaced-comment": [
205+
2,
206+
"never",
207+
{
208+
"exceptions": [
209+
"/*"
210+
]
211+
}
212+
],
159213
"wrap-regex": 2,
160-
"max-params": [2, 6],
214+
"max-params": [
215+
2,
216+
6
217+
],
161218
"no-bitwise": 2
162219
}
163220
}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_js:
44
before_script:
55
- npm install -g [email protected]
66
- bower install
7+
sudo: false

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module.exports = function (grunt) {
123123
api: {
124124
options: {
125125
index: true,
126-
'private': false
126+
private: false
127127
},
128128
src: 'angular-web-notification.js',
129129
dest: 'docs/api.md'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ See full docs at: [API Docs](docs/api.md)
7979

8080
| Date | Version | Description |
8181
| ----------- | ------- | ----------- |
82-
| 2015-06-24 | v0.0.20 | Maintenance |
82+
| 2015-08-02 | v0.0.21 | Maintenance |
8383
| 2015-02-16 | v0.0.7 | Automatic unit tests via karma |
8484
| 2015-02-05 | v0.0.5 | Doc changes |
8585
| 2014-12-30 | v0.0.4 | Doc changes |

angular-web-notification.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
/*global notify: false, angular: false */
22

3+
/**
4+
* 'showNotification' callback.
5+
*
6+
* @callback ShowNotificationCallback
7+
* @param {error} [error] - The error object in case of any error
8+
* @param {function} [hide] - The hide notification function
9+
*/
10+
311
(function (notifyLib) {
412
'use strict';
513

@@ -132,7 +140,8 @@
132140
* @public
133141
* @param {string} [title] - The notification title text (defaulted to empty string if null is provided)
134142
* @param {object} [options] - Holds the notification data (web notification API spec for more info)
135-
* @param {function} callback - Called after the show is handled.
143+
* @param {ShowNotificationCallback} callback - Called after the show is handled.
144+
* @returns {*} The callback function return value or undefined
136145
* @example
137146
* ```js
138147
* webNotification.showNotification('Example Notification', {
@@ -164,18 +173,20 @@
164173
var hideNotification = null;
165174
if (isEnabled()) {
166175
hideNotification = createAndDisplayNotification(title, options);
167-
callback(null, hideNotification);
168-
} else if (service.allowRequest) {
176+
return callback(null, hideNotification);
177+
}
178+
179+
if (service.allowRequest) {
169180
notifyLib.requestPermission(function onRequestDone() {
170181
if (isEnabled()) {
171182
hideNotification = createAndDisplayNotification(title, options);
172-
callback(null, hideNotification);
173-
} else {
174-
callback(new Error('Notifications are not enabled.'), null);
183+
return callback(null, hideNotification);
175184
}
185+
186+
return callback(new Error('Notifications are not enabled.'), null);
176187
});
177188
} else {
178-
callback(new Error('Notifications are not enabled.'), null);
189+
return callback(new Error('Notifications are not enabled.'), null);
179190
}
180191
}
181192
}

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-web-notification",
3-
"version": "0.0.20",
3+
"version": "0.0.21",
44
"authors": [
55
"Sagie Gur-Ari <[email protected]>"
66
],

docs/api.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## Objects
2+
<dl>
3+
<dt><a href="#webNotification">webNotification</a> ⇒ <code>object</code></dt>
4+
<dd><p>The web notification service wraps the HTML 5 Web Notifications API as an angular service.</p>
5+
</dd>
6+
</dl>
7+
## Typedefs
8+
<dl>
9+
<dt><a href="#ShowNotificationCallback">ShowNotificationCallback</a> : <code>function</code></dt>
10+
<dd><p>&#39;showNotification&#39; callback.</p>
11+
</dd>
12+
</dl>
113
<a name="webNotification"></a>
214
## webNotification ⇒ <code>object</code>
315
The web notification service wraps the HTML 5 Web Notifications API as an angular service.
@@ -9,26 +21,27 @@ The web notification service wraps the HTML 5 Web Notifications API as an angula
921

1022
* [webNotification](#webNotification) ⇒ <code>object</code>
1123
* [.allowRequest](#webNotification.allowRequest)
12-
* [.showNotification([title], [options], callback)](#webNotification.showNotification)
24+
* [.showNotification([title], [options], callback)](#webNotification.showNotification) ⇒ <code>\*</code>
1325

1426
<a name="webNotification.allowRequest"></a>
1527
### webNotification.allowRequest
1628
True to enable automatic requesting of permissions if needed.
1729

1830
**Access:** public
1931
<a name="webNotification.showNotification"></a>
20-
### webNotification.showNotification([title], [options], callback)
32+
### webNotification.showNotification([title], [options], callback) ⇒ <code>\*</code>
2133
Shows the notification based on the provided input.<br>
2234
The callback invoked will get an error object (in case of an error, null in
2335
case of no errors) and a 'hide' function which can be used to hide the notification.
2436

37+
**Returns**: <code>\*</code> - The callback function return value or undefined
2538
**Access:** public
2639

2740
| Param | Type | Description |
2841
| --- | --- | --- |
2942
| [title] | <code>string</code> | The notification title text (defaulted to empty string if null is provided) |
3043
| [options] | <code>object</code> | Holds the notification data (web notification API spec for more info) |
31-
| callback | <code>function</code> | Called after the show is handled. |
44+
| callback | <code>[ShowNotificationCallback](#ShowNotificationCallback)</code> | Called after the show is handled. |
3245

3346
**Example**
3447
```js
@@ -45,3 +58,14 @@ webNotification.showNotification('Example Notification', {
4558
}
4659
});
4760
```
61+
<a name="ShowNotificationCallback"></a>
62+
## ShowNotificationCallback : <code>function</code>
63+
'showNotification' callback.
64+
65+
**Kind**: global typedef
66+
67+
| Param | Type | Description |
68+
| --- | --- | --- |
69+
| [error] | <code>error</code> | The error object in case of any error |
70+
| [hide] | <code>function</code> | The hide notification function |
71+

0 commit comments

Comments
 (0)