Skip to content

Commit 25917d8

Browse files
authored
Rework prettier setup (#2677)
* Upgrade hustky, lint-staged, and prettier. Modify lint-staged and prettier configs Add specific json/geojson formatting rules for prettier * Apply prettier
1 parent 2fbb518 commit 25917d8

File tree

118 files changed

+14334
-54885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+14334
-54885
lines changed

.husky/pre-commit

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
pnpm lint-staged

.prettierignore

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
dist
22
*.md
33
node_modules
4-
tsconfig.json
5-
lerna.json
6-
7-
# slow
8-
packages/turf-directional-mean/test/in/bus_route_gps.json
9-
packages/turf-directional-mean/test/in/bus_route_utm.json
104

115
# is actually output
126
packages/turf/turf.min.js
137

14-
# Ignore test fixture json in case intentional line breaks help with coord
15-
# readability.
16-
packages/turf-*/test/in/**
17-
packages/turf-*/test/out/**
18-
packages/turf-*/test/true/**
19-
packages/turf-*/test/false/**
20-
218
pnpm-lock.yaml
229

23-
/.nx/cache
10+
/.nx/cache

.prettierrc.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
2-
"trailingComma": "es5"
2+
"trailingComma": "es5",
3+
"overrides": [
4+
{
5+
"files": "*.{geojson,json}",
6+
"options": {
7+
"printWidth": 90
8+
}
9+
}
10+
]
311
}

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,20 @@
1212
"lint:mrl": "mrl check",
1313
"lint:prettier": "prettier --check .",
1414
"preinstall": "npx only-allow pnpm",
15-
"prepare": "lerna run build && husky install",
15+
"prepare": "husky && lerna run build",
1616
"test": "pnpm run lint && lerna run test && lerna run --scope @turf/turf last-checks"
1717
},
1818
"lint-staged": {
1919
"package.json": [
2020
"mrl check --paths"
2121
],
2222
"**/*.{js,ts}": [
23-
"eslint --fix",
24-
"prettier --write"
23+
"eslint --fix"
2524
],
2625
"packages/*/index.{js,ts}": [
2726
"pnpm tsx ./scripts/generate-readmes"
2827
],
29-
"**/*": "prettier --write --ignore-unknown"
28+
"*": "prettier --write --ignore-unknown"
3029
},
3130
"packageManager": "[email protected]+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392",
3231
"devDependencies": {
@@ -50,13 +49,13 @@
5049
"esm": "^3.2.25",
5150
"fs-extra": "^11.1.1",
5251
"glob": "^10.3.10",
53-
"husky": "^8.0.0",
52+
"husky": "^9.0.0",
5453
"lerna": "^8.1.7",
55-
"lint-staged": "^10.5.4",
54+
"lint-staged": "^15.2.8",
5655
"load-json-file": "^7.0.1",
5756
"meow": "^12.1.1",
5857
"npm-run-all": "^4.1.5",
59-
"prettier": "^3.0.3",
58+
"prettier": "^3.3.3",
6059
"progress": "^2.0.3",
6160
"ts-node": "^9.0.0",
6261
"tsup": "^8.0.1",

packages/turf-boolean-disjoint/test/false/Polygon/Polygon/issue-1216.geojson

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
]
1818
},
1919
"bbox": [
20-
6.632039186485088,
21-
46.513552354874435,
22-
6.638240782825051,
23-
46.52452567471025
20+
6.632039186485088, 46.513552354874435, 6.638240782825051, 46.52452567471025
2421
]
2522
},
2623
{
@@ -38,12 +35,7 @@
3835
]
3936
]
4037
},
41-
"bbox": [
42-
6.626132904233913,
43-
46.51709747623775,
44-
6.645459572232596,
45-
46.52102619404951
46-
]
38+
"bbox": [6.626132904233913, 46.51709747623775, 6.645459572232596, 46.52102619404951]
4739
}
4840
]
4941
}

packages/turf-boolean-intersects/test/true/Polygon/Polygon/issue-1216.geojson

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
]
1818
},
1919
"bbox": [
20-
6.632039186485088,
21-
46.513552354874435,
22-
6.638240782825051,
23-
46.52452567471025
20+
6.632039186485088, 46.513552354874435, 6.638240782825051, 46.52452567471025
2421
]
2522
},
2623
{
@@ -38,12 +35,7 @@
3835
]
3936
]
4037
},
41-
"bbox": [
42-
6.626132904233913,
43-
46.51709747623775,
44-
6.645459572232596,
45-
46.52102619404951
46-
]
38+
"bbox": [6.626132904233913, 46.51709747623775, 6.645459572232596, 46.52102619404951]
4739
}
4840
]
4941
}

packages/turf-boolean-point-in-polygon/test/in/multipoly-with-hole.geojson

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
{
22
"type": "Feature",
33
"properties": {},
4-
"bbox": [
5-
-86.77362442016602,
6-
36.170862616662134,
7-
-86.67303085327148,
8-
36.23084281427824
9-
],
4+
"bbox": [-86.77362442016602, 36.170862616662134, -86.67303085327148, 36.23084281427824],
105
"geometry": {
116
"type": "MultiPolygon",
127
"coordinates": [

packages/turf-boolean-point-in-polygon/test/in/poly-with-hole.geojson

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
{
22
"type": "Feature",
33
"properties": {},
4-
"bbox": [
5-
-86.73980712890625,
6-
36.173495506147,
7-
-86.67303085327148,
8-
36.23084281427824
9-
],
4+
"bbox": [-86.73980712890625, 36.173495506147, -86.67303085327148, 36.23084281427824],
105
"geometry": {
116
"type": "Polygon",
127
"coordinates": [

packages/turf-boolean-valid/test/false/MultiPoint/multipoint.geojson

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
"properties": {},
77
"geometry": {
88
"type": "MultiPoint",
9-
"coordinates": [
10-
[2.7575683593749996],
11-
[2.5575683593749996, 2.8113711933311403]
12-
]
9+
"coordinates": [[2.7575683593749996], [2.5575683593749996, 2.8113711933311403]]
1310
}
1411
}
1512
]

packages/turf-center/test/out/feature-collection.geojson

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@
117117
{
118118
"type": "Feature",
119119
"bbox": [
120-
4.8331475257873535,
121-
45.76022171678877,
122-
4.834005832672119,
123-
45.760809294695534
120+
4.8331475257873535, 45.76022171678877, 4.834005832672119, 45.760809294695534
124121
],
125122
"properties": {
126123
"stroke": "#00F",

0 commit comments

Comments
 (0)