Skip to content

Commit c568b5d

Browse files
authored
chore: add scripts to format/lint only the delta files (#305)
add scripts to format/lint only the delta files
1 parent 41f84c0 commit c568b5d

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
scripts/*
2+
.eslintignore
3+
.prettierignore
4+
.github/workflows/*
5+
*.md

.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
'plugin:svelte/recommended',
1212
'prettier',
1313
],
14-
plugins: ['svelte', 'simple-import-sort'],
14+
plugins: ['svelte', 'simple-import-sort', 'json-files'],
1515
rules: {
1616
'simple-import-sort/imports': 'error',
1717
},

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
scripts/*
2+
.eslintignore
3+
.prettierignore

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ The module is released automatically from the `main` branch using [semantic-rele
1515

1616
## Development setup
1717

18-
After cloning the repository, use the `setup` script to install development dependencies and the `validate` script to run all checks and tests to verify your setup.
18+
After cloning the repository, install the project's dependencies and run the `validate` script to run all checks and tests to verify your setup.
1919

2020
```shell
21-
npm run setup
21+
npm install # or `pnpm install`, or `yarn install`, etc.
2222
npm run validate
2323
```
2424

@@ -27,13 +27,13 @@ npm run validate
2727
Run auto-formatting to ensure any changes adhere to the code style of the repository:
2828

2929
```shell
30-
npm run format
30+
npm run format:delta
3131
```
3232

3333
To run lint and format checks without making any changes:
3434

3535
```shell
36-
npm run lint
36+
npm run lint:delta
3737
```
3838

3939
### Test

package.json

+9-2
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,19 @@
4444
],
4545
"scripts": {
4646
"toc": "doctoc README.md",
47-
"lint": "(prettier . --check || true) && eslint .",
47+
"lint": "prettier . --check && eslint .",
48+
"lint:delta": "npm-run-all -p prettier:delta eslint:delta",
49+
"prettier:delta": "prettier --check `./scripts/changed-files`",
50+
"eslint:delta": "eslint `./scripts/changed-files`",
4851
"format": "prettier . --write && eslint . --fix",
52+
"format:delta": "npm-run-all format:prettier:delta format:eslint:delta",
53+
"format:prettier:delta": "prettier --write `./scripts/changed-files`",
54+
"format:eslint:delta": "eslint --fix `./scripts/changed-files`",
4955
"test": "vitest run --coverage",
5056
"test:watch": "vitest",
5157
"test:update": "vitest run --update",
5258
"setup": "npm install && npm run validate",
53-
"validate": "npm-run-all lint test",
59+
"validate": "npm-run-all test",
5460
"contributors:add": "all-contributors add",
5561
"contributors:generate": "all-contributors generate"
5662
},
@@ -72,6 +78,7 @@
7278
"eslint-config-prettier": "9.1.0",
7379
"eslint-config-standard": "17.1.0",
7480
"eslint-plugin-import": "2.29.1",
81+
"eslint-plugin-json-files": "^4.1.0",
7582
"eslint-plugin-n": "16.6.2",
7683
"eslint-plugin-promise": "6.1.1",
7784
"eslint-plugin-simple-import-sort": "10.0.0",

scripts/changed-files

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
git diff --name-only --diff-filter=d main

0 commit comments

Comments
 (0)