mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
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:
@@ -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',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user