Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

Copy link
Collaborator Author

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

pnpm lint-staged
17 changes: 4 additions & 13 deletions .prettierignore
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/**
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
22 changes: 17 additions & 5 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"dependsOn": [
"^build"
],
"inputs": [
"default",
"{workspaceRoot}/tsup.config.ts",
Expand All @@ -18,7 +20,9 @@
"{projectRoot}/lib/**",
"{projectRoot}/rollup.config.cjs"
],
"outputs": ["{projectRoot}/dist"],
"outputs": [
"{projectRoot}/dist"
],
"cache": true
},
"test": {
Expand All @@ -28,12 +32,20 @@
"{projectRoot}/test/**",
"{projectRoot}/types.ts"
],
"dependsOn": ["build"],
"dependsOn": [
"build"
],
"cache": true
},
"last-checks": {
"inputs": ["default", "{projectRoot}/test.ts"],
"dependsOn": ["build", "^last-checks"],
"inputs": [
"default",
"{projectRoot}/test.ts"
],
"dependsOn": [
"build",
"^last-checks"
],
"cache": true
}
}
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is duplicate work with the * prettier below.

"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": {
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@
]
]
},
"bbox": [
6.632039186485088,
46.513552354874435,
6.638240782825051,
46.52452567471025
]
"bbox": [6.632039186485088, 46.513552354874435, 6.638240782825051, 46.52452567471025]
},
{
"type": "Feature",
Expand All @@ -38,12 +33,7 @@
]
]
},
"bbox": [
6.626132904233913,
46.51709747623775,
6.645459572232596,
46.52102619404951
]
"bbox": [6.626132904233913, 46.51709747623775, 6.645459572232596, 46.52102619404951]
}
]
}
8 changes: 4 additions & 4 deletions packages/turf-boolean-equal/test/false/linear-rings.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"geometry": {
"type": "LineString",
"coordinates": [
[-53.674866943359375, 28.30135788537988],
[-53.674866943359376, 28.30135788537988],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for checking it out. Modifiying the output values in the formatting step doesn't sound acceptable.

I can also see how this small text matrix before was laid out nicely, and after is non-optimal. Not sure what it looks like if it gets formatted with the default 80 printWidth instead.
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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]
]
}
},
Expand All @@ -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]
]
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-boolean-equal/test/true/linear-rings.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"geometry": {
"type": "LineString",
"coordinates": [
[-53.674866943359375, 28.30135788537988],
[-53.674866943359376, 28.30135788537988],
[-53.337249755859375, 28.47412369059679],
[-53.524017333984375, 28.17492820114568],
[-53.674866943359375, 28.30135788537988]
[-53.674866943359376, 28.30135788537988]
]
}
},
Expand All @@ -20,10 +20,10 @@
"geometry": {
"type": "LineString",
"coordinates": [
[-53.674866943359375, 28.30135788537988],
[-53.674866943359376, 28.30135788537988],
[-53.337249755859375, 28.47412369059679],
[-53.524017333984375, 28.17492820114568],
[-53.674866943359375, 28.30135788537988]
[-53.674866943359376, 28.30135788537988]
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [0.12345678901234567, 0]
"coordinates": [0.12345678901234566, 0]
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@
]
]
},
"bbox": [
6.632039186485088,
46.513552354874435,
6.638240782825051,
46.52452567471025
]
"bbox": [6.632039186485088, 46.513552354874435, 6.638240782825051, 46.52452567471025]
},
{
"type": "Feature",
Expand All @@ -38,12 +33,7 @@
]
]
},
"bbox": [
6.626132904233913,
46.51709747623775,
6.645459572232596,
46.52102619404951
]
"bbox": [6.626132904233913, 46.51709747623775, 6.645459572232596, 46.52102619404951]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"geometry": {
"type": "LineString",
"coordinates": [
[-53.674866943359375, 28.30135788537988],
[-53.674866943359376, 28.30135788537988],
[-53.337249755859375, 28.47412369059679],
[-53.524017333984375, 28.17492820114568],
[-53.674866943359375, 28.30135788537988]
[-53.674866943359376, 28.30135788537988]
]
}
},
Expand All @@ -20,10 +20,10 @@
"geometry": {
"type": "LineString",
"coordinates": [
[-53.674866943359375, 28.30135788537988],
[-53.674866943359376, 28.30135788537988],
[-53.337249755859375, 28.47412369059679],
[-53.524017333984375, 28.17492820114568],
[-53.674866943359375, 28.30135788537988]
[-53.674866943359376, 28.30135788537988]
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-boolean-overlap/test/false/linear-rings.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"geometry": {
"type": "LineString",
"coordinates": [
[-53.674866943359375, 28.30135788537988],
[-53.674866943359376, 28.30135788537988],
[-53.337249755859375, 28.47412369059679],
[-53.524017333984375, 28.17492820114568],
[-53.674866943359375, 28.30135788537988]
[-53.674866943359376, 28.30135788537988]
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-boolean-parallel/test/true/segment1.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"type": "LineString",
"coordinates": [
[0, -4.5],
[-0, 1]
[0, 1]
]
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"type": "Feature",
"properties": {},
"bbox": [
-86.77362442016602,
36.170862616662134,
-86.67303085327148,
36.23084281427824
],
"bbox": [-86.77362442016602, 36.170862616662134, -86.67303085327148, 36.23084281427824],
"geometry": {
"type": "MultiPolygon",
"coordinates": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"type": "Feature",
"properties": {},
"bbox": [
-86.73980712890625,
36.173495506147,
-86.67303085327148,
36.23084281427824
],
"bbox": [-86.73980712890625, 36.173495506147, -86.67303085327148, 36.23084281427824],
"geometry": {
"type": "Polygon",
"coordinates": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "FeatureCollection",
"properties": {
"epsilon": 10e-18
"epsilon": 1e-17
},
"features": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "FeatureCollection",
"properties": {
"epsilon": 10e-17
"epsilon": 1e-16
},
"features": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "MultiPoint",
"coordinates": [
[2.7575683593749996],
[2.5575683593749996, 2.8113711933311403]
[2.5575683593749994, 2.8113711933311403]
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "MultiPoint",
"coordinates": [
[2.7575683593749996, 2.8113711933311403, 1],
[2.5575683593749996, 2.8113711933311403]
[2.5575683593749994, 2.8113711933311403]
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "MultiPoint",
"coordinates": [
[2.7575683593749996, 2.8113711933311403],
[2.5575683593749996, 2.8113711933311403]
[2.5575683593749994, 2.8113711933311403]
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"properties": {},
"geometry": {
"type": "MultiPoint",
"coordinates": [[2, 2]]
"coordinates": [
[2, 2]
]
}
},
{
Expand Down
Loading