Skip to content

Commit ff11ffd

Browse files
committed
eslint fixes
1 parent 2ada3d1 commit ff11ffd

14 files changed

+34
-85
lines changed

.eslintrc.js

+19
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,29 @@ module.exports = {
44
"commonjs": true,
55
"es2021": true
66
},
7+
"globals": {
8+
"__dirname": "readonly",
9+
"process": "readonly",
10+
"_": "readonly"
11+
},
712
"extends": "eslint:recommended",
13+
"overrides": [
14+
{
15+
"env": {
16+
"node": true
17+
},
18+
"files": [
19+
".eslintrc.{js,cjs}"
20+
],
21+
"parserOptions": {
22+
"sourceType": "script"
23+
}
24+
}
25+
],
826
"parserOptions": {
927
"ecmaVersion": "latest"
1028
},
29+
"ignorePatterns": ["node_modules/", "out/", "img/", "tests/", "**/*.json", "**/*.html", "**/*.css"],
1130
"rules": {
1231
}
1332
}

app/bot/chatZone.js

-30
This file was deleted.

app/bot/createBot.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const Zone = require("../utils/zone.js");
22
const createFishingZone = require("./fishingZone.js");
33
const createNotificationZone = require("./notificationZone.js");
44
const createLootZone = require("./lootZone.js");
5-
const createChatZone = require('./chatZone');
6-
const Jimp = require(`jimp`);
75
const {app} = require(`electron`);
86

97
const { screen, Region, Point } = require("@nut-tree/nut-js");
@@ -33,8 +31,6 @@ const random = (from, to) => {
3331
return from + Math.random() * (to - from);
3432
};
3533

36-
let chatMsgs = [];
37-
3834
const createBot = (game, { config, settings }, winSwitch, state) => {
3935
const { keyboard, mouse, workwindow } = game;
4036
const delay = [config.delay.from, config.delay.to];
@@ -518,7 +514,7 @@ const createBot = (game, { config, settings }, winSwitch, state) => {
518514

519515
const dynamicThreshold = () => {
520516
settings.threshold = settings.threshold - config.dynamicThresholdValue;
521-
let fishingZone = createFishingZone({
517+
fishingZone = createFishingZone({
522518
getDataFrom,
523519
zone: Zone.from(screenSize).toRel(config.relZone),
524520
screenSize: screenSize,

app/bot/createBots.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const EventLine = require("../utils/eventLine.js");
99
const { setWorker } = require("../utils/textReader.js");
1010

1111
const createWinSwitch = require("../game/winSwitch.js");
12-
const { app } = require("electron");
1312

1413
const createBots = async (games, settings, config, log) => {
1514
const winSwitch = createWinSwitch(new EventLine());
@@ -19,9 +18,7 @@ const createBots = async (games, settings, config, log) => {
1918
await setWorker(settings.whitelistLanguage);
2019
}
2120

22-
if(true) {
23-
games = [games[0]];
24-
}
21+
games = [games[0]];
2522

2623
const bots = games.map((game, i) => {
2724
let state = { status: "initial", startTime: Date.now() };

app/bot/fishingZone.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const getPosWithin = ({points, pos, size, dir}) => {
1616
}
1717

1818
const isOverThreshold = ([r, g, b], threshold) => (r - Math.max(g, b)) > threshold;
19-
const isCloseEnough = ([r, g, b], closeness) => Math.abs(g - b) <= closeness;
19+
const isCloseEnough = ([_, g, b], closeness) => Math.abs(g - b) <= closeness;
2020

2121
const isRed = (threshold, closeness, size = 255, upperLimit = 295) => ([r, g, b]) => isOverThreshold([r, g, b], threshold) &&
2222
isCloseEnough([r, g, b], closeness) &&
@@ -185,7 +185,7 @@ const createFishingZone = ({ getDataFrom , zone, screenSize, threshold, bobberCo
185185

186186
async getBobberPointsAround(rgb, bobber) {
187187
let memory = [bobber];
188-
for(let point of memory) {;
188+
for(let point of memory) {
189189
if(memory.length > 10000) throw new Error(`color`);
190190
for(let pointAround of point.getPointsAround()) {
191191
if(isBobber(rgb.colorAt(pointAround)) && !memory.some(mPoint => mPoint.isEqual(pointAround))) {

app/bot/notificationZone.js

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const createNotificationZone = ({ getDataFrom, zone }) => {
66
isError: ([r, g, b]) => r - g > 220 && r - b > 220
77
}
88

9-
const stopAtFirst = true;
109
return {
1110
async check(...type) {
1211
const colors = type.map((type) => {

app/config/settings.json

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,23 +1 @@
1-
{
2-
"game": "Dragonflight",
3-
"timer": 0,
4-
"lures": false,
5-
"fishingKey": "1",
6-
"luresKey": "2",
7-
"stopKey": "space",
8-
"intKey": "f",
9-
"useInt": false,
10-
"luresDelayMin": 10,
11-
"whitelist": false,
12-
"whitelistWords": "",
13-
"whiteListBlueGreen": true,
14-
"filterType": "whitelist",
15-
"atMouse": true,
16-
"confirmSoulbound": true,
17-
"whitelistLanguage": "eng",
18-
"threshold": 60,
19-
"bobberColor": "red",
20-
"autoTh": true,
21-
"initial": true,
22-
"initialZone": true
23-
}
1+
{"game":"Dragonflight","timer":0,"lures":false,"fishingKey":"1","luresKey":"2","stopKey":"space","intKey":"f","useInt":false,"luresDelayMin":10,"whitelist":false,"whitelistWords":"","whiteListBlueGreen":true,"filterType":"whitelist","atMouse":true,"confirmSoulbound":true,"whitelistLanguage":"eng","threshold":60,"bobberColor":"red","autoTh":true,"initial":false,"initialZone":true}

app/main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if (handleSquirrelEvent(app)) {
4040

4141

4242
const showChoiceWarning = (win, warning, title, button1, button2) => {
43-
return result = dialog.showMessageBoxSync(win, {
43+
return dialog.showMessageBoxSync(win, {
4444
type: "warning",
4545
title: `${title}`,
4646
message: warning,
@@ -52,7 +52,7 @@ const showChoiceWarning = (win, warning, title, button1, button2) => {
5252

5353

5454
const showWarning = (win, warning) => {
55-
return result = dialog.showMessageBoxSync(win, {
55+
return dialog.showMessageBoxSync(win, {
5656
type: "warning",
5757
title: `Warning`,
5858
message: warning,
@@ -284,7 +284,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SO
284284
let powerBlocker = powerSaveBlocker.start("prevent-display-sleep");
285285
app.whenReady().then(() => {
286286
const menu = Menu.buildFromTemplate([{label: `Help`, submenu: [
287-
{ label: 'AutoFish 2.0.0 beta Public' },
287+
{ label: `AutoFish ${getJson('../package.json').version} Public` },
288288
{ type: 'separator' },
289289
{ label: 'Read Me', click: () => shell.openExternal("https://github.com/jsbots/AutoFish#guide-blue_book")},
290290
{ label: 'Video', click: () => shell.openExternal("https://youtu.be/A3W8UuVIZTo")},

app/ui/autoFish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class AutoFish {
3939
const footer = elt(`p`, { className: "version" }, versionNode, donateLink, premiumIcon);
4040

4141
ipcRenderer.on("set-version", (event, version) => {
42-
versionNode.textContent = `ver. 2.0.0 beta Public | `;
42+
versionNode.textContent = `ver. ${version} Public | `;
4343
});
4444
this.settings.regOnChange((config) => {
4545
ipcRenderer.send("save-settings", config);

app/ui/renderSettings.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const renderStopKey = ({stopKey}) => {
9393
return key;
9494
};
9595

96-
const renderPoleKey = ({lures, game, intKey, useInt}) => {
96+
const renderPoleKey = ({ game, intKey, useInt}) => {
9797
let key = elt('input', {type: 'text', value: intKey, disabled: !useInt || game != `Dragonflight`, name: "intKey"});
9898
key.setAttribute(`readonly`, `true`);
9999
const checkbox = elt(`input`, {type: `checkbox`, disabled: game != `Dragonflight`, checked: game != `Dragonflight` ? false : useInt, style: `margin-right: 7px`, name: "useInt"});
@@ -134,7 +134,7 @@ const renderFilterType = ({game, whitelist, filterType, atMouse}) => {
134134
return elt(`div`, null, `Mode: `, modeContainer, `Loot window at mouse:`, atMouseContainer);
135135
}
136136

137-
const renderWhitelist = ({game, whitelist, whitelistWords, whitelistLanguage}) => {
137+
const renderWhitelist = ({whitelist, whitelistWords, whitelistLanguage}) => {
138138
let languages = [`eng`, `spa`, `spa_old`, `por`, `fra`, `deu`, `ita`, `chi_sim`, `chi_tra`, `kor`, `rus`];
139139

140140
const langContainer = elt('select', {name: `whitelistLanguage`, className: `whitelistLanguage` , disabled: !whitelist}, ...languages.map( language => elt(`option`, {selected: whitelistLanguage == language}, language)));
@@ -148,11 +148,6 @@ const renderWhitelist = ({game, whitelist, whitelistWords, whitelistLanguage}) =
148148
elt('input', {type: 'checkbox', name: "whitelist", checked}))
149149
};
150150

151-
const renderWhiteListGreenBlue = ({whitelist, whiteListBlueGreen}) => {
152-
return elt('input', {type: `checkbox`, checked: whitelist && whiteListBlueGreen, name: `whiteListBlueGreen`, disabled: !whitelist });
153-
};
154-
155-
156151
const renderMultipleWindows = () => {
157152
return elt(`div`, {className: `premium_lock premium_lock_main`, id: `link`, url: `https://youtu.be/ih-xoQcByz8`})
158153
};
@@ -247,7 +242,6 @@ wrapInLabel(
247242
renderFilterType(config),
248243
`Filter Mode will decide whether to pick or to ignore items in the list. Loot window at mouse will tell the bot whether it should check the loot window at mouse or the default loot window at the left side of the screen.`
249244
),
250-
/*wrapInLabel(elt('span', null, "Loot all ", elt('span', {style: `color:#4DDF3F; font-weight: bold`}, `Uncommon `), `and `, elt(`span`, {style: `color: #015CB4; font-weight: bold`}, `Rare `), `and `, elt('span', {style: `color:#950c95; font-weight: bold`}, `Epic `), `items:`), renderWhiteListGreenBlue(config), `If you use whitelist, you can check this option to loot every green, blue and purple items in addition to the items in the whitelist.`)*/
251245
),
252246
elt("p", {className: 'settings_header'}, "Threshold"),
253247
elt(

app/ui/settings.js

-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ class Settings {
8787
this.reRender();
8888
}
8989

90-
if(event.target.id == `link`) {
91-
ipcRenderer.send(`open-link`, event.target.url);
92-
}
93-
9490
if(event.target.name == `multipleWindows` && event.target.checked == true) {
9591
this.onDx11();
9692
}

app/utils/textReader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const sortWordsByItem = (words, lootWindow, isDragonflight) => {
5757
selected[Math.floor(word.y / itemHeight)] += ` ${word.text}`;
5858
}
5959
});
60-
return selected.flat();;
60+
return selected.flat();
6161
};
6262

6363
module.exports = {

app/wins/advsettings/renderer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const renderSleepAfterHook = ({sleepAfterHook}) => {
193193
return elt(`input`, {type: `checkbox`, name: `sleepAfterHook`, checked: sleepAfterHook});
194194
};
195195

196-
const renderBobberSensitivity = ({bobberSensitivity, soundDetection, bobberSensitivityPrint, autoSensDens}) => {
196+
const renderBobberSensitivity = ({bobberSensitivity, bobberSensitivityPrint, autoSensDens}) => {
197197
let min = 1;
198198
let max = 3;
199199
if(bobberSensitivityPrint) {
@@ -278,7 +278,7 @@ const renderMammothTraderName = () => {
278278
return elt('input', {type: `text`, disabled: true, value: `Trader`});
279279
};
280280

281-
const renderSoundDetection = ({soundDetection}) => {
281+
const renderSoundDetection = () => {
282282
return elt(`input`, {type: `checkbox`, disabled: true, checked: false});
283283
};
284284

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@electron-forge/maker-zip": "^6.0.4",
4343
"electron": "^20.0.0",
4444
"electron-rebuild": "^3.2.9",
45-
"eslint": "^8.15.0",
45+
"eslint": "^8.43.0",
4646
"jest": "^28.1.0"
4747
},
4848
"config": {

0 commit comments

Comments
 (0)