Skip to content

Commit

Permalink
feat(prettier): add prettier-plugin-packagejson (levaintech#162)
Browse files Browse the repository at this point in the history
<!--  Thanks for sending a pull request! -->

#### What this PR does / why we need it:

Add `prettier-plugin-packagejson` and also fix how prettier is configure
with lint-staged.
  • Loading branch information
fuxingloh authored Jun 9, 2023
1 parent 183c7ef commit fd651ca
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 32 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
"private": true,
"files": [],
"scripts": {
"prepare": "husky install",
"write": "turbo run write",
"clean": "turbo run clean",
"build": "turbo run build",
"test": "turbo run test",
"clean": "turbo run clean",
"format": "prettier --write .",
"lint": "turbo run lint -- --fix",
"format": "prettier --write ."
"prepare": "husky install",
"test": "turbo run test",
"write": "turbo run write"
},
"lint-staged": {
"*": "prettier --write --ignore-unknown"
},
"prettier": "@birthdayresearch/sticky-prettier",
"devDependencies": {
"@birthdayresearch/eslint-config": "workspace:*",
"@birthdayresearch/sticky-prettier": "workspace:*",
"@birthdayresearch/sticky-turbo": "workspace:*",
"@birthdayresearch/sticky-typescript": "workspace:*"
},
"lint-staged": {
"*": "prettier --write --ignore-unknown"
},
"prettier": "@birthdayresearch/sticky-prettier",
"packageManager": "[email protected]",
"engines": {
"node": "^18.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/sticky-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@birthdayresearch/sticky-docs",
"version": "0.0.0",
"type": "module",
"main": "dist/index.js",
"files": [
"dist"
],
"type": "module",
"main": "dist/index.js",
"scripts": {
"write": "contented write",
"build": "contented build",
"generate": "contented generate",
"build": "contented build"
"write": "contented write"
},
"devDependencies": {
"@birthdayresearch/contented": "1.9.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/sticky-prettier/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module.exports = {
printWidth: 120,
trailingComma: 'all',
singleQuote: true,
plugins: [require('prettier-plugin-tailwindcss')],
plugins: [require('prettier-plugin-tailwindcss'), require('prettier-plugin-packagejson')],
};
1 change: 1 addition & 0 deletions packages/sticky-prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8",
"prettier-plugin-packagejson": "^2.4.3",
"prettier-plugin-tailwindcss": "^0.3.0"
}
}
22 changes: 11 additions & 11 deletions packages/sticky-testcontainers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
"lint": "eslint .",
"test": "jest"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
],
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
]
},
"eslintConfig": {
"parserOptions": {
"project": "./tsconfig.json"
Expand All @@ -30,16 +39,7 @@
},
"devDependencies": {
"@birthdayresearch/sticky-turbo-jest": "workspace:*",
"@birthdayresearch/sticky-typescript": "workspace:*",
"node-fetch": "2.6.7",
"@types/node-fetch": "2.6.2"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
],
"*.{js,jsx,ts,tsx}": [
"eslint --fix"
]
"@types/node-fetch": "2.6.2",
"node-fetch": "2.6.7"
}
}
9 changes: 9 additions & 0 deletions packages/sticky-turbo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
"lint": "eslint .",
"test": "jest"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
],
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
]
},
"eslintConfig": {
"parserOptions": {
"project": "./tsconfig.json"
Expand Down
Loading

0 comments on commit fd651ca

Please sign in to comment.