Skip to content

Commit b9261a1

Browse files
committed
chore: swap out pretty-quick and manual linting for lint-staged
1 parent 74386e8 commit b9261a1

File tree

5 files changed

+124
-53
lines changed

5 files changed

+124
-53
lines changed

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ tools/**/*.test-vrt.ts
6262
!tools/base/src/version.js
6363
!tools/base/src/version.d.ts
6464

65-
65+
# cache directories
6666
.wireit
67+
.eslintcache
6768

6869
stats.html
6970

@@ -111,4 +112,4 @@ chromatic.config.json
111112
!.yarn/plugins
112113
!.yarn/releases
113114
!.yarn/sdks
114-
!.yarn/versio;/
115+
!.yarn/version

.husky/pre-commit

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
#!/usr/bin/env bash
22
bash << EOF
3-
STAGED_FILES_TO_LINT=$(git diff --name-only --cached --diff-filter=d -- "*.ts" "*.js")
4-
STAGED_FILES_TO_ANALYZE=$(git diff --name-only --cached --diff-filter=d -- "{packages,tools}/*/src/**/!(*.css).ts")
5-
STAGED_CSS_FILES=$(git diff --name-only --cached --diff-filter=d -- "{packages,tools}/**/*.css")
6-
VERSION_FILE=$(dirname "$0")/../tools/base/src/version.js
7-
8-
[ -z "$STAGED_FILES_TO_LINT" ] || yarn eslint -f pretty $STAGED_FILES_TO_LINT
9-
[ -z "$STAGED_FILES_TO_ANALYZE" ] || yarn lit-analyzer $STAGED_FILES_TO_ANALYZE
10-
[ -z "$STAGED_CSS_FILES" ] || yarn stylelint $STAGED_CSS_FILES
11-
12-
yarn pretty-quick --staged
3+
yarn lint-staged
134
5+
VERSION_FILE=$(dirname "$0")/../tools/base/src/version.js
146
yarn genversion --es6 --semi $VERSION_FILE
157
git add $VERSION_FILE
168
EOF

lint-staged.config.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Copyright 2025 Adobe. All rights reserved.
3+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License. You may obtain a copy
5+
of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
Unless required by applicable law or agreed to in writing, software distributed under
8+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
OF ANY KIND, either express or implied. See the License for the specific language
10+
governing permissions and limitations under the License.
11+
*/
12+
13+
export default {
14+
'*': [
15+
'prettier --cache --no-error-on-unmatched-pattern --ignore-unknown --log-level silent --write',
16+
],
17+
'*.css': [
18+
'stylelint --fix --cache --allow-empty-input --report-descriptionless-disables --report-invalid-scope-disables --report-needless-disables',
19+
],
20+
'{packages,tools}/**/*.ts': [
21+
'eslint --fix --format pretty --cache --no-error-on-unmatched-pattern --quiet',
22+
],
23+
'{packages,tools}/*/src/**/!(*.css).ts': ['yarn lit-analyzer'],
24+
'package.json': () => [
25+
'yarn constraints --fix',
26+
'yarn install --refresh-lockfile',
27+
'git add yarn.lock',
28+
],
29+
};

package.json

+6-11
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,12 @@
3636
"docs:review": "alex packages/**/*.md",
3737
"docs:start": "yarn workspace documentation serve --watch",
3838
"find": "test -f custom-elements.json",
39-
"format:css": "yarn lint:css --fix && pretty-quick --pattern \"{packages,tools}/**/*.css\"",
39+
"format:css": "stylelint --fix --cache --allow-empty-input --report-descriptionless-disables --report-invalid-scope-disables --report-needless-disables {packages,tools}/**/*.css && prettier --no-error-on-unmatched-pattern --ignore-unknown --log-level silent --write --config .prettierrc {packages,tools}/**/*.css",
4040
"gen-react-wrapper": "node ./tasks/gen-react-wrapper.js",
4141
"icons": "wireit",
4242
"icons:ui": "wireit",
4343
"icons:workflow": "wireit",
44-
"lint": "run-p lint:js lint:docs lint:ts lint:css lint:packagejson",
45-
"lint:css": "stylelint \"packages/**/*.css\" \"tools/**/*.css\"",
46-
"lint:docs": "eslint -f pretty \"projects/documentation/**/*.ts\"",
47-
"lint:js": "pretty-quick --pattern \"tasks/**/*.js\" && pretty-quick --pattern \"scripts/**/*.js\"",
48-
"lint:packagejson": "pretty-quick --pattern package.json --pattern \"packages/*/package.json\" --pattern \"projects/*/package.json\" --pattern \"tools/*/package.json\" --pattern \"react/*/package.json\"",
49-
"lint:ts": "pretty-quick --pattern \"packages/**/*.ts\" && eslint -f pretty \"packages/**/*.ts\" && pretty-quick --pattern \"tools/**/*.ts\" && eslint -f pretty \"tools/**/*.ts\"",
44+
"lint": "git status --porcelain && git add . && yarn lint-staged",
5045
"lint:versions": "node ./scripts/lint-versions.js",
5146
"new-package": "cd projects/templates && plop",
5247
"postcustom-element-json": "node ./tasks/run-check-cem.js",
@@ -90,7 +85,7 @@
9085
"test:watch:flags:focus": "yarn build && run-p build:watch \"test:start --watch --group {1} --config web-test-runner.config.ci-chromium-flags.js\" --",
9186
"test:watch:focus": "yarn build && run-p build:watch \"test:start --watch --group {1}\" --",
9287
"update:spectrum-css": "node ./scripts/update-spectrum-css.js --latest || yarn update:spectrum-css:cleanup",
93-
"update:spectrum-css:cleanup": "yarn lint:packagejson && yarn --ignore-scripts && yarn process-spectrum",
88+
"update:spectrum-css:cleanup": "yarn lint-staged && yarn --ignore-scripts && yarn process-spectrum",
9489
"update:spectrum-css:nonbreaking": "node ./scripts/update-spectrum-css.js || yarn update:spectrum-css:cleanup",
9590
"verify-build-artifacts": "node ./scripts/verify-build-artifacts.js",
9691
"vrt:preview": "yarn wds --config test/visual/wds-vrt.config.js",
@@ -175,6 +170,7 @@
175170
"husky": "^9.0.10",
176171
"latest-version": "^9.0.0",
177172
"lightningcss": "1.19.0",
173+
"lint-staged": "^15.5.1",
178174
"lit": "^2.5.0 || ^3.1.3",
179175
"lit-analyzer": "^2.0.3",
180176
"lit-html": "^2.4.0 || ^3.1.3",
@@ -185,10 +181,9 @@
185181
"npm-run-all2": "^6.0.0",
186182
"patch-package": "^8.0.0",
187183
"pinst": "^3.0.0",
188-
"prettier": "^3.0.0",
184+
"prettier": "^3.5.3",
189185
"prettier-plugin-package": "^1.3.0",
190186
"pretty-bytes": "^6.1.1",
191-
"pretty-quick": "^4.1.1",
192187
"re-template-tag": "^2.0.1",
193188
"rimraf": "^5.0.1",
194189
"rollup": "^4.12.0",
@@ -321,7 +316,7 @@
321316
]
322317
},
323318
"icons": {
324-
"command": "node ./scripts/process-icons.js && pretty-quick --pattern \"packages/**/*.svg.ts\" && eslint -f pretty --fix \"packages/**/*.svg.ts\"",
319+
"command": "node ./scripts/process-icons.js && git status --porcelain && git add . && yarn lint-staged",
325320
"files": [
326321
"scripts/process-icons.js"
327322
],

yarn.lock

+84-30
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ __metadata:
284284
husky: "npm:^9.0.10"
285285
latest-version: "npm:^9.0.0"
286286
lightningcss: "npm:1.19.0"
287+
lint-staged: "npm:^15.5.1"
287288
lit: "npm:^2.5.0 || ^3.1.3"
288289
lit-analyzer: "npm:^2.0.3"
289290
lit-html: "npm:^2.4.0 || ^3.1.3"
@@ -294,10 +295,9 @@ __metadata:
294295
npm-run-all2: "npm:^6.0.0"
295296
patch-package: "npm:^8.0.0"
296297
pinst: "npm:^3.0.0"
297-
prettier: "npm:^3.0.0"
298+
prettier: "npm:^3.5.3"
298299
prettier-plugin-package: "npm:^1.3.0"
299300
pretty-bytes: "npm:^6.1.1"
300-
pretty-quick: "npm:^4.1.1"
301301
re-template-tag: "npm:^2.0.1"
302302
rimraf: "npm:^5.0.1"
303303
rollup: "npm:^4.12.0"
@@ -15287,6 +15287,13 @@ __metadata:
1528715287
languageName: node
1528815288
linkType: hard
1528915289

15290+
"chalk@npm:^5.4.1":
15291+
version: 5.4.1
15292+
resolution: "chalk@npm:5.4.1"
15293+
checksum: 10c0/b23e88132c702f4855ca6d25cb5538b1114343e41472d5263ee8a37cccfccd9c4216d111e1097c6a27830407a1dc81fecdf2a56f2c63033d4dbbd88c10b0dcef
15294+
languageName: node
15295+
linkType: hard
15296+
1529015297
"change-case@npm:^4.1.2":
1529115298
version: 4.1.2
1529215299
resolution: "change-case@npm:4.1.2"
@@ -16031,6 +16038,13 @@ __metadata:
1603116038
languageName: node
1603216039
linkType: hard
1603316040

16041+
"commander@npm:^13.1.0":
16042+
version: 13.1.0
16043+
resolution: "commander@npm:13.1.0"
16044+
checksum: 10c0/7b8c5544bba704fbe84b7cab2e043df8586d5c114a4c5b607f83ae5060708940ed0b5bd5838cf8ce27539cde265c1cbd59ce3c8c6b017ed3eec8943e3a415164
16045+
languageName: node
16046+
linkType: hard
16047+
1603416048
"commander@npm:^2.19.0, commander@npm:^2.20.0, commander@npm:^2.20.3, commander@npm:^2.8.1":
1603516049
version: 2.20.3
1603616050
resolution: "commander@npm:2.20.3"
@@ -25266,6 +25280,13 @@ __metadata:
2526625280
languageName: node
2526725281
linkType: hard
2526825282

25283+
"lilconfig@npm:^3.1.3":
25284+
version: 3.1.3
25285+
resolution: "lilconfig@npm:3.1.3"
25286+
checksum: 10c0/f5604e7240c5c275743561442fbc5abf2a84ad94da0f5adc71d25e31fa8483048de3dcedcb7a44112a942fed305fd75841cdf6c9681c7f640c63f1049e9a5dcc
25287+
languageName: node
25288+
linkType: hard
25289+
2526925290
"limit-spawn@npm:0.0.3":
2527025291
version: 0.0.3
2527125292
resolution: "limit-spawn@npm:0.0.3"
@@ -25296,6 +25317,26 @@ __metadata:
2529625317
languageName: node
2529725318
linkType: hard
2529825319

25320+
"lint-staged@npm:^15.5.1":
25321+
version: 15.5.1
25322+
resolution: "lint-staged@npm:15.5.1"
25323+
dependencies:
25324+
chalk: "npm:^5.4.1"
25325+
commander: "npm:^13.1.0"
25326+
debug: "npm:^4.4.0"
25327+
execa: "npm:^8.0.1"
25328+
lilconfig: "npm:^3.1.3"
25329+
listr2: "npm:^8.2.5"
25330+
micromatch: "npm:^4.0.8"
25331+
pidtree: "npm:^0.6.0"
25332+
string-argv: "npm:^0.3.2"
25333+
yaml: "npm:^2.7.0"
25334+
bin:
25335+
lint-staged: bin/lint-staged.js
25336+
checksum: 10c0/86deddb08bf10428f2eb96c02326a9ee403360729225f0b12afb0c0f13c287a75daa01e179d86f64e3432576446d8643d204a47417296f9ef0aa56f1340ff2af
25337+
languageName: node
25338+
linkType: hard
25339+
2529925340
"liquidjs@npm:^10.17.0":
2530025341
version: 10.18.0
2530125342
resolution: "liquidjs@npm:10.18.0"
@@ -25358,6 +25399,20 @@ __metadata:
2535825399
languageName: node
2535925400
linkType: hard
2536025401

25402+
"listr2@npm:^8.2.5":
25403+
version: 8.3.2
25404+
resolution: "listr2@npm:8.3.2"
25405+
dependencies:
25406+
cli-truncate: "npm:^4.0.0"
25407+
colorette: "npm:^2.0.20"
25408+
eventemitter3: "npm:^5.0.1"
25409+
log-update: "npm:^6.1.0"
25410+
rfdc: "npm:^1.4.1"
25411+
wrap-ansi: "npm:^9.0.0"
25412+
checksum: 10c0/6b6378e28debda863d31f03ffe880a76b45c07388c74e8e0676fc957de7f2aff24fdea7f48b17d12808440f64680215c36df388c79d2b367c7866dd66f75fb09
25413+
languageName: node
25414+
linkType: hard
25415+
2536125416
"lit-analyzer@npm:^2.0.3":
2536225417
version: 2.0.3
2536325418
resolution: "lit-analyzer@npm:2.0.3"
@@ -29770,13 +29825,6 @@ __metadata:
2977029825
languageName: node
2977129826
linkType: hard
2977229827

29773-
"picomatch@npm:^4.0.2":
29774-
version: 4.0.2
29775-
resolution: "picomatch@npm:4.0.2"
29776-
checksum: 10c0/7c51f3ad2bb42c776f49ebf964c644958158be30d0a510efd5a395e8d49cb5acfed5b82c0c5b365523ce18e6ab85013c9ebe574f60305892ec3fa8eee8304ccc
29777-
languageName: node
29778-
linkType: hard
29779-
2978029828
"pidtree@npm:^0.6.0":
2978129829
version: 0.6.0
2978229830
resolution: "pidtree@npm:0.6.0"
@@ -31012,6 +31060,15 @@ __metadata:
3101231060
languageName: node
3101331061
linkType: hard
3101431062

31063+
"prettier@npm:^3.5.3":
31064+
version: 3.5.3
31065+
resolution: "prettier@npm:3.5.3"
31066+
bin:
31067+
prettier: bin/prettier.cjs
31068+
checksum: 10c0/3880cb90b9dc0635819ab52ff571518c35bd7f15a6e80a2054c05dbc8a3aa6e74f135519e91197de63705bcb38388ded7e7230e2178432a1468005406238b877
31069+
languageName: node
31070+
linkType: hard
31071+
3101531072
"pretty-bytes@npm:^5.3.0, pretty-bytes@npm:^5.5.0":
3101631073
version: 5.6.0
3101731074
resolution: "pretty-bytes@npm:5.6.0"
@@ -31063,25 +31120,6 @@ __metadata:
3106331120
languageName: node
3106431121
linkType: hard
3106531122

31066-
"pretty-quick@npm:^4.1.1":
31067-
version: 4.1.1
31068-
resolution: "pretty-quick@npm:4.1.1"
31069-
dependencies:
31070-
find-up: "npm:^5.0.0"
31071-
ignore: "npm:^7.0.3"
31072-
mri: "npm:^1.2.0"
31073-
picocolors: "npm:^1.1.1"
31074-
picomatch: "npm:^4.0.2"
31075-
tinyexec: "npm:^0.3.2"
31076-
tslib: "npm:^2.8.1"
31077-
peerDependencies:
31078-
prettier: ^3.0.0
31079-
bin:
31080-
pretty-quick: lib/cli.mjs
31081-
checksum: 10c0/c0362aff7d7679f58c044891047e7bbb03d461543aa30b1c57fef9400fa8c4d1daef4aa2b146a9c9072ce050c60860a88eb64b3fd722826dc56616f7cd1d6011
31082-
languageName: node
31083-
linkType: hard
31084-
3108531123
"prettyjson@npm:1.2.5":
3108631124
version: 1.2.5
3108731125
resolution: "prettyjson@npm:1.2.5"
@@ -34177,6 +34215,13 @@ __metadata:
3417734215
languageName: node
3417834216
linkType: hard
3417934217

34218+
"string-argv@npm:^0.3.2":
34219+
version: 0.3.2
34220+
resolution: "string-argv@npm:0.3.2"
34221+
checksum: 10c0/75c02a83759ad1722e040b86823909d9a2fc75d15dd71ec4b537c3560746e33b5f5a07f7332d1e3f88319909f82190843aa2f0a0d8c8d591ec08e93d5b8dec82
34222+
languageName: node
34223+
linkType: hard
34224+
3418034225
"string-similarity@npm:^4.0.4":
3418134226
version: 4.0.4
3418234227
resolution: "string-similarity@npm:4.0.4"
@@ -35393,7 +35438,7 @@ __metadata:
3539335438
languageName: node
3539435439
linkType: hard
3539535440

35396-
"tinyexec@npm:^0.3.0, tinyexec@npm:^0.3.2":
35441+
"tinyexec@npm:^0.3.0":
3539735442
version: 0.3.2
3539835443
resolution: "tinyexec@npm:0.3.2"
3539935444
checksum: 10c0/3efbf791a911be0bf0821eab37a3445c2ba07acc1522b1fa84ae1e55f10425076f1290f680286345ed919549ad67527d07281f1c19d584df3b74326909eb1f90
@@ -35713,7 +35758,7 @@ __metadata:
3571335758
languageName: node
3571435759
linkType: hard
3571535760

35716-
"tslib@npm:2, tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.3.1, tslib@npm:^2.4.0, tslib@npm:^2.6.2, tslib@npm:^2.8.1":
35761+
"tslib@npm:2, tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.3.1, tslib@npm:^2.4.0, tslib@npm:^2.6.2":
3571735762
version: 2.8.1
3571835763
resolution: "tslib@npm:2.8.1"
3571935764
checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62
@@ -38261,6 +38306,15 @@ __metadata:
3826138306
languageName: node
3826238307
linkType: hard
3826338308

38309+
"yaml@npm:^2.7.0":
38310+
version: 2.7.1
38311+
resolution: "yaml@npm:2.7.1"
38312+
bin:
38313+
yaml: bin.mjs
38314+
checksum: 10c0/ee2126398ab7d1fdde566b4013b68e36930b9e6d8e68b6db356875c99614c10d678b6f45597a145ff6d63814961221fc305bf9242af8bf7450177f8a68537590
38315+
languageName: node
38316+
linkType: hard
38317+
3826438318
"yargs-parser@npm:^21.1.1":
3826538319
version: 21.1.1
3826638320
resolution: "yargs-parser@npm:21.1.1"

0 commit comments

Comments
 (0)