From 5f781346aa7cd7eb6a14b532304787cbc7287b9c 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 e9a53932..67f91eeb 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,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",