Skip to content

Commit 6f97026

Browse files
chore: add pre commit husky setup (#2195)
1 parent 4d6c42a commit 6f97026

6 files changed

Lines changed: 38 additions & 2 deletions

File tree

astro/.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cd astro
2+
node --run lint-staged

astro/.lintstagedrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{js,jsx,ts,tsx,astro}": ["eslint --fix", "prettier --write"],
3+
"*.{json,md,css,mjs}": ["prettier --write"]
4+
}

astro/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ The expressjs.com website supports multiple languages through a combination of A
377377

378378
We use Crowdin to manage our translations in multiple languages and to enable automatic translation with artificial intelligence. Since AI translations can be imperfect, we welcome community contributions to improve translation accuracy and quality.
379379

380-
#### How to contribute translations
380+
### How to translate
381381

382382
1. Request to join the [Express.js Website project on Crowdin](https://express.crowdin.com/website)
383383
2. [Select the language you want to translate](https://support.crowdin.com/for-translators/#starting-translation)

astro/eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default [
1616
...globals.node,
1717
},
1818
},
19+
ignores: ['dist/', '.astro/', 'node_modules/', 'package-lock.json'],
1920
},
2021

2122
// Base ESLint recommended rules

astro/package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

astro/package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"format": "prettier --write .",
1313
"format:check": "prettier --check .",
1414
"check": "npm run format:check && npm run lint",
15-
"fix": "npm run format && npm run lint:fix"
15+
"fix": "npm run format && npm run lint:fix",
16+
"prepare": "cd .. && husky astro/.husky",
17+
"lint-staged": "lint-staged"
1618
},
1719
"dependencies": {
1820
"@astrojs/mdx": "^4.3.13",
@@ -54,6 +56,7 @@
5456
"eslint-plugin-astro": "^1.5.0",
5557
"eslint-plugin-jsx-a11y": "^6.10.2",
5658
"globals": "^17.4.0",
59+
"husky": "^9.1.7",
5760
"lint-staged": "^16.2.7",
5861
"postcss-custom-media": "^12.0.0",
5962
"postcss-nested": "^7.0.2",
@@ -63,5 +66,14 @@
6366
"typescript-eslint": "^8.53.1",
6467
"unplugin-icons": "^23.0.1",
6568
"vite-plugin-svgr": "^4.5.0"
69+
},
70+
"lint-staged": {
71+
"*.{js,jsx,ts,tsx,astro}": [
72+
"eslint --fix",
73+
"prettier --write"
74+
],
75+
"*.{json,md,css}": [
76+
"prettier --write"
77+
]
6678
}
6779
}

0 commit comments

Comments
 (0)