Skip to content

Commit

Permalink
Rework prettier setup (#2677)
Browse files Browse the repository at this point in the history
* Upgrade hustky, lint-staged, and prettier.

Modify lint-staged and prettier configs
Add specific json/geojson formatting rules for prettier

* Apply prettier
  • Loading branch information
mfedderly authored Aug 8, 2024
1 parent 2fbb518 commit 25917d8
Show file tree
Hide file tree
Showing 118 changed files with 14,334 additions and 54,885 deletions.
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"

pnpm lint-staged
15 changes: 1 addition & 14 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
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

# 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/**

pnpm-lock.yaml

/.nx/cache
/.nx/cache
10 changes: 9 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"trailingComma": "es5"
"trailingComma": "es5",
"overrides": [
{
"files": "*.{geojson,json}",
"options": {
"printWidth": 90
}
}
]
}
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@
"lint:mrl": "mrl check",
"lint:prettier": "prettier --check .",
"preinstall": "npx only-allow pnpm",
"prepare": "lerna run build && husky install",
"prepare": "husky && lerna run build",
"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"
"eslint --fix"
],
"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 @@ -50,13 +49,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 @@ -17,10 +17,7 @@
]
},
"bbox": [
6.632039186485088,
46.513552354874435,
6.638240782825051,
46.52452567471025
6.632039186485088, 46.513552354874435, 6.638240782825051, 46.52452567471025
]
},
{
Expand All @@ -38,12 +35,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 @@ -17,10 +17,7 @@
]
},
"bbox": [
6.632039186485088,
46.513552354874435,
6.638240782825051,
46.52452567471025
6.632039186485088, 46.513552354874435, 6.638240782825051, 46.52452567471025
]
},
{
Expand All @@ -38,12 +35,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
@@ -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
Expand Up @@ -6,10 +6,7 @@
"properties": {},
"geometry": {
"type": "MultiPoint",
"coordinates": [
[2.7575683593749996],
[2.5575683593749996, 2.8113711933311403]
]
"coordinates": [[2.7575683593749996], [2.5575683593749996, 2.8113711933311403]]
}
}
]
Expand Down
5 changes: 1 addition & 4 deletions packages/turf-center/test/out/feature-collection.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@
{
"type": "Feature",
"bbox": [
4.8331475257873535,
45.76022171678877,
4.834005832672119,
45.760809294695534
4.8331475257873535, 45.76022171678877, 4.834005832672119, 45.760809294695534
],
"properties": {
"stroke": "#00F",
Expand Down
5 changes: 1 addition & 4 deletions packages/turf-center/test/out/imbalanced-polygon.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@
{
"type": "Feature",
"bbox": [
4.8445844650268555,
45.77258200374433,
4.859304428100585,
45.78494329284938
4.8445844650268555, 45.77258200374433, 4.859304428100585, 45.78494329284938
],
"properties": {
"stroke": "#00F",
Expand Down
7 changes: 1 addition & 6 deletions packages/turf-center/test/out/linestring.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@
},
{
"type": "Feature",
"bbox": [
4.85994815826416,
45.749558161214516,
4.86020565032959,
45.76884015325622
],
"bbox": [4.85994815826416, 45.749558161214516, 4.86020565032959, 45.76884015325622],
"properties": {
"stroke": "#00F",
"stroke-width": 1,
Expand Down
5 changes: 1 addition & 4 deletions packages/turf-center/test/out/point.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@
{
"type": "Feature",
"bbox": [
4.831961989402771,
45.75764678012361,
4.831961989402771,
45.75764678012361
4.831961989402771, 45.75764678012361, 4.831961989402771, 45.75764678012361
],
"properties": {
"stroke": "#00F",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@
{
"type": "Feature",
"bbox": [
122.51953124999999,
-36.10237644873643,
145.283203125,
-18.312810846425442
122.51953124999999, -36.10237644873643, 145.283203125, -18.312810846425442
],
"properties": {
"stroke": "#00F",
Expand Down
5 changes: 1 addition & 4 deletions packages/turf-center/test/out/polygon.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@
{
"type": "Feature",
"bbox": [
4.773387908935547,
45.71337148333104,
4.910373687744141,
45.79398056386735
4.773387908935547, 45.71337148333104, 4.910373687744141, 45.79398056386735
],
"properties": {
"stroke": "#00F",
Expand Down
Loading

0 comments on commit 25917d8

Please sign in to comment.