Skip to content

Commit fe42515

Browse files
committed
Update packages. Update eslint rules.
1 parent b442b5f commit fe42515

16 files changed

+626
-683
lines changed

.eslintignore

-6
This file was deleted.

.eslintrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ module.exports = {
1818
"eslint-plugin-jest"
1919
],
2020
"rules": {
21-
"unused-imports/no-unused-imports": "error"
21+
"unused-imports/no-unused-imports": "error",
22+
"semi": ["error", "always"],
23+
"quotes": ["error", "double"]
2224
}
2325
}

.husky/pre-commit

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ PATH=$PATH:node_modules/.bin
77
# Check for unused dependencies
88
node tools/check-unused-dependencies.js
99

10-
# Check of linter errors
11-
if ! eslint . --ext js,ts,jsx,tsx; then
10+
# Check for linter errors
11+
if ! eslint "src/*" "test/" --ext js,ts,jsx,tsx; then
1212
exit 1
1313
fi
1414

package-lock.json

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

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"pidtree": "^0.6.0",
4141
"pidusage": "^3.0.0",
4242
"prompt": "^1.2.2",
43-
"puppeteer": "^15.5.0",
43+
"puppeteer": "^16.0.0",
4444
"puppeteer-extra": "^3.3.4",
4545
"puppeteer-extra-plugin-stealth": "^2.10.4",
4646
"react": "^17.0.2",
@@ -60,11 +60,11 @@
6060
"@types/prompt": "^1.1.2",
6161
"@types/react": "^17.0.41",
6262
"@types/uuid": "^8.3.4",
63-
"@typescript-eslint/eslint-plugin": "^5.30.7",
64-
"@typescript-eslint/parser": "^5.30.4",
63+
"@typescript-eslint/eslint-plugin": "^5.32.0",
64+
"@typescript-eslint/parser": "^5.32.0",
6565
"depcheck": "^1.4.3",
66-
"eslint": "^8.19.0",
67-
"eslint-plugin-jest": "^26.1.5",
66+
"eslint": "^8.21.0",
67+
"eslint-plugin-jest": "^26.7.0",
6868
"eslint-plugin-react": "^7.29.4",
6969
"eslint-plugin-unused-imports": "^2.0.0",
7070
"husky": "^8.0.1",

src/configuration_parser.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
'use strict';
1+
"use strict";
22

3-
import fs from 'fs';
3+
import fs from "fs";
44

5-
import {ArgumentParser} from 'argparse';
5+
import {ArgumentParser} from "argparse";
66

7-
import logger from './logger.js';
7+
import logger from "./logger.js";
88
import {Option, StringListOption} from "./options.js";
99

1010
export class ConfigurationParser {
@@ -24,7 +24,7 @@ export class ConfigurationParser {
2424

2525
// Parse arguments
2626
const parser = new ArgumentParser();
27-
parser.add_argument('--config', '-c', {default: 'config.json'});
27+
parser.add_argument("--config", "-c", {default: "config.json"});
2828
for (const option of this.#options) {
2929
if (option.alias) {
3030
parser.add_argument(option.name, option.alias, option.argparseOptions);
@@ -35,8 +35,8 @@ export class ConfigurationParser {
3535
const args = parser.parse_args();
3636

3737
const getJsonKey = (option: Option<any>): string => {
38-
return option.name.replace(/^-+/g, '').replace(/-/g, '_');
39-
}
38+
return option.name.replace(/^-+/g, "").replace(/-/g, "_");
39+
};
4040

4141
const getOptionByName = (name: string): Option<any> | null => {
4242
for (const option of this.#options) {
@@ -45,15 +45,15 @@ export class ConfigurationParser {
4545
}
4646
}
4747
return null;
48-
}
48+
};
4949

5050
// Load config from file if it exists
5151
let config: any = {};
52-
logger.info('Loading config file: ' + args['config']);
53-
const configFileExists = fs.existsSync(args['config']);
52+
logger.info("Loading config file: " + args["config"]);
53+
const configFileExists = fs.existsSync(args["config"]);
5454
if (configFileExists) {
5555
try {
56-
config = JSON.parse(fs.readFileSync(args['config'], {encoding: 'utf-8'}));
56+
config = JSON.parse(fs.readFileSync(args["config"], {encoding: "utf-8"}));
5757

5858
// Check for unknown options
5959
for (const key of Object.keys(config)) {
@@ -71,19 +71,19 @@ export class ConfigurationParser {
7171
continue;
7272
}
7373
for (const item of value) {
74-
if (typeof item !== 'string') {
74+
if (typeof item !== "string") {
7575
throw new Error(`Error parsing option "${key}": Item is not a string: ${item}`);
7676
}
7777
}
7878
}
7979
}
8080
} catch (error) {
81-
logger.error('Failed to read config file!');
81+
logger.error("Failed to read config file!");
8282
logger.error(error);
8383
process.exit(1);
8484
}
8585
} else {
86-
logger.warn('Config file not found! Creating a default one...');
86+
logger.warn("Config file not found! Creating a default one...");
8787
}
8888

8989
// Override options from config with options from arguments and set defaults
@@ -92,14 +92,14 @@ export class ConfigurationParser {
9292
if (args[key] === undefined) {
9393
if (config[key] === undefined) {
9494
const defaultValue = option.defaultValue;
95-
if (typeof defaultValue === 'function') {
95+
if (typeof defaultValue === "function") {
9696
config[key] = defaultValue();
9797
} else {
9898
config[key] = defaultValue;
9999
}
100100
}
101101
} else {
102-
if (typeof args[key] === 'string') {
102+
if (typeof args[key] === "string") {
103103
config[key] = option.parse(args[key]);
104104
} else {
105105
config[key] = args[key];
@@ -110,8 +110,8 @@ export class ConfigurationParser {
110110
// Save config file if it didn't exist
111111
if (this.#saveIfNotExist) {
112112
if (!configFileExists) {
113-
fs.writeFileSync(args['config'], JSON.stringify(config, null, 4));
114-
logger.info('Config saved to ' + args['config']);
113+
fs.writeFileSync(args["config"], JSON.stringify(config, null, 4));
114+
logger.info("Config saved to " + args["config"]);
115115
}
116116
}
117117

0 commit comments

Comments
 (0)