From 7c6dbbdba1769bcb80b103d43c3eaa61e395dc52 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 5 Apr 2022 13:36:10 -0700 Subject: [PATCH] [meta] improve `prelint` script when no `.git` dir is present --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 55d70c26..6967c687 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "scripts": { "prepublishOnly": "safe-publish-latest", "prepublish": "!(type not-in-publish) || not-in-publish || npm run prepublishOnly", - "prelint": "eclint check $(git ls-files 2>/dev/null | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' || echo '*.md *.js test/*.js')", + "prelint:files": "git ls-files 2>/dev/null | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' || echo '*.md *.js test/*.js'", + "prelint": "FILES=\"$(npm run --silent prelint:files)\" eclint check \"${FILES:=package.json}\"", "lint": "eslint --ext .js,.cjs,.mjs . bin/*", "pretest": "npm run lint", "test": "npm run tests-only",