mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
Default to type-aware linting (#7538)
In the past, we used non-type-aware linting in our pre-push hook, as well as in `npm test`. This was for performance reasons. In practice, though, we use an eslint cache, which makes even type-aware incremental linting instantaneous. My rule is that you should be able to make a small change and lint in under 10 seconds, and `npm test` should take under 30 seconds, and linting with no changes (for the pre-push hook) should be under 2 seconds. This is still true for type-aware linting, so there's no actual need for fast linting. We've also switched to using `--max-warnings 0` to convert warnings to errors. This seems to allow them to use the same cache file. A big improvement here is that `npm test` should now be enough for testing. I think everyone ran `npm run full-test` for a while because `npm test` didn't have type-aware lint errors, but now that it does, you'll be able to use it again and have your tests run a lot faster.
This commit is contained in:
parent
9d87616176
commit
c57fcf25c6
|
|
@ -220,6 +220,7 @@
|
|||
// see bottom of file for source
|
||||
"ignorePattern": "^\\s*(?:\\/\\/ \\s*)?(?:(?:export )?(?:let |const )?[a-zA-Z0-9_$.]+(?: \\+?=>? )|[a-zA-Z0-9$]+: \\[?|(?:return |throw )?(?:new )?(?:[a-zA-Z0-9$.]+\\()?)?(?:Utils\\.html|(?:this\\.)?(?:room\\.)?tr|\\$\\()?['\"`/]"
|
||||
}],
|
||||
"prefer-const": ["warn", {"destructuring": "all"}], // typescript-eslint/recommended forces this so we need to re-override
|
||||
|
||||
// PS code (code specific to PS)
|
||||
"@typescript-eslint/no-namespace": "off",
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
{
|
||||
"extends": "./.eslintrc-no-types.json",
|
||||
"rules": {
|
||||
// test only (should never be committed, but useful when testing)
|
||||
"no-debugger": "error",
|
||||
"no-unused-vars": ["error", {"args": "none"}],
|
||||
"prefer-const": ["error", {"destructuring": "all"}]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["./config/*.ts", "./data/**/*.ts", "./lib/*.ts", "./server/**/*.ts", "./sim/**/*.ts", "./tools/set-import/*.ts"],
|
||||
|
|
@ -34,15 +28,6 @@
|
|||
"@typescript-eslint/no-unsafe-return": "off",
|
||||
"@typescript-eslint/restrict-template-expressions": "off",
|
||||
|
||||
// test only (should never be committed, but useful when testing)
|
||||
"max-len": ["error", {
|
||||
"code": 120, "tabWidth": 0,
|
||||
// see bottom of .eslintrc-no-types.json for source
|
||||
"ignorePattern": "^\\s*(?:\\/\\/ \\s*)?(?:(?:export )?(?:let |const )?[a-zA-Z0-9_$.]+(?: \\+?=>? )|[a-zA-Z0-9$]+: \\[?|(?:return |throw )?(?:new )?(?:[a-zA-Z0-9$.]+\\()?)?(?:Utils\\.html|(?:this\\.)?(?:room\\.)?tr|\\$\\()?['\"`/]"
|
||||
}],
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error", {"args": "none"}],
|
||||
|
||||
// probably bugs
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
"@typescript-eslint/no-for-in-array": "error",
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -9,7 +9,7 @@
|
|||
/server/chat-plugins/*-private.js
|
||||
npm-debug.log
|
||||
.eslintcache
|
||||
.eslintfullcache
|
||||
.eslintcache-no-types
|
||||
package-lock.json
|
||||
/tools/set-import/sets
|
||||
databases/*.db*
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@
|
|||
"start": "node pokemon-showdown start",
|
||||
"build": "node build",
|
||||
"tsc": "tsc",
|
||||
"lint": "eslint . --config .eslintrc-no-types.json --cache --ext .js,.ts",
|
||||
"full-lint": "eslint . --config .eslintrc-types.json --cache --cache-location .eslintfullcache --ext .js,.ts",
|
||||
"fast-lint": "eslint . --config .eslintrc-no-types.json --cache --cache-location .eslintcache-no-types --ext .js,.ts",
|
||||
"lint": "eslint . --cache --ext .js,.ts",
|
||||
"full-lint": "eslint . --cache --ext .js,.ts --max-warnings 0",
|
||||
"pretest": "npm run lint && npm run build",
|
||||
"test": "mocha",
|
||||
"posttest": "npm run tsc",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user