diff --git a/caches/README.md b/caches/README.md index 3e07b85a7..d0fb426f2 100644 --- a/caches/README.md +++ b/caches/README.md @@ -6,4 +6,4 @@ This directory is for caches. Everything here should be safe to delete. Things cached here: - `pokemon-showdown` a checkout of the server repo, used in the build process (mostly for stuff in `play.pokemonshowdown.com/data/`) -- `eslint-*.json` eslint cache files +- `eslintcache.json` eslint cache files diff --git a/eslint.config.mjs b/eslint.config.mjs index 4c5217edd..9ed3b852d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -267,6 +267,8 @@ export const defaultRulesTSChecked = { /** @type {NonNullable} */ export const defaultRulesES3 = { ...defaultRules, + // required in ES3 + // ================ "no-var": "off", "object-shorthand": ["error", "never"], "prefer-arrow-callback": "off", @@ -277,13 +279,6 @@ export const defaultRulesES3 = { "prefer-spread": "off", "radix": "off", "@stylistic/comma-dangle": "error", - // treat var as let - // unfortunately incompatible with reusing i - // "block-scoped-var": "error", - "no-caller": "error", - "no-invalid-this": "error", - "no-new-wrappers": "error", - "no-restricted-globals": ["error", "Proxy", "Reflect", "Symbol", "WeakSet", "WeakMap"], "no-unused-vars": ["warn", { args: "all", argsIgnorePattern: ".", @@ -292,6 +287,17 @@ export const defaultRulesES3 = { destructuredArrayIgnorePattern: ".", ignoreRestSiblings: true, }], + + // with no block scoping, coming up with original variable names is too hard + "no-redeclare": "off", + + // treat var as let + // unfortunately doesn't actually let me redeclare + // "block-scoped-var": "error", + "no-caller": "error", + "no-invalid-this": "error", + "no-new-wrappers": "error", + "no-restricted-globals": ["error", "Proxy", "Reflect", "Symbol", "WeakSet", "WeakMap"], "unicode-bom": "error", }; @@ -388,7 +394,6 @@ export default tseslint.config([ "@stylistic/max-len": "off", // we use these for the big IIFEs that wrap entire files "@stylistic/padded-blocks": "off", - "no-redeclare": "off", // TODO: actually fix useless escapes "no-useless-escape": "off", "no-shadow-restricted-names": "error", @@ -398,7 +403,7 @@ export default tseslint.config([ { name: "JavaScript for Node", files: [ - '*.mjs', + '*.mjs', // look mom I'm linting myself! 'build-tools/*.js', 'build-tools/update', 'build-tools/build-*', diff --git a/package.json b/package.json index 593000001..8fbd38cdf 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "url": "https://github.com/Zarel/Pokemon-Showdown-Client.git" }, "scripts": { - "lint": "eslint", - "test": "node build && tsc && npm run lint && mocha test/*.js", - "fix": "eslint --fix", + "lint": "eslint --cache --cache-location caches/eslintcache.json", + "test": "node build && tsc && eslint --cache --cache-location caches/eslintcache.json --max-warnings 0 && mocha test/*.js", + "fix": "eslint --cache --cache-location caches/eslintcache.json --fix", "build": "node build", "build-full": "node build full" },