Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested fixes to tsconfig, prettier config #156

Merged
merged 5 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Documentation for this file: https://prettier.io/docs/en/configuration.html
module.exports = {
// Use .gitattributes to manage newlines
endOfLine: "auto",

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

// Prettier plugins
//
// Disabling search dirs and pointing directly at folder paths relative to this config file
// makes it easier for VSCode and WebStorm to find your plugins.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting - do you happen to have a link to some issues related to this? I'm just curious why the automatic plugin search tends to fail in those contexts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you've challenged me on it, I suspect that this is a defense mechanism for Rush in particular.

If you have a Lerna repo or something and you use a root-level package.json to keep your prettier devDependency, which lives in a root-level node_modules, then I think 99.9% of the time VSCode would "do the right thing".

But in a Rush repo, there is no root package or node modules, and plugins are kept in a special folder; VSCode typically can't find this folder unless you specify exactly where it is. I can test out simplifying this for this repo since it probably would work just fine.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ye - this might makes sense in the context of Rush if the location of plugins etc is not standard. That being said, I prefer an explicit list of plugins rather than one based on auto-search.

pluginSearchDirs: [],
plugins: ["./node_modules/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"
},
Comment on lines -38 to -40
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in the "explicit configs camp" too 👍

"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"
}
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@
// "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. */
"useUnknownInCatchVariables": false
elliot-nelson marked this conversation as resolved.
Show resolved Hide resolved

/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
Expand Down
50 changes: 49 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
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