chore: add eslint

This commit is contained in:
Dawid Wysokiński 2023-02-01 06:49:45 +01:00
parent 0a933f6da8
commit 5ec103e033
Signed by: Kichiyaki
GPG Key ID: B5445E357FB8B892
8 changed files with 903 additions and 11 deletions

6
.eslintignore Normal file
View File

@ -0,0 +1,6 @@
node_modules
dist
.parcel-cache
k8s
.prettierrc.js
.terserrc.js

20
.eslintrc.json Normal file
View File

@ -0,0 +1,20 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"env": {
"browser": true
},
"rules": {
"quotes": [
"error",
"single",
{ "avoidEscape": true, "allowTemplateLiterals": true }
]
}
}

View File

@ -1,6 +1,7 @@
{ {
"extends": "@parcel/config-default", "extends": "@parcel/config-default",
"validators": { "validators": {
"*.{ts,tsx}": ["@parcel/validator-typescript"] "*.{ts,tsx}": ["@parcel/validator-typescript", "@parcel/validator-eslint"],
"*.{js,jsx}": ["@parcel/validator-eslint"]
} }
} }

View File

@ -6,7 +6,8 @@
"build-single": "PUBLIC_URL=https://scripts.tribalwarshelp.com parcel build", "build-single": "PUBLIC_URL=https://scripts.tribalwarshelp.com parcel build",
"build:extended-player-profile-user": "PREAMBLE=extended-player-profile yarn build-single ./src/extended-player-profile.user.ts", "build:extended-player-profile-user": "PREAMBLE=extended-player-profile yarn build-single ./src/extended-player-profile.user.ts",
"build:extended-player-profile-quickbar": "yarn build-single ./src/extended-player-profile.quickbar.ts", "build:extended-player-profile-quickbar": "yarn build-single ./src/extended-player-profile.quickbar.ts",
"build": "npm-run-all build:*" "build": "npm-run-all build:*",
"lint": "eslint src/**/*.ts"
}, },
"targets": { "targets": {
"default": { "default": {
@ -23,11 +24,16 @@
"since 2017-06" "since 2017-06"
], ],
"devDependencies": { "devDependencies": {
"@parcel/validator-eslint": "^2.8.3",
"@parcel/validator-typescript": "^2.8.3", "@parcel/validator-typescript": "^2.8.3",
"@types/jquery": "^3.5.14", "@types/jquery": "^3.5.14",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.191",
"@types/node": "^18.11.17", "@types/node": "^18.11.17",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"buffer": "^5.5.0", "buffer": "^5.5.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.6.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"parcel": "^2.8.3", "parcel": "^2.8.3",
"prettier": "^2.8.3", "prettier": "^2.8.3",

View File

@ -126,7 +126,7 @@ export type InADayPlayer = {
export class InADayClient { export class InADayClient {
client: AxiosInstance; client: AxiosInstance;
constructor(timeout: number = 10000) { constructor(timeout = 10000) {
this.client = axios.create({ this.client = axios.create({
timeout, timeout,
}); });

View File

@ -131,7 +131,7 @@ export type ListPlayerOtherServersParams = {
export class TWHelpClient { export class TWHelpClient {
client: AxiosInstance; client: AxiosInstance;
constructor(url: string, timeout: number = 10000) { constructor(url: string, timeout = 10000) {
this.client = axios.create({ this.client = axios.create({
baseURL: url, baseURL: url,
timeout, timeout,

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es2017", "target": "es2020",
"strict": true, "strict": true,
"moduleResolution": "Node", "moduleResolution": "Node",
"strictNullChecks": true, "strictNullChecks": true,

871
yarn.lock

File diff suppressed because it is too large Load Diff