Skip to content

Commit b4dcd5d

Browse files
committed
style: linting
1 parent ce09799 commit b4dcd5d

21 files changed

+1259
-562
lines changed

.eslintrc

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
{
2-
"extends": "semistandard",
2+
"plugins": ["prettier"],
3+
"extends": [
4+
"semistandard"
5+
],
36
"env": {
47
"node": true,
58
"jest": true
69
},
710
"rules": {
811
"space-before-function-paren": 0,
912
"no-control-regex": 0,
13+
"no-console": 1,
14+
"no-var": 2,
15+
"prefer-const": 1,
1016
"no-prototype-builtins": 0,
17+
"no-useless-escape": 1,
1118
"comma-dangle": 0,
12-
"indent": "off"
19+
"keyword-spacing": ["error", { "before": true, "after": true }],
20+
"comma-spacing": ["error", { "before": false, "after": true }],
21+
"indent": 0,
22+
"prefer-spread": 1,
23+
"no-mixed-operators": 1,
24+
"prettier/prettier": 1,
25+
"camelcase": ["error", {
26+
"allow": ["^UNSAFE_"],
27+
"properties": "never",
28+
"ignoreGlobals": true
29+
}],
30+
"quotes": [
31+
"error", "single", {
32+
"avoidEscape": true,
33+
"allowTemplateLiterals": true
34+
}
35+
],
1336
}
1437
}

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ toasted.notify(
286286
287287
<br />
288288

289-
There is a default timeout set of `10` to ensure that the application closes properly. To remove the timeout and have a notification instantly close _(does not support actions)_, set `timeout: false`. If you are using an `action:`; it is recommended to set timeout to a high value to ensure the user has time to respond to the notification.
289+
Default timeout is `10` to ensure that the application closes properly. To remove the timeout and have notifications instantly close _(does not support actions)_, set `timeout: false`. If you are using an `action:` declaration; it is recommended to set the timeout to a high value to ensure the user has time to respond to the notification.
290290

291291
> [!NOTE]
292292
> **Exception**: If `reply: true` is defined, set timeout to a high value, or to nothing at all.
@@ -376,7 +376,7 @@ If you do not see notifications from Toasted-Notifier, click windows **Start** a
376376

377377
Locate `NtfyToast`, or your `customPath` / `appID` program in the list.
378378

379-
<sup>`Note`: <a href="https://github.com/Aetherinox/ntfy-toast">NtfyToast</a> is the library used in Toasted-Notifier for Windows notifications</sup>
379+
<sup>`Note`: <a href="https://github.com/Aetherinox/ntfy-toast">NtfyToast</a> is the library used by Toasted-Notifier for Windows notifications</sup>
380380

381381
<div align="center">
382382

@@ -709,7 +709,6 @@ For instructions on accomplishing this, read the section [appID support](#appid-
709709
### Can't use Windows Toast notifications in WSL2
710710
Ntfy makes use of a 3rd party package for Windows notifications to work. You must change the permissions on the Ntfy vendor .exe in order for it to work properly.
711711

712-
713712
```shell
714713
chmod +x node_modules/toasted-notifier/vendor/ntfyToast/ntfytoast.exe
715714
```
@@ -812,8 +811,6 @@ When using toasted-notifier within a tmux session, it can cause the system to ab
812811
set -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL -l"
813812
```
814813
815-
816-
817814
<br />
818815
819816
---

example/advanced.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
const notifier = require('../');
2-
const nc = new notifier.NotificationCenter();
1+
/* eslint-disable no-console */
2+
3+
const toasted = require('../');
4+
const nc = new toasted.NotificationCenter();
35
const path = require('path');
46

57
nc.notify(
68
{
7-
title: 'Phil Coulson',
8-
subtitle: 'Agent of S.H.I.E.L.D.',
9-
message: "If I come out, will you shoot me? 'Cause then I won't come out.",
9+
title: 'Test Notification',
10+
subtitle: 'This is a subtitle',
11+
message: 'This is an advanced test message',
1012
sound: 'Funk',
11-
// case sensitive
1213
wait: true,
1314
icon: path.join(__dirname, 'example_1.png'),
1415
contentImage: path.join(__dirname, 'example_1.png'),

example/forceBallon.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
/* eslint-disable no-console */
12
const toasted = require('../index');
3+
24
const balloon = toasted.WindowsBalloon();
35
balloon
46
.notify({ message: 'Hello' }, function (err, data) {
57
console.log(err, data);
68
})
9+
710
.on('click', function () {
811
console.log(arguments);
912
});

example/macInput.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
1+
/* eslint-disable no-console */
2+
13
const notifier = require('../');
24
const nc = new notifier.NotificationCenter();
35

4-
const trueAnswer = 'Most def.';
6+
const trueAnswer = 'Yessir.';
7+
8+
/*
9+
@note : closeLabel is case sensitive
10+
*/
511

612
nc.notify(
713
{
814
title: 'Notifications',
9-
message: 'Are they cool?',
15+
message: 'Do you like them?',
1016
sound: 'Funk',
11-
// case sensitive
12-
closeLabel: 'Absolutely not',
17+
closeLabel: 'Nope',
1318
actions: trueAnswer
1419
},
1520
function (err, response, metadata) {
1621
if (err) throw err;
1722
console.log(metadata);
1823

1924
if (metadata.activationValue !== trueAnswer) {
20-
return; // No need to continue
25+
return; // Do not continue
2126
}
2227

2328
nc.notify(
2429
{
2530
title: 'Notifications',
26-
message: 'Do you want to reply to them?',
31+
message: 'Do you wish to reply to them?',
2732
sound: 'Funk',
28-
// case sensitive
2933
reply: true
3034
},
3135
function (err, response, metadata) {
@@ -37,5 +41,5 @@ nc.notify(
3741
);
3842

3943
nc.on('replied', function (obj, options, metadata) {
40-
console.log('User replied', metadata);
44+
console.log('User has replied', metadata);
4145
});

example/message.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
/* eslint-disable no-console */
2+
13
const toasted = require('../index');
24

35
toasted
46
.notify({ message: 'Hello', wait: true }, function (err, data) {
5-
// Will also wait until notification is closed.
7+
// wait until notification is closed.
68
console.log('Waited');
79
console.log(err, data);
810
})

example/toaster-custom-path.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-console */
2+
13
const path = require('path');
24

35
/*
@@ -17,7 +19,7 @@ const { WindowsToaster } = require('../');
1719
const customPath = path.join('vendor', 'ntfyToast', 'ntfytoast.exe');
1820
const toasted = new WindowsToaster({
1921
withFallback: false,
20-
customPath: customPath
22+
customPath
2123
});
2224

2325
/*

example/toaster-persistent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
const path = require('path');
23
const toasted = require('../index');
34

example/toaster-with-actions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
const path = require('path');
23
const toasted = require('../index');
34

example/toaster.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-console */
2+
13
const path = require('path');
24
const toasted = require('../index');
35

0 commit comments

Comments
 (0)