-
Notifications
You must be signed in to change notification settings - Fork 995
Rework prettier setup #2670
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
Rework prettier setup #2670
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| pnpm lint-staged | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,14 @@ | ||
| dist | ||
| *.md | ||
| node_modules | ||
| tsconfig.json | ||
| lerna.json | ||
|
|
||
| # slow | ||
| packages/turf-directional-mean/test/in/bus_route_gps.json | ||
| packages/turf-directional-mean/test/in/bus_route_utm.json | ||
| # handled separately | ||
| *.geojson | ||
| *.json | ||
|
|
||
| # is actually output | ||
| packages/turf/turf.min.js | ||
|
|
||
| # Ignore test fixture json in case intentional line breaks help with coord | ||
| # readability. | ||
| packages/turf-*/test/in/** | ||
| packages/turf-*/test/out/** | ||
| packages/turf-*/test/true/** | ||
| packages/turf-*/test/false/** | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We were actually intentionally ignoring the json/geojson files in the test directories I believe for whitespace reasons. I changed prettier to target longer lines which is maybe a better compromise with readability and gets us back to being standardized. |
||
|
|
||
| pnpm-lock.yaml | ||
|
|
||
| /.nx/cache | ||
| /.nx/cache | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,21 +12,23 @@ | |
| "lint:mrl": "mrl check", | ||
| "lint:prettier": "prettier --check .", | ||
| "preinstall": "npx only-allow pnpm", | ||
| "prepare": "lerna run build && husky install", | ||
| "prepare": "husky && lerna run build", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run the husky setup code before the build that people ctrl+c |
||
| "test": "pnpm run lint && lerna run test && lerna run --scope @turf/turf last-checks" | ||
| }, | ||
| "lint-staged": { | ||
| "package.json": [ | ||
| "mrl check --paths" | ||
| ], | ||
| "**/*.{js,ts}": [ | ||
| "eslint --fix", | ||
| "prettier --write" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is duplicate work with the |
||
| "eslint --fix" | ||
| ], | ||
| "**/*.{json,geojson}": [ | ||
| "pnpm tsx ./scripts/format-json.ts" | ||
| ], | ||
| "packages/*/index.{js,ts}": [ | ||
| "pnpm tsx ./scripts/generate-readmes" | ||
| ], | ||
| "**/*": "prettier --write --ignore-unknown" | ||
| "*": "prettier --write --ignore-unknown" | ||
| }, | ||
| "packageManager": "pnpm@8.15.8+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392", | ||
| "devDependencies": { | ||
|
|
@@ -51,13 +53,13 @@ | |
| "esm": "^3.2.25", | ||
| "fs-extra": "^11.1.1", | ||
| "glob": "^10.3.10", | ||
| "husky": "^8.0.0", | ||
| "husky": "^9.0.0", | ||
| "lerna": "^8.1.7", | ||
| "lint-staged": "^10.5.4", | ||
| "lint-staged": "^15.2.8", | ||
| "load-json-file": "^7.0.1", | ||
| "meow": "^12.1.1", | ||
| "npm-run-all": "^4.1.5", | ||
| "prettier": "^3.0.3", | ||
| "prettier": "^3.3.3", | ||
| "progress": "^2.0.3", | ||
| "ts-node": "^9.0.0", | ||
| "tsup": "^8.0.1", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,10 +7,10 @@ | |
| "geometry": { | ||
| "type": "LineString", | ||
| "coordinates": [ | ||
| [-53.674866943359375, 28.30135788537988], | ||
| [-53.674866943359376, 28.30135788537988], | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the round trip of JSON.parse/stringify is modifying these which is a little scary. I think the tests all still pass though.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Everything is going to have tradeoffs. But not automatically formatting these things isn't really an option because we can't review PRs cleanly otherwise. Here's prettier with the default printWidth #2677 |
||
| [-53.337249755859375, 28.47412369059679], | ||
| [-53.524017333984375, 28.17492820114568], | ||
| [-53.674866943359375, 28.30135788537988] | ||
| [-53.674866943359376, 28.30135788537988] | ||
| ] | ||
| } | ||
| }, | ||
|
|
@@ -20,10 +20,10 @@ | |
| "geometry": { | ||
| "type": "LineString", | ||
| "coordinates": [ | ||
| [-55.674866943359375, 28.30135788537988], | ||
| [-55.674866943359376, 28.30135788537988], | ||
| [-55.337249755859375, 28.47412369059679], | ||
| [-55.524017333984375, 28.17492820114568], | ||
| [-55.674866943359375, 28.30135788537988] | ||
| [-55.674866943359376, 28.30135788537988] | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ | |
| "type": "LineString", | ||
| "coordinates": [ | ||
| [0, -4.5], | ||
| [-0, 1] | ||
| [0, 1] | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| { | ||
| "type": "FeatureCollection", | ||
| "properties": { | ||
| "epsilon": 10e-18 | ||
| "epsilon": 1e-17 | ||
| }, | ||
| "features": [ | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| { | ||
| "type": "FeatureCollection", | ||
| "properties": { | ||
| "epsilon": 10e-17 | ||
| "epsilon": 1e-16 | ||
| }, | ||
| "features": [ | ||
| { | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ I believe this block is no longer required in husky 9