Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit e975874

Browse files
committed
style: настройки для eslint/tslint
1 parent 7c4ef24 commit e975874

20 files changed

+586
-392
lines changed

package-lock.json

+172
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"release-minor": "npm run release -- --release-as minor",
2525
"release-major": "npm run release -- --release-as major",
2626
"lint": "eslint **/*.js --fix",
27+
"tslint": "tslint source/**/*.ts -c tslint.json --fix",
2728
"build-chrome": "webpack --config webpack.chrome.config.js",
2829
"build-userscript": "webpack --config webpack.userscript.config.js",
2930
"build": "npm run build-chrome && npm run build-userscript",
@@ -49,8 +50,12 @@
4950
"@types/jquery": "^2.0.40",
5051
"eslint": "^4.0.0",
5152
"eslint-config-standard": "^10.2.1",
52-
"eslint-plugin-promise": "^3.4.1",
53+
"eslint-plugin-import": "^2.6.0",
54+
"eslint-plugin-node": "^5.0.0",
55+
"eslint-plugin-promise": "^3.5.0",
5356
"eslint-plugin-standard": "^3.0.1",
54-
"standard-version": "^4.0.0"
57+
"standard-version": "^4.0.0",
58+
"tslint": "^5.4.3",
59+
"tslint-config-standard": "^6.0.1"
5560
}
5661
}

source/export/chrome/injector.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
count++;
4141
if (count === files.length) {
4242
filesText.push('window.extPath="' + chrome.extension.getURL('') + '";');
43-
// filesText.push('console.timeEnd("ext");')
43+
// filesText.push('console.timeEnd("ext");')
4444
injectCode(filesText.join(';\n'));
4545
}
4646
};

source/js/auto/Auto.ts

+25-27
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
11
///<reference path="../typings.d.ts"/>
22

3-
import storage from '../storage/storage'
3+
import storage from '../storage/storage';
44
import {sendNotify} from '../notifications/sendNotify';
55
import {ACTION_TYPE_TEXTS} from '../utils/const/texts';
66

77
export default class Auto {
8+
static readonly CHOICES: any = {
9+
/* peacefullnes */
10+
peacePlus: [
11+
'прибегнуть к дипломатии', /* collect_debt */
12+
],
13+
peaceMinus: [
14+
'задействовать грубую силу', /* collect_debt */
15+
],
16+
honorPlus: [
17+
'довести дело до конца', /* spying */
18+
'защищать торговца', /* caravan */
19+
'честно выполнить свои обязательства', /* delivery */
20+
],
21+
honorMinus: [
22+
'поддаться укорам совести и раскрыться', /* spying */
23+
'шантажировать самостоятельно', /* spying */
24+
'присвоить письмо и продать', /* delivery */
25+
'украсть-украсть-украсть', /* delivery */
26+
'подделать письмо', /* delivery */
27+
],
28+
};
29+
private lastquest = '';
830

931
check(hero: any, settingsValues: SettingsValues) {
1032
setTimeout(() => {
@@ -70,9 +92,9 @@ export default class Auto {
7092
$('.pgf-get-card-button a').trigger('click');
7193
return;
7294
}
73-
const hasModal = $('.modal-header') && ($('.pgf-dialog-title').text() === 'Вы получаете новую карту!')
95+
const hasModal = $('.modal-header') && ($('.pgf-dialog-title').text() === 'Вы получаете новую карту!');
7496
if (hasModal) {
75-
$('.pgf-dialog-button-0').trigger('click')
97+
$('.pgf-dialog-button-0').trigger('click');
7698
return;
7799
}
78100
return;
@@ -114,30 +136,6 @@ export default class Auto {
114136
}
115137
}
116138

117-
118-
static readonly CHOICES: any = {
119-
/* peacefullnes */
120-
peacePlus: [
121-
'прибегнуть к дипломатии', /* collect_debt */
122-
],
123-
peaceMinus: [
124-
'задействовать грубую силу', /* collect_debt */
125-
],
126-
honorPlus: [
127-
'довести дело до конца', /* spying */
128-
'защищать торговца', /* caravan */
129-
'честно выполнить свои обязательства', /* delivery */
130-
],
131-
honorMinus: [
132-
'поддаться укорам совести и раскрыться', /* spying */
133-
'шантажировать самостоятельно', /* spying */
134-
'присвоить письмо и продать', /* delivery */
135-
'украсть-украсть-украсть', /* delivery */
136-
'подделать письмо', /* delivery */
137-
],
138-
};
139-
private lastquest = '';
140-
141139
checkQuest(hero: any, settingsValues: SettingsValues) {
142140
const selectChoices: PlainObject<boolean> = {
143141
peacePlus: settingsValues.autoquestPeacePlus,

source/js/notifications/Notifications.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import {sendNotify} from './sendNotify';
44

55

66
export default class Notifications {
7+
static questTests = ['action', 'choice', 'name', 'type', 'uid'];
8+
79
lastNotifyMessagesText: string = '';
810
lastQuests: any[];
9-
static questTests = ['action', 'choice', 'name', 'type', 'uid'];
11+
12+
static isSameQuest(q1: any, q2: any) {
13+
return Notifications.questTests.every(key => q1[key] === q2[key]);
14+
}
1015

1116
check(hero: any, settingsValues: SettingsValues) {
1217
if (!settingsValues.notify) return;
@@ -70,7 +75,7 @@ export default class Notifications {
7075
sendNotify(q.name, {
7176
tag: 'quest',
7277
body: `${storage.heroName} ${q.action}!`,
73-
icon: `${window.extPath}img/quest/caravan.png`, //window.extPath + 'img/quest/' + q.type + '.png',
78+
icon: `${window.extPath}img/quest/caravan.png`, // window.extPath + 'img/quest/' + q.type + '.png',
7479
addTime: true,
7580
});
7681
}
@@ -79,8 +84,4 @@ export default class Notifications {
7984
}
8085
this.lastQuests = quests;
8186
}
82-
83-
static isSameQuest(q1: any, q2: any) {
84-
return Notifications.questTests.every(key => q1[key] === q2[key]);
85-
}
8687
}

source/js/notifications/sendNotify.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type SentNotifyOptions = {
2222
body: string;
2323
icon?: string;
2424
addTime?: boolean;
25-
}
25+
};
2626

2727
export function sendNotify(name: string, options: SentNotifyOptions) {
2828
const d = new Date();

source/js/storage/storage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export default {
22
heroName: '',
33
companionName: '',
4-
}
4+
};

0 commit comments

Comments
 (0)