Skip to content

Commit e21f266

Browse files
Merge pull request #352 from tcet-opensource/349-configure-prettier
Install and configure prettier alongside eslint
2 parents 9c1f945 + 4a40e31 commit e21f266

File tree

6 files changed

+477
-7
lines changed

6 files changed

+477
-7
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
es2021: true,
55
jest: true
66
},
7-
extends: "airbnb-base",
7+
extends: ["airbnb-base", "prettier"],
88
overrides: [],
99
parserOptions: {
1010
ecmaVersion: "latest",

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/node_modules
2+
**/apidoc
3+
**/.git
4+
**/_apidoc.js
5+
**/*.json
6+
**/*.css
7+
Dockerfile

.prettierrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2-
"singleQuote": true,
3-
"tabWidth": 2
2+
"singleQuote": false,
3+
"tabWidth": 2,
4+
"semi": true
45
}

hooks/pre-commit

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ do
99
# Get staged content of the file
1010
staged_content=$(git show ":$file")
1111

12+
# Format staged files
13+
npx prettier --write $file
14+
1215
# Run ESLint with the staged content and filename
1316
# echo "$staged_content" | npm run eslint -- --stdin
1417
npx eslint $file
@@ -20,4 +23,4 @@ done
2023

2124
if [ $flag -eq 1 ]; then
2225
exit 1
23-
fi
26+
fi

0 commit comments

Comments
 (0)