Skip to content

Commit 40410c5

Browse files
committed
Support ESLint caching
Also rearrange the config a little.
1 parent 8c80d8a commit 40410c5

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

eslint.config.mjs

+14-9
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ export const defaultRulesTSChecked = {
267267
/** @type {NonNullable<Config['rules']>} */
268268
export const defaultRulesES3 = {
269269
...defaultRules,
270+
// required in ES3
271+
// ================
270272
"no-var": "off",
271273
"object-shorthand": ["error", "never"],
272274
"prefer-arrow-callback": "off",
@@ -277,13 +279,6 @@ export const defaultRulesES3 = {
277279
"prefer-spread": "off",
278280
"radix": "off",
279281
"@stylistic/comma-dangle": "error",
280-
// treat var as let
281-
// unfortunately incompatible with reusing i
282-
// "block-scoped-var": "error",
283-
"no-caller": "error",
284-
"no-invalid-this": "error",
285-
"no-new-wrappers": "error",
286-
"no-restricted-globals": ["error", "Proxy", "Reflect", "Symbol", "WeakSet", "WeakMap"],
287282
"no-unused-vars": ["warn", {
288283
args: "all",
289284
argsIgnorePattern: ".",
@@ -292,6 +287,17 @@ export const defaultRulesES3 = {
292287
destructuredArrayIgnorePattern: ".",
293288
ignoreRestSiblings: true,
294289
}],
290+
291+
// with no block scoping, coming up with original variable names is too hard
292+
"no-redeclare": "off",
293+
294+
// treat var as let
295+
// unfortunately doesn't actually let me redeclare
296+
// "block-scoped-var": "error",
297+
"no-caller": "error",
298+
"no-invalid-this": "error",
299+
"no-new-wrappers": "error",
300+
"no-restricted-globals": ["error", "Proxy", "Reflect", "Symbol", "WeakSet", "WeakMap"],
295301
"unicode-bom": "error",
296302
};
297303

@@ -388,7 +394,6 @@ export default tseslint.config([
388394
"@stylistic/max-len": "off",
389395
// we use these for the big IIFEs that wrap entire files
390396
"@stylistic/padded-blocks": "off",
391-
"no-redeclare": "off",
392397
// TODO: actually fix useless escapes
393398
"no-useless-escape": "off",
394399
"no-shadow-restricted-names": "error",
@@ -398,7 +403,7 @@ export default tseslint.config([
398403
{
399404
name: "JavaScript for Node",
400405
files: [
401-
'*.mjs',
406+
'*.mjs', // look mom I'm linting myself!
402407
'build-tools/*.js',
403408
'build-tools/update',
404409
'build-tools/build-*',

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"url": "https://github.com/Zarel/Pokemon-Showdown-Client.git"
1010
},
1111
"scripts": {
12-
"lint": "eslint",
13-
"test": "node build && tsc && npm run lint && mocha test/*.js",
14-
"fix": "eslint --fix",
12+
"lint": "eslint --cache --cache-location caches/eslintcache.json",
13+
"test": "node build && tsc && eslint --cache --cache-location caches/eslintcache.json --max-warnings 0 && mocha test/*.js",
14+
"fix": "eslint --cache --cache-location caches/eslintcache.json --fix",
1515
"build": "node build",
1616
"build-full": "node build full"
1717
},

0 commit comments

Comments
 (0)