Skip to content

Commit

Permalink
Merged PR 10062: Add pre-commit Husky
Browse files Browse the repository at this point in the history
Adds husky pre-commit + config files.

- Using `lint-staged` rather than `pretty-quick` (as in other projects), as pretty-quick might no longer be in development, and is [not compatible with prettier > 3](prettier/pretty-quick#164).
- Add vscode workspace extension recommendations

Related work items: #129654
  • Loading branch information
Andy Rae authored and Andy Rae committed Oct 24, 2023
2 parents 30ea67c + 923bcfc commit 4459388
Show file tree
Hide file tree
Showing 10 changed files with 4,522 additions and 13 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.yaml
@@ -0,0 +1,28 @@
env:
browser: true
node: true
es2021: true
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
- plugin:@next/next/recommended
plugins:
- prettier
- '@typescript-eslint'
parserOptions:
ecmaVersion: 2021
sourceType: module
ecmaFeatures:
jsx: true
rules:
react/react-in-jsx-scope: 0
react/jsx-uses-react: 0
react/prop-types: 0
eslint/no-unused-vars: 0
prettier/prettier:
- warn
- endOfLine: auto
'@typescript-eslint/no-unused-vars': warn
settings:
next:
rootDir: app/client-app/
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint-staged
5 changes: 5 additions & 0 deletions .lintstagedrc.yaml
@@ -0,0 +1,5 @@
'**/*.ts?(x)':
- 'prettier --write'
- 'eslint'
'./*.md':
- 'prettier --write'
3 changes: 3 additions & 0 deletions .prettierrc.yaml
@@ -0,0 +1,3 @@
trailingComma: "es5"
tabWidth: 2
semi: true
7 changes: 7 additions & 0 deletions .vscode/monitor.code-workspace
Expand Up @@ -21,4 +21,11 @@
"path": "../app/Monitor"
},
],
"extensions": {
"recommendations": [
"ms-azuretools.vscode-bicep",
"davidanson.vscode-markdownlint",
"esbenp.prettier-vscode"
]
}
}
3 changes: 0 additions & 3 deletions app/client-app/.eslintrc.json

This file was deleted.

10 changes: 5 additions & 5 deletions app/client-app/app/page.tsx
@@ -1,14 +1,14 @@
import { css } from "@/styled-system/css";
import { css } from '@/styled-system/css';

export default function Home() {
return (
<>
<h2
className={css({
m: "10px",
p: "10px",
fontSize: "30px",
fontWeight: "500"
m: '10px',
p: '10px',
fontSize: '30px',
fontWeight: '500',
})}
>
Welcome.
Expand Down
5 changes: 3 additions & 2 deletions app/client-app/package.json
Expand Up @@ -8,7 +8,8 @@
"build": "next build",
"localStart": "next start",
"start": "./node_modules/next/dist/bin/next start",
"lint": "next lint"
"lint": "next lint",
"type-check": "tsc --project tsconfig.json --pretty --noEmit && echo "
},
"dependencies": {
"@radix-ui/react-label": "^2.0.2",
Expand All @@ -34,4 +35,4 @@
"@pandacss/dev": "^0.13.1",
"@shadow-panda/preset": "^0.6.0"
}
}
}

0 comments on commit 4459388

Please sign in to comment.