From c9bbfa46d5e42a12c9fe558e59d91511de535b45 Mon Sep 17 00:00:00 2001 From: Brad Decker Date: Fri, 20 Jan 2023 09:16:58 -0600 Subject: [PATCH] fix script for linting changed files (#17028) --- development/get-changed-file-names.sh | 7 +++++++ package.json | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100755 development/get-changed-file-names.sh diff --git a/development/get-changed-file-names.sh b/development/get-changed-file-names.sh new file mode 100755 index 000000000..dbcce67ea --- /dev/null +++ b/development/get-changed-file-names.sh @@ -0,0 +1,7 @@ +#! /bin/bash +# This file exists because yarn 2+ seems to not be able to use the yarn 1 +# syntax in "scripts" to concatenate two commands output together using { }. +# This script simply outputs both and then normal pipe operator syntax can be +# used in the "scripts" key can be used to operate on the output. + +git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; diff --git a/package.json b/package.json index c366f27f6..32a3066fb 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,8 @@ "lint:fix": "yarn lint:prettier:fix && yarn lint:eslint:fix && yarn lint:styles:fix", "lint:prettier": "prettier --check -- **/*.json", "lint:prettier:fix": "prettier --write -- **/*.json", - "lint:changed": "{ git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; } | grep --regexp='[.]js$' | tr '\\n' '\\0' | xargs -0 eslint", - "lint:changed:fix": "{ git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; } | grep --regexp='[.]js$' | tr '\\n' '\\0' | xargs -0 eslint --fix", + "lint:changed": "./development/get-changed-file-names.sh | grep --regexp='[.]js$' | tr '\\n' '\\0' | xargs -0 eslint", + "lint:changed:fix": "./development/get-changed-file-names.sh | grep --regexp='[.]js$' | tr '\\n' '\\0' | xargs -0 eslint --fix", "lint:changelog": "auto-changelog validate", "lint:changelog:rc": "auto-changelog validate --rc", "lint:eslint": "eslint . --ext js,ts,tsx,snap --cache",