Skip to content

Commit

Permalink
Tweak Prettier-related setup (#156)
Browse files Browse the repository at this point in the history
* Suggested dev experience fixes

* Bump `@types/prettier`

* remove useUnknown setting

* Update .prettierrc.js

Co-authored-by: Mateusz Burzyński <[email protected]>

Co-authored-by: Mateusz Burzyński <[email protected]>
  • Loading branch information
elliot-nelson and Andarist authored Dec 22, 2022
1 parent bf2013e commit 9237533
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 52 deletions.
14 changes: 14 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Documentation for this file: https://prettier.io/docs/en/configuration.html

/** @type {import('prettier').Options} */
module.exports = {
// Use .gitattributes to manage newlines
endOfLine: "auto",

// Avoid line breaks in markdown
proseWrap: "never",

// Disabling search dirs and pointing directly at plugins to keep configuration explicit
pluginSearchDirs: false,
plugins: [require("prettier-plugin-packagejson")],
};
28 changes: 13 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
"packages/*",
"test-gatsby"
],
"scripts": {
"postinstall": "preconstruct dev && manypkg check",
"release": "yarn preconstruct build && yarn changeset publish",
"test": "jest",
"test-gatsby": "cd test-gatsby && gatsby develop"
},
"jest": {
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
},
"dependencies": {
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
Expand All @@ -22,26 +34,12 @@
"jest-watch-typeahead": "^0.6.0",
"preconstruct": "^0.0.89",
"prettier": "^2.8.1",
"prettier-plugin-packagejson": "^2.3.0",
"typescript": "^4.9.4"
},
"jest": {
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
},
"preconstruct": {
"packages": [
"packages/!(gatsby)*"
]
},
"prettier": {
"proseWrap": "never"
},
"scripts": {
"postinstall": "preconstruct dev && manypkg check",
"release": "yarn preconstruct build && yarn changeset publish",
"test-gatsby": "cd test-gatsby && gatsby develop",
"test": "jest"
}
}
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@manypkg/cli",
"version": "0.19.2",
"repository": {
"type": "git",
"url": "https://github.com/Thinkmill/manypkg.git",
"directory": "packages/cli"
},
"version": "0.19.2",
"license": "MIT",
"main": "dist/cli.cjs.js",
"module": "dist/cli.esm.js",
"license": "MIT",
"bin": {
"manypkg": "./bin.js"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/find-root/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@manypkg/find-root",
"version": "1.1.0",
"license": "MIT",
"main": "dist/find-root.cjs.js",
"module": "dist/find-root.esm.js",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.20.6",
"@types/node": "^12.7.1",
Expand Down
36 changes: 18 additions & 18 deletions packages/gatsby-source-workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// gatsby-config.js

module.exports = {
plugins: [{ resolve: "@manypkg/gatsby-source-workspace" }]
plugins: [{ resolve: "@manypkg/gatsby-source-workspace" }],
};
```

Expand Down Expand Up @@ -42,10 +42,10 @@ module.exports = {
{
resolve: "@manypkg/gatsby-source-workspace",
options: {
workspaceFilter: workspace => !workspace.packageJSON.private
}
}
]
workspaceFilter: (workspace) => !workspace.packageJSON.private,
},
},
],
};
```

Expand All @@ -71,12 +71,12 @@ module.exports = {
extraFields: [
{
name: "license",
definition: `String`
}
]
}
}
]
definition: `String`,
},
],
},
},
],
};
```

Expand Down Expand Up @@ -113,13 +113,13 @@ module.exports = {
{
name: "readme",
definition: `String`,
getFieldInfo: async ws =>
await fs.readFile(path.join(ws.dir, "README.md"), "utf-8")
}
]
}
}
]
getFieldInfo: async (ws) =>
await fs.readFile(path.join(ws.dir, "README.md"), "utf-8"),
},
],
},
},
],
};
```

Expand Down
22 changes: 11 additions & 11 deletions packages/gatsby-source-workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"name": "@manypkg/gatsby-source-workspace",
"version": "0.4.1",
"license": "MIT",
"peerDependencies": {
"gatsby": "^2.15.28"
"files": [
"gatsby-node.js",
"index.js"
],
"dependencies": {
"find-workspaces-root": "^0.2.0",
"fs-extra": "^8.1.0",
"get-workspaces": "^0.6.0"
},
"devDependencies": {
"gatsby": "^2.15.28",
"react": "^16.10.1",
"react-dom": "^16.10.1"
},
"dependencies": {
"find-workspaces-root": "^0.2.0",
"fs-extra": "^8.1.0",
"get-workspaces": "^0.6.0"
},
"files": [
"gatsby-node.js",
"index.js"
]
"peerDependencies": {
"gatsby": "^2.15.28"
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

Expand Down
56 changes: 52 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2848,9 +2848,9 @@
"@types/node" "*"

"@types/prettier@^2.0.0":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.0.2.tgz#5bb52ee68d0f8efa9cc0099920e56be6cc4e37f3"
integrity sha512-IkVfat549ggtkZUthUzEX49562eGikhSYeVGX97SkMFn+sTZrgRewXjQ4tPKFPCykZHkX1Zfd9OoELGqKU2jJA==
version "2.7.2"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.2.tgz#6c2324641cc4ba050a8c710b2b251b377581fbf0"
integrity sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==

"@types/prop-types@*":
version "15.7.3"
Expand Down Expand Up @@ -5747,7 +5747,7 @@ detect-libc@^1.0.2:
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=

detect-newline@^3.0.0:
detect-newline@3.1.0, detect-newline@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651"
integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==
Expand Down Expand Up @@ -7607,6 +7607,11 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"

[email protected]:
version "1.0.3"
resolved "https://registry.yarnpkg.com/git-hooks-list/-/git-hooks-list-1.0.3.tgz#be5baaf78203ce342f2f844a9d2b03dba1b45156"
integrity sha512-Y7wLWcrLUXwk2noSka166byGCvhMtDRpgHdzCno1UQv/n/Hegp++a2xBWJL1lJarnKD3SWaljD+0z1ztqxuKyQ==

[email protected]:
version "4.0.1"
resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.1.tgz#cb2ef086653640e721d2042fe3104857d89007c0"
Expand Down Expand Up @@ -7694,6 +7699,20 @@ globals@^11.1.0, globals@^11.7.0:
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==

[email protected]:
version "10.0.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.0.tgz#abfcd0630037ae174a88590132c2f6804e291072"
integrity sha512-3LifW9M4joGZasyYPz2A1U74zbC/45fvpXUvO/9KbSa+VV0aGZarWkfdgKyR9sExNP0t0x0ss/UMJpNpcaTspw==
dependencies:
"@types/glob" "^7.1.1"
array-union "^2.1.0"
dir-glob "^3.0.1"
fast-glob "^3.0.3"
glob "^7.1.3"
ignore "^5.1.1"
merge2 "^1.2.3"
slash "^3.0.0"

globby@^10.0.1:
version "10.0.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22"
Expand Down Expand Up @@ -9031,6 +9050,11 @@ is-path-inside@^3.0.1:
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017"
integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==

[email protected]:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==

is-plain-obj@^1.0.0, is-plain-obj@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
Expand Down Expand Up @@ -12361,6 +12385,13 @@ prepend-http@^2.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=

prettier-plugin-packagejson@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.3.0.tgz#5c242a39627c227d813161618fa88e64e44e9c84"
integrity sha512-2SAPMMk1UDkqsB7DifWKcwCm6VC52JXMrzLHfbcQHJRWhRCj9zziOy+s+2XOyPBeyqFqS+A/1IKzOrxKFTo6pw==
dependencies:
sort-package-json "1.57.0"

prettier@^1.18.2:
version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
Expand Down Expand Up @@ -14041,6 +14072,23 @@ sort-keys@^2.0.0:
dependencies:
is-plain-obj "^1.0.0"

sort-object-keys@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45"
integrity sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==

[email protected]:
version "1.57.0"
resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-1.57.0.tgz#e95fb44af8ede0bb6147e3f39258102d4bb23fc4"
integrity sha512-FYsjYn2dHTRb41wqnv+uEqCUvBpK3jZcTp9rbz2qDTmel7Pmdtf+i2rLaaPMRZeSVM60V3Se31GyWFpmKs4Q5Q==
dependencies:
detect-indent "^6.0.0"
detect-newline "3.1.0"
git-hooks-list "1.0.3"
globby "10.0.0"
is-plain-obj "2.1.0"
sort-object-keys "^1.1.3"

source-list-map@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.2.tgz#9889019d1024cce55cdc069498337ef6186a11a1"
Expand Down

0 comments on commit 9237533

Please sign in to comment.