chore: add lint-staged and husky

This commit is contained in:
Théo LUDWIG 2024-02-16 23:06:23 +01:00
parent edd662ce44
commit 90de51914d
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
8 changed files with 1969 additions and 2 deletions

1
.commitlintrc.json Normal file
View File

@ -0,0 +1 @@
{ "extends": ["@commitlint/config-conventional"] }

1
.gitignore vendored
View File

@ -37,6 +37,7 @@ yarn-error.*
# tests # tests
coverage/ coverage/
junit.xml
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb # @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
# The following patterns were generated by expo-cli # The following patterns were generated by expo-cli

3
.husky/commit-msg Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
npm run lint:commit -- --edit

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
npm run lint:staged
npm run lint:typescript

4
.lintstagedrc.json Normal file
View File

@ -0,0 +1,4 @@
{
"**/*": ["prettier --write --ignore-unknown"],
"**/*.{js,jsx,ts,tsx}": ["eslint --fix --report-unused-disable-directives"]
}

View File

@ -22,7 +22,7 @@ exports[`<HomePage /> renders correctly 1`] = `
style={ style={
{ {
"color": "#006CFF", "color": "#006CFF",
"fontFamily": "Georama", "fontFamily": "Canterbury",
"fontSize": 36, "fontSize": 36,
"marginVertical": 20, "marginVertical": 20,
} }

1946
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,13 @@
"android": "expo start --android", "android": "expo start --android",
"ios": "expo start --ios", "ios": "expo start --ios",
"web": "expo start --web", "web": "expo start --web",
"lint:commit": "commitlint",
"lint:prettier": "prettier . --check", "lint:prettier": "prettier . --check",
"lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives --ignore-path .gitignore", "lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives --ignore-path .gitignore",
"lint:typescript": "tsc --noEmit", "lint:typescript": "tsc --noEmit",
"test": "jest" "lint:staged": "lint-staged",
"test": "jest --coverage --reporters=default --reporters=jest-junit",
"postinstall": "husky"
}, },
"dependencies": { "dependencies": {
"@expo/vector-icons": "14.0.0", "@expo/vector-icons": "14.0.0",
@ -34,6 +37,8 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.23.9", "@babel/core": "7.23.9",
"@commitlint/cli": "18.6.1",
"@commitlint/config-conventional": "18.6.2",
"@testing-library/react-native": "12.4.3", "@testing-library/react-native": "12.4.3",
"@total-typescript/ts-reset": "0.5.1", "@total-typescript/ts-reset": "0.5.1",
"@tsconfig/strictest": "2.0.3", "@tsconfig/strictest": "2.0.3",
@ -52,8 +57,11 @@
"eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-native": "4.1.0", "eslint-plugin-react-native": "4.1.0",
"eslint-plugin-unicorn": "51.0.1", "eslint-plugin-unicorn": "51.0.1",
"husky": "9.0.11",
"jest": "29.7.0", "jest": "29.7.0",
"jest-expo": "50.0.2", "jest-expo": "50.0.2",
"jest-junit": "16.0.0",
"lint-staged": "15.2.2",
"react-test-renderer": "18.2.0", "react-test-renderer": "18.2.0",
"typescript": "5.3.3" "typescript": "5.3.3"
} }