Skip to content

Commit

Permalink
public-hoist all eslint packages (#3781)
Browse files Browse the repository at this point in the history
I'd like to make our dependencies easier to understand. Currently, all of our package.json files reference a bunch of eslint configs and plugins that they don't explicitly use in their eslint configs. Why? Because they are referenced in eslint-plugin-vx and eslint is not able to resolve the packages if they're not in a flat node module structure (like npm). To replicate this with pnpm, we "publicly hoist" all eslint packages. This is the default config that pnpm now ships with. All publicly hoisted packages exist in a flat node modules directory at the root of the repo.

My goal is two-fold:
- make the package.json more informative by only including explicitly referenced packages
- avoid drifting versions of eslint. there were places in the repo where we had upgraded plugin dependencies of eslint-plugin-vx but hadn't upgraded those plugins in other packages, meaning linting was not getting bug fixes / improvements in those packages as intended
  • Loading branch information
adghayes authored Aug 2, 2023
1 parent 13191ad commit f18cea7
Show file tree
Hide file tree
Showing 50 changed files with 125 additions and 2,236 deletions.
9 changes: 6 additions & 3 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
# it might get the wrong version of.
hoist = false

# We _do_ try to hoist `@types` packages so that TS will not end up with type
# errors from comparing types from different versions of the same package.
public-hoist-pattern=['@types/*']
# From `pnpm` docs on `public-hoist-pattern`: "This setting is useful when dealing
# with some flawed pluggable tools that don't resolve dependencies properly." These
# tools all fit that description.
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*stylelint*

auto-install-peers=true

Expand Down
11 changes: 1 addition & 10 deletions apps/admin/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,9 @@
"@types/tmp": "^0.2.3",
"@types/uuid": "^8.3.4",
"@types/zip-stream": "workspace:0.0.1-development",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"@votingworks/test-utils": "workspace:*",
"esbuild": "^0.14.29",
"esbuild-runner": "^2.2.1",
"eslint": "8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-vx": "workspace:*",
"fast-check": "2.23.2",
"is-ci-cli": "^2.1.2",
Expand All @@ -99,8 +91,7 @@
"nodemon": "^2.0.20",
"sort-package-json": "^1.50.0",
"supertest": "^6.0.1",
"ts-jest": "^29.1.1",
"typescript": "4.6.3"
"ts-jest": "^29.1.1"
},
"engines": {
"node": ">= 16"
Expand Down
17 changes: 1 addition & 16 deletions apps/admin/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
"style-loader": "1.3.0",
"styled-components": "^5.2.1",
"ts-pnp": "1.2.0",
"typescript": "4.6.3",
"url-loader": "4.1.1",
"use-interval": "^1.2.1",
"util": "^0.12.4",
Expand All @@ -153,25 +152,11 @@
"@types/testing-library__jest-dom": "^5.14.3",
"@types/uuid": "^8.3.4",
"@types/zip-stream": "workspace:*",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"@vitejs/plugin-react": "^1.3.2",
"@votingworks/admin-backend": "workspace:*",
"@votingworks/grout-test-utils": "workspace:*",
"@votingworks/monorepo-utils": "workspace:*",
"@votingworks/test-utils": "workspace:*",
"eslint": "8.23.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.1",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^5.6.4",
"eslint-plugin-vx": "workspace:*",
"express": "^4.18.1",
"glob": "^8.0.3",
Expand All @@ -196,4 +181,4 @@
"../backend"
]
}
}
}
12 changes: 1 addition & 11 deletions apps/admin/integration-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,12 @@
},
"devDependencies": {
"@types/node": "16.18.23",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"concurrently": "^7.6.0",
"eslint": "8.23.1",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "^2.1.2",
"lint-staged": "^11.0.0",
"sort-package-json": "^1.50.0",
"typescript": "4.6.3"
"sort-package-json": "^1.50.0"
},
"packageManager": "[email protected]"
}
11 changes: 1 addition & 10 deletions apps/central-scan/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,8 @@
"@types/tmp": "^0.2.0",
"@types/uuid": "^8.3.0",
"@types/zip-stream": "workspace:*",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"esbuild": "^0.14.29",
"esbuild-runner": "^2.2.1",
"eslint": "8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-vx": "workspace:*",
"fast-check": "2.23.2",
"get-port": "5",
Expand All @@ -106,8 +98,7 @@
"nodemon": "^2.0.20",
"sort-package-json": "^1.50.0",
"supertest": "^6.0.1",
"ts-jest": "29.0.5",
"typescript": "4.6.3"
"ts-jest": "29.0.5"
},
"engines": {
"node": ">= 12"
Expand Down
15 changes: 0 additions & 15 deletions apps/central-scan/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
"last 1 safari version"
]
},
"eslintConfig": {
"extends": "react-app"
},
"dependencies": {
"@tanstack/react-query": "^4.22.0",
"@types/jest": "^29.5.3",
Expand Down Expand Up @@ -85,7 +82,6 @@
"setimmediate": "^1.0.5",
"styled-components": "^5.2.1",
"ts-jest": "^29.1.1",
"typescript": "4.6.3",
"use-interval": "^1.2.1",
"zod": "3.14.4"
},
Expand All @@ -103,8 +99,6 @@
"@types/setimmediate": "^1.0.2",
"@types/testing-library__jest-dom": "^5.14.3",
"@types/zip-stream": "workspace:*",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"@vitejs/plugin-react": "^1.3.2",
"@votingworks/ballot-encoder": "workspace:*",
"@votingworks/central-scan-backend": "workspace:*",
Expand All @@ -114,15 +108,6 @@
"@votingworks/test-utils": "workspace:*",
"esbuild": "^0.15.10",
"esbuild-runner": "^2.2.1",
"eslint": "8.23.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-vx": "workspace:*",
"fetch-mock": "^9.9.0",
"history": "^4.10.1",
Expand Down
12 changes: 1 addition & 11 deletions apps/central-scan/integration-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,12 @@
"start-server-and-test": "^1.12.5"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"concurrently": "^7.6.0",
"eslint": "8.23.1",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "^2.1.2",
"lint-staged": "^10.5.4",
"sort-package-json": "^1.50.0",
"typescript": "4.6.3"
"sort-package-json": "^1.50.0"
},
"packageManager": "[email protected]"
}
10 changes: 1 addition & 9 deletions apps/design/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,11 @@
"@types/svg-to-pdfkit": "^0.1.0",
"@types/tmp": "^0.2.3",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"@votingworks/ballot-interpreter": "workspace:*",
"@votingworks/fixtures": "workspace:*",
"@votingworks/image-utils": "workspace:*",
"esbuild": "^0.14.29",
"esbuild-runner": "^2.2.1",
"eslint": "8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "^2.1.2",
"jest": "^29.6.2",
Expand All @@ -95,8 +88,7 @@
"nodemon": "^2.0.20",
"sort-package-json": "^1.50.0",
"tmp": "^0.2.1",
"ts-jest": "29.0.5",
"typescript": "4.6.3"
"ts-jest": "29.0.5"
},
"engines": {
"node": ">= 12"
Expand Down
18 changes: 1 addition & 17 deletions apps/design/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
"last 1 safari version"
]
},
"eslintConfig": {
"extends": "react-app"
},
"dependencies": {
"@tanstack/react-query": "^4.22.0",
"@votingworks/basics": "workspace:*",
Expand All @@ -71,8 +68,7 @@
"react": "17.0.1",
"react-dom": "17.0.1",
"react-router-dom": "^5.2.0",
"styled-components": "^5.2.3",
"typescript": "4.6.3"
"styled-components": "^5.2.3"
},
"devDependencies": {
"@types/debug": "^4.1.8",
Expand All @@ -83,21 +79,9 @@
"@types/react-router-dom": "^5.1.5",
"@types/styled-components": "^5.1.9",
"@types/tmp": "^0.2.3",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"@vitejs/plugin-react": "^1.3.2",
"@votingworks/design-backend": "workspace:*",
"@votingworks/monorepo-utils": "workspace:*",
"eslint": "8.23.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.1",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "^2.2.0",
"jest": "^29.6.2",
Expand Down
15 changes: 1 addition & 14 deletions apps/design/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,14 @@
"dotenv-expand": "5.1.0",
"esbuild": "^0.14.29",
"esbuild-runner": "^2.2.1",
"path": "^0.12.7",
"typescript": "4.6.3"
"path": "^0.12.7"
},
"devDependencies": {
"@types/debug": "^4.1.8",
"@types/jest": "^29.5.3",
"@types/react": "17.0.39",
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"@votingworks/monorepo-utils": "workspace:*",
"eslint": "8.23.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.1",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "^2.2.0",
"jest": "^29.6.2",
Expand Down
10 changes: 1 addition & 9 deletions apps/mark-scan/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,10 @@
"@types/node": "16.18.23",
"@types/tmp": "^0.2.3",
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"@votingworks/test-utils": "workspace:*",
"copyfiles": "^2.4.1",
"esbuild": "^0.14.29",
"esbuild-runner": "^2.2.1",
"eslint": "8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "^2.1.2",
"jest": "^29.6.2",
Expand All @@ -91,8 +84,7 @@
"lint-staged": "^10.5.3",
"nodemon": "^2.0.20",
"sort-package-json": "^1.50.0",
"ts-jest": "^29.1.1",
"typescript": "4.6.3"
"ts-jest": "^29.1.1"
},
"engines": {
"node": ">= 16"
Expand Down
17 changes: 0 additions & 17 deletions apps/mark-scan/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
"last 1 safari version"
]
},
"eslintConfig": {
"extends": "react-app"
},
"dependencies": {
"@rooks/use-interval": "^4.5.0",
"@tanstack/react-query": "^4.22.0",
Expand Down Expand Up @@ -108,7 +105,6 @@
"style-loader": "1.3.0",
"styled-components": "^5.2.3",
"ts-pnp": "1.2.0",
"typescript": "4.6.3",
"url-loader": "4.1.1",
"use-interval": "^1.2.1"
},
Expand All @@ -124,26 +120,13 @@
"@types/react-gamepad": "^1.0.0",
"@types/setimmediate": "^1.0.2",
"@types/testing-library__jest-dom": "^5.14.3",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"@vitejs/plugin-react": "^1.3.2",
"@votingworks/grout-test-utils": "workspace:*",
"@votingworks/mark-scan-backend": "workspace:*",
"@votingworks/monorepo-utils": "workspace:*",
"@votingworks/test-utils": "workspace:*",
"chalk": "^4.1.2",
"concurrently": "^7.3.0",
"eslint": "8.23.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.1",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^5.6.4",
"eslint-plugin-vx": "workspace:*",
"fetch-mock": "^9.5.0",
"is-ci-cli": "^2.0.0",
Expand Down
12 changes: 1 addition & 11 deletions apps/mark-scan/integration-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,12 @@
},
"devDependencies": {
"@types/node": "16.18.23",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"concurrently": "^7.6.0",
"eslint": "8.23.1",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "^2.1.2",
"lint-staged": "^11.0.0",
"sort-package-json": "^1.50.0",
"typescript": "4.6.3"
"sort-package-json": "^1.50.0"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit f18cea7

Please sign in to comment.