Skip to content

Commit 6c05315

Browse files
committed
chore: swap out pretty-quick and manual linting for lint-staged
1 parent 950b5fa commit 6c05315

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"
@@ -13687,6 +13687,13 @@ __metadata:
1368713687
languageName: node
1368813688
linkType: hard
1368913689

13690+
"chalk@npm:^5.4.1":
13691+
version: 5.4.1
13692+
resolution: "chalk@npm:5.4.1"
13693+
checksum: 10c0/b23e88132c702f4855ca6d25cb5538b1114343e41472d5263ee8a37cccfccd9c4216d111e1097c6a27830407a1dc81fecdf2a56f2c63033d4dbbd88c10b0dcef
13694+
languageName: node
13695+
linkType: hard
13696+
1369013697
"change-case@npm:^4.1.2":
1369113698
version: 4.1.2
1369213699
resolution: "change-case@npm:4.1.2"
@@ -14411,6 +14418,13 @@ __metadata:
1441114418
languageName: node
1441214419
linkType: hard
1441314420

14421+
"commander@npm:^13.1.0":
14422+
version: 13.1.0
14423+
resolution: "commander@npm:13.1.0"
14424+
checksum: 10c0/7b8c5544bba704fbe84b7cab2e043df8586d5c114a4c5b607f83ae5060708940ed0b5bd5838cf8ce27539cde265c1cbd59ce3c8c6b017ed3eec8943e3a415164
14425+
languageName: node
14426+
linkType: hard
14427+
1441414428
"commander@npm:^2.19.0, commander@npm:^2.20.0, commander@npm:^2.20.3, commander@npm:^2.8.1":
1441514429
version: 2.20.3
1441614430
resolution: "commander@npm:2.20.3"
@@ -23348,6 +23362,13 @@ __metadata:
2334823362
languageName: node
2334923363
linkType: hard
2335023364

23365+
"lilconfig@npm:^3.1.3":
23366+
version: 3.1.3
23367+
resolution: "lilconfig@npm:3.1.3"
23368+
checksum: 10c0/f5604e7240c5c275743561442fbc5abf2a84ad94da0f5adc71d25e31fa8483048de3dcedcb7a44112a942fed305fd75841cdf6c9681c7f640c63f1049e9a5dcc
23369+
languageName: node
23370+
linkType: hard
23371+
2335123372
"limit-spawn@npm:0.0.3":
2335223373
version: 0.0.3
2335323374
resolution: "limit-spawn@npm:0.0.3"
@@ -23378,6 +23399,26 @@ __metadata:
2337823399
languageName: node
2337923400
linkType: hard
2338023401

23402+
"lint-staged@npm:^15.5.1":
23403+
version: 15.5.1
23404+
resolution: "lint-staged@npm:15.5.1"
23405+
dependencies:
23406+
chalk: "npm:^5.4.1"
23407+
commander: "npm:^13.1.0"
23408+
debug: "npm:^4.4.0"
23409+
execa: "npm:^8.0.1"
23410+
lilconfig: "npm:^3.1.3"
23411+
listr2: "npm:^8.2.5"
23412+
micromatch: "npm:^4.0.8"
23413+
pidtree: "npm:^0.6.0"
23414+
string-argv: "npm:^0.3.2"
23415+
yaml: "npm:^2.7.0"
23416+
bin:
23417+
lint-staged: bin/lint-staged.js
23418+
checksum: 10c0/86deddb08bf10428f2eb96c02326a9ee403360729225f0b12afb0c0f13c287a75daa01e179d86f64e3432576446d8643d204a47417296f9ef0aa56f1340ff2af
23419+
languageName: node
23420+
linkType: hard
23421+
2338123422
"liquidjs@npm:^10.17.0":
2338223423
version: 10.18.0
2338323424
resolution: "liquidjs@npm:10.18.0"
@@ -23440,6 +23481,20 @@ __metadata:
2344023481
languageName: node
2344123482
linkType: hard
2344223483

23484+
"listr2@npm:^8.2.5":
23485+
version: 8.3.2
23486+
resolution: "listr2@npm:8.3.2"
23487+
dependencies:
23488+
cli-truncate: "npm:^4.0.0"
23489+
colorette: "npm:^2.0.20"
23490+
eventemitter3: "npm:^5.0.1"
23491+
log-update: "npm:^6.1.0"
23492+
rfdc: "npm:^1.4.1"
23493+
wrap-ansi: "npm:^9.0.0"
23494+
checksum: 10c0/6b6378e28debda863d31f03ffe880a76b45c07388c74e8e0676fc957de7f2aff24fdea7f48b17d12808440f64680215c36df388c79d2b367c7866dd66f75fb09
23495+
languageName: node
23496+
linkType: hard
23497+
2344323498
"lit-analyzer@npm:^2.0.3":
2344423499
version: 2.0.3
2344523500
resolution: "lit-analyzer@npm:2.0.3"
@@ -27749,13 +27804,6 @@ __metadata:
2774927804
languageName: node
2775027805
linkType: hard
2775127806

27752-
"picomatch@npm:^4.0.2":
27753-
version: 4.0.2
27754-
resolution: "picomatch@npm:4.0.2"
27755-
checksum: 10c0/7c51f3ad2bb42c776f49ebf964c644958158be30d0a510efd5a395e8d49cb5acfed5b82c0c5b365523ce18e6ab85013c9ebe574f60305892ec3fa8eee8304ccc
27756-
languageName: node
27757-
linkType: hard
27758-
2775927807
"pidtree@npm:^0.6.0":
2776027808
version: 0.6.0
2776127809
resolution: "pidtree@npm:0.6.0"
@@ -28975,6 +29023,15 @@ __metadata:
2897529023
languageName: node
2897629024
linkType: hard
2897729025

29026+
"prettier@npm:^3.5.3":
29027+
version: 3.5.3
29028+
resolution: "prettier@npm:3.5.3"
29029+
bin:
29030+
prettier: bin/prettier.cjs
29031+
checksum: 10c0/3880cb90b9dc0635819ab52ff571518c35bd7f15a6e80a2054c05dbc8a3aa6e74f135519e91197de63705bcb38388ded7e7230e2178432a1468005406238b877
29032+
languageName: node
29033+
linkType: hard
29034+
2897829035
"pretty-bytes@npm:^5.3.0, pretty-bytes@npm:^5.5.0":
2897929036
version: 5.6.0
2898029037
resolution: "pretty-bytes@npm:5.6.0"
@@ -29026,25 +29083,6 @@ __metadata:
2902629083
languageName: node
2902729084
linkType: hard
2902829085

29029-
"pretty-quick@npm:^4.1.1":
29030-
version: 4.1.1
29031-
resolution: "pretty-quick@npm:4.1.1"
29032-
dependencies:
29033-
find-up: "npm:^5.0.0"
29034-
ignore: "npm:^7.0.3"
29035-
mri: "npm:^1.2.0"
29036-
picocolors: "npm:^1.1.1"
29037-
picomatch: "npm:^4.0.2"
29038-
tinyexec: "npm:^0.3.2"
29039-
tslib: "npm:^2.8.1"
29040-
peerDependencies:
29041-
prettier: ^3.0.0
29042-
bin:
29043-
pretty-quick: lib/cli.mjs
29044-
checksum: 10c0/c0362aff7d7679f58c044891047e7bbb03d461543aa30b1c57fef9400fa8c4d1daef4aa2b146a9c9072ce050c60860a88eb64b3fd722826dc56616f7cd1d6011
29045-
languageName: node
29046-
linkType: hard
29047-
2904829086
"prettyjson@npm:1.2.5":
2904929087
version: 1.2.5
2905029088
resolution: "prettyjson@npm:1.2.5"
@@ -31985,6 +32023,13 @@ __metadata:
3198532023
languageName: node
3198632024
linkType: hard
3198732025

32026+
"string-argv@npm:^0.3.2":
32027+
version: 0.3.2
32028+
resolution: "string-argv@npm:0.3.2"
32029+
checksum: 10c0/75c02a83759ad1722e040b86823909d9a2fc75d15dd71ec4b537c3560746e33b5f5a07f7332d1e3f88319909f82190843aa2f0a0d8c8d591ec08e93d5b8dec82
32030+
languageName: node
32031+
linkType: hard
32032+
3198832033
"string-similarity@npm:^4.0.4":
3198932034
version: 4.0.4
3199032035
resolution: "string-similarity@npm:4.0.4"
@@ -33168,7 +33213,7 @@ __metadata:
3316833213
languageName: node
3316933214
linkType: hard
3317033215

33171-
"tinyexec@npm:^0.3.0, tinyexec@npm:^0.3.2":
33216+
"tinyexec@npm:^0.3.0":
3317233217
version: 0.3.2
3317333218
resolution: "tinyexec@npm:0.3.2"
3317433219
checksum: 10c0/3efbf791a911be0bf0821eab37a3445c2ba07acc1522b1fa84ae1e55f10425076f1290f680286345ed919549ad67527d07281f1c19d584df3b74326909eb1f90
@@ -33474,7 +33519,7 @@ __metadata:
3347433519
languageName: node
3347533520
linkType: hard
3347633521

33477-
"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":
33522+
"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":
3347833523
version: 2.8.1
3347933524
resolution: "tslib@npm:2.8.1"
3348033525
checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62
@@ -35936,6 +35981,15 @@ __metadata:
3593635981
languageName: node
3593735982
linkType: hard
3593835983

35984+
"yaml@npm:^2.7.0":
35985+
version: 2.7.1
35986+
resolution: "yaml@npm:2.7.1"
35987+
bin:
35988+
yaml: bin.mjs
35989+
checksum: 10c0/ee2126398ab7d1fdde566b4013b68e36930b9e6d8e68b6db356875c99614c10d678b6f45597a145ff6d63814961221fc305bf9242af8bf7450177f8a68537590
35990+
languageName: node
35991+
linkType: hard
35992+
3593935993
"yargs-parser@npm:^21.1.1":
3594035994
version: 21.1.1
3594135995
resolution: "yargs-parser@npm:21.1.1"

0 commit comments

Comments
 (0)