Skip to content

Commit

Permalink
add hook for code check and format
Browse files Browse the repository at this point in the history
  • Loading branch information
shanquan954 committed Dec 23, 2023
1 parent 4dfe634 commit c188493
Show file tree
Hide file tree
Showing 9 changed files with 1,974 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["airbnb-base", "prettier", "plugin:prettier/recommended"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {},
};
2 changes: 1 addition & 1 deletion .github/workflows/learn-github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: "14"
- run: npm install -g bats
- run: bats -v
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.js": ["eslint", "prettier --write"],
"*.{js,ts,json,html}": "prettier --write"
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
console.log("test");
function main() {
console.log("test");
}
main();
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
},
"homepage": "https://github.com/shanquan954/test#readme",
"devDependencies": {
"husky": "^8.0.3"
"eslint": "^7.32.0 || ^8.2.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^5.1.1",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"prettier": "3.1.1"
}
}
Loading

0 comments on commit c188493

Please sign in to comment.