diff --git a/.eslintrc.js b/.eslintrc.js index 31c02db5..665fdfbd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,7 +26,7 @@ module.exports = { ], "parser": "@typescript-eslint/parser", "parserOptions": { - "project": "tsconfig.json", + "project": ["tsconfig.json", "tsconfig.eslint.json"], "sourceType": "module" }, "plugins": [ diff --git a/.gitignore b/.gitignore index 14ceb85f..84994b24 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ tags compiler/*.js compiler/**/*.js .*.generated.ts +.tmp/ diff --git a/hooks/pre-commit b/hooks/pre-commit index b015d1ea..461a9c9a 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -7,7 +7,7 @@ otherfiles=$(cachedPrettierFiles) # Check if any of the files are ugly or contain a console.log call consoleFiles=$(noisy $jsfiles) -uglyFiles = "$(eslintUgly) $jsfiles" +uglyFiles="$(eslintUgly $jsfiles)" if [ ! -n "$uglyFiles" ]; then uglyFiles="$(prettierUgly $otherfiles)" fi diff --git a/scripts/common.sh b/scripts/common.sh index 8e9df652..6e781a72 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -33,12 +33,14 @@ eslintUgly() { local acc="" local IFS=$'\n' local tmpdir - tmpdir=$(mktemp -d "eslint.XXXXXXXXX") + + mkdir -p .tmp + tmpdir=$(mktemp --tmpdir=".tmp/" -d "tslint.XXXXXXXXX") for jsfile in "$@"; do tmpfile="$tmpdir/$jsfile" mkdir -p "$(dirname "$tmpfile")" staged "$jsfile" > "$tmpfile" - "$(yarn bin)/eslint" --quiet -o /dev/null "$tmpfile" || acc="$jsfile"$'\n'"$acc" + "$(yarn bin)/eslint" --no-ignore --quiet -o /dev/null "$tmpfile" || acc="$jsfile"$'\n'"$acc" done rm -rf "$tmpdir" echo "$acc" diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 00000000..1b160056 --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "include": [ + ".tmp/**/*.ts" + ] +}