diff --git a/anon/eslint.config.mjs b/anon/eslint.config.mjs new file mode 100644 index 0000000..bbe8825 --- /dev/null +++ b/anon/eslint.config.mjs @@ -0,0 +1,3 @@ +import pkmn from "@pkmn/eslint-config"; + +export default pkmn; diff --git a/anon/package.json b/anon/package.json index fe82856..6859e93 100644 --- a/anon/package.json +++ b/anon/package.json @@ -16,15 +16,15 @@ "access": "public" }, "dependencies": { - "@pkmn/data": "^0.9.19", - "@pkmn/protocol": "^0.6.26" + "@pkmn/data": "^0.9.21", + "@pkmn/protocol": "^0.6.28" }, "devDependencies": { - "@pkmn/dex": "^0.9.19" + "@pkmn/dex": "^0.9.21" }, "scripts": { - "lint": "eslint --cache src --ext ts", - "fix": "eslint --fix src --ext ts", + "lint": "eslint --cache src", + "fix": "eslint --fix src", "compile": "tsc -p .", "build": "npm run compile && tsup src/index.ts", "test": "jest", @@ -51,8 +51,5 @@ "@babel/preset-typescript", ["@babel/preset-env", {"targets": {"node": "current"}}] ] - }, - "eslintConfig": { - "extends": "@pkmn" } } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..b5523a7 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,12 @@ +import pkmn from "@pkmn/eslint-config"; + +export default [...pkmn, { + files: ["workflows/**/*.ts"], + rules: { + "@typescript-eslint/no-floating-promises": ["error", {ignoreVoid: true}], + "@typescript-eslint/require-await": "off" + } +}, { + files: ["workflows/pkmn/*.ts"], + languageOptions: { parserOptions: {project: ["./tsconfig.pkmn.json"]} }, +}]; diff --git a/logs/eslint.config.mjs b/logs/eslint.config.mjs new file mode 100644 index 0000000..921d588 --- /dev/null +++ b/logs/eslint.config.mjs @@ -0,0 +1,6 @@ +import pkmn from "@pkmn/eslint-config"; + +export default [...pkmn, { + files: ["src/storage.ts"], + rules: {"@typescript-eslint/require-await": "off"}, +}]; diff --git a/logs/package.json b/logs/package.json index 1062bb8..2cff75a 100644 --- a/logs/package.json +++ b/logs/package.json @@ -17,8 +17,8 @@ "bthreads": "^0.5.1" }, "scripts": { - "lint": "eslint --cache src --ext ts", - "fix": "eslint --fix src --ext ts", + "lint": "eslint --cache src", + "fix": "eslint --fix src", "compile": "tsc -p .", "build": "npm run compile && tsup src/index.ts", "test": "jest", @@ -41,14 +41,5 @@ "@babel/preset-typescript", ["@babel/preset-env", {"targets": {"node": "current"}}] ] - }, - "eslintConfig": { - "extends": "@pkmn", - "overrides": [{ - "files": ["src/storage.ts"], - "rules": { - "@typescript-eslint/require-await": "off" - } - }] } } diff --git a/logs/src/fs.ts b/logs/src/fs.ts index 8be858f..3483731 100644 --- a/logs/src/fs.ts +++ b/logs/src/fs.ts @@ -73,8 +73,6 @@ function isGzipped(buf: Buffer) { export function unpack(input: string, output: string) { return new Promise((resolve, reject) => { - zip.unpack(input, output, err => { - err ? reject(err) : resolve(); - }); + zip.unpack(input, output, err => err ? reject(err) : resolve()); }); } diff --git a/logs/src/random.test.ts b/logs/src/random.test.ts index 911bed3..352d873 100644 --- a/logs/src/random.test.ts +++ b/logs/src/random.test.ts @@ -44,7 +44,7 @@ describe('Random', () => { r = new Random(); a = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K']; - delete a[9]; + delete a[9]; // eslint-disable-line @typescript-eslint/no-array-delete expect(() => { for (let i = 0; i < 100; i++) { r.sample(a); diff --git a/package.json b/package.json index 8fec50c..c052a4a 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "license": "MIT", "dependencies": { "@pkmn/anon": "file:anon", - "@pkmn/data": "^0.9.19", - "@pkmn/dex": "^0.9.19", + "@pkmn/data": "^0.9.21", + "@pkmn/dex": "^0.9.21", "@pkmn/logs": "file:logs", "@pkmn/stats": "file:stats", "json-stringify-pretty-compact": "3.0.0", @@ -17,46 +17,30 @@ "@pkmn/sets": "^5.1.2" }, "devDependencies": { - "@babel/preset-env": "^7.25.4", - "@babel/preset-typescript": "^7.24.7", - "@pkmn/eslint-config": "^8.4.0", + "@babel/preset-env": "^7.25.8", + "@babel/preset-typescript": "^7.25.7", + "@pkmn/eslint-config": "^9.0.0", "@types/jest": "^29.5.13", - "@types/node": "^22.7.4", - "@typescript-eslint/eslint-plugin": "<=7", - "@typescript-eslint/parser": "<=7", - "eslint": "<=8", - "eslint-plugin-import": "<=2.30.0", + "@types/node": "^22.7.6", + "eslint": "^9.12.0", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-jest": "^28.8.3", "jest": "^29.7.0", "subpkg": "^4.1.0", "tsup": "^8.3.0", - "typescript": "^5.6.2" + "typescript-eslint": "^8.10.0", + "typescript": "^5.6.3" }, "subPackages": ["anon", "logs", "stats"], "scripts": { - "lint": "subpkg run lint && eslint --cache workflows tools/{stats,teams} --ext ts", - "fix": "subpkg run fix && eslint --fix workflows tools/{stats,teams} --ext ts", + "lint": "subpkg run lint && eslint --cache workflows", + "fix": "subpkg run fix && eslint --fix workflows", "compile:smogon": "tsc -p .", "compile:pkmn": "tsc -p tsconfig.pkmn.json", "compile": "subpkg run compile && npm run compile:smogon", "build": "npm run compile && npm run compile:pkmn", "test": "subpkg run test", - "posttest": "npm run compile:smogon && npm run compile:pkmn && eslint --cache workflows tools/{stats,teams} --ext ts", + "posttest": "npm run compile:smogon && npm run compile:pkmn && eslint --cache workflows", "postinstall": "subpkg install" - }, - "eslintConfig": { - "extends": "@pkmn", - "overrides": [{ - "files": ["workflows/**/*.ts"], - "rules": { - "@typescript-eslint/no-floating-promises": ["error", {"ignoreVoid": true}], - "@typescript-eslint/require-await": "off" - } - }, { - "files": ["workflows/pkmn/*.ts"], - "parserOptions": { - "project": ["./tsconfig.pkmn.json"] - } - }] } } diff --git a/stats/eslint.config.mjs b/stats/eslint.config.mjs new file mode 100644 index 0000000..2fdd516 --- /dev/null +++ b/stats/eslint.config.mjs @@ -0,0 +1,3 @@ +import pkmn from "@pkmn/eslint-config"; + +export default [...pkmn, {rules: {"@typescript-eslint/no-redundant-type-constituents": "off"}}]; diff --git a/stats/package.json b/stats/package.json index 340f8ac..be320a9 100644 --- a/stats/package.json +++ b/stats/package.json @@ -16,15 +16,15 @@ "access": "public" }, "dependencies": { - "@pkmn/data": "^0.9.19" + "@pkmn/data": "^0.9.21" }, "devDependencies": { - "@pkmn/dex": "^0.9.19", + "@pkmn/dex": "^0.9.21", "json-stringify-pretty-compact": "3.0.0" }, "scripts": { - "lint": "eslint --cache src --ext ts", - "fix": "eslint --fix src --ext ts", + "lint": "eslint --cache src", + "fix": "eslint --fix src", "compile": "tsc -p .", "build": "npm run compile && tsup src/index.ts src/test/integration.ts", "test": "jest", @@ -48,11 +48,5 @@ "@babel/preset-typescript", ["@babel/preset-env", {"targets": {"node": "current"}}] ] - }, - "eslintConfig": { - "extends": "@pkmn", - "rules": { - "@typescript-eslint/no-redundant-type-constituents": "off" - } } } diff --git a/stats/src/parser.ts b/stats/src/parser.ts index 2ede458..69ff2c8 100644 --- a/stats/src/parser.ts +++ b/stats/src/parser.ts @@ -2,7 +2,6 @@ import {Generation, ID, PokemonSet, StatID, toID} from '@pkmn/data'; import {Classifier} from './classifier'; import {Outcome} from './util'; -// eslint-disable-next-line no-duplicate-imports import * as util from './util'; export interface Log { @@ -170,7 +169,7 @@ export const Parser = new class { battle.matchups.push(...turnMatchups); break; } - case 'move': + case 'move': { if (line.length < 4) { throw new Error(`Could not parse line: '${rawLine}'`); } @@ -182,6 +181,7 @@ export const Parser = new class { flags.uturn = true; } break; + } case '-enditem': if (rawLine.lastIndexOf('Red Card') > -1) { flags.roar = true; diff --git a/stats/src/stats.ts b/stats/src/stats.ts index 12b5573..07eafb0 100644 --- a/stats/src/stats.ts +++ b/stats/src/stats.ts @@ -2,7 +2,6 @@ import {Generation, ID, Nature, PokemonSet, StatID, StatsTable} from '@pkmn/data import {Battle, Player, Pokemon} from './parser'; import {Outcome} from './util'; -// eslint-disable-next-line no-duplicate-imports import * as util from './util'; export interface TaggedStatistics { diff --git a/stats/src/util.ts b/stats/src/util.ts index 45064b3..a36710f 100644 --- a/stats/src/util.ts +++ b/stats/src/util.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-loss-of-precision */ +/* eslint-disable no-loss-of-precision */ import {Dex, Generation, Generations, ID, PokemonSet, Specie, toID} from '@pkmn/data'; import * as aliases from './aliases.json';