add ELINT_FAST environment variable in pre-commit hook (#34396)

* add ELINT_FAST environment variable in pre-commit hook

skips slow type-aware linting in pre-commit hook, full lint still runs in CI

GitOrigin-RevId: d4b6fde1c5010ba0f61aed03972b745af0f55b9b
This commit is contained in:
Brian Gough
2026-06-09 08:06:57 +00:00
committed by Copybot
parent b703acb55a
commit 19b040fc69
+20 -10
View File
@@ -43,6 +43,12 @@ const reactFlatRecommended = {
import _ from 'lodash'
import confusingBrowserGlobals from 'confusing-browser-globals'
// Type-aware linting is expensive: setting `parserOptions.project` makes
// @typescript-eslint build a full TypeScript program from tsconfig.backend.json
// on every ESLint invocation, even when linting a single file.
// Set ESLINT_FAST=1 to skip type-aware checks; the full lint still runs in CI.
const TYPE_AWARE = process.env.ESLINT_FAST !== '1'
export default defineConfig([
// Declare which file extensions ESLint should consider in this workspace.
// Replaces the previous `--ext .js,.jsx,.mjs,.ts,.tsx` CLI flag, which is
@@ -302,10 +308,12 @@ export default defineConfig([
files: ['**/app/src/**/*.{js,mjs}', 'app.{js,mjs}'],
languageOptions: {
parserOptions: {
tsconfigRootDir: import.meta.dirname,
project: './tsconfig.backend.json',
},
parserOptions: TYPE_AWARE
? {
tsconfigRootDir: import.meta.dirname,
project: './tsconfig.backend.json',
}
: {},
},
rules: {
@@ -357,12 +365,14 @@ export default defineConfig([
},
],
'@typescript-eslint/no-floating-promises': [
'error',
{
checkThenables: true,
},
],
'@typescript-eslint/no-floating-promises': TYPE_AWARE
? [
'error',
{
checkThenables: true,
},
]
: 'off',
},
},
{