Skip to content

Migrate scripts to pnpm and replaced yarn reference #4

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

Merged
merged 3 commits into from
May 20, 2025
Merged
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
4 changes: 1 addition & 3 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
enabled: false,
},

postUpdateOptions: [
'pnpmDedupe',
],
postUpdateOptions: ['pnpmDedupe'],

// By default renovate will auto-rebase whenever the dep pranch falls behind main.
// This is annoying as it spams notifications and creates unnecessary action runs.
Expand Down
36 changes: 18 additions & 18 deletions docs/contributing/Local_Development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ Thank you for your interest in developing on typescript-eslint! ❤️‍🔥

## Setup

After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing Yarn](https://yarnpkg.com):
After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing pnpm](https://pnpm.io/):

```shell
git clone https://github.com/<your-name-here>/typescript-eslint
cd typescript-eslint
yarn
pnpm install
```

You can see which version of `yarn` we use by checking the `packageManager` field in the root `package.json`.
You can see which version of `pnpm` we use by checking the `packageManager` field in the root `package.json`.

Postinstall scripts will then fully build your repository locally with (`yarn build`).
Postinstall scripts will then fully build your repository locally with (`pnpm run build`).
At this point, you're ready to develop! 🚀

## Builds

You can run `yarn build` in the root to build all packages, or in any package to build just that package.
You can run `pnpm run build` in the root to build all packages, or in any package to build just that package.

Keep in mind that packages generally depend on each other's built outputs, and you'll need to `yarn build` dependents for their consumers to receive any new local changes.
For example, if you make a change within `scope-manager` and want to use it in `eslint-plugin`, you'll need to `yarn build` either from the root or within `packages/scope-manager`.
Keep in mind that packages generally depend on each other's built outputs, and you'll need to `pnpm run build` dependents for their consumers to receive any new local changes.
For example, if you make a change within `scope-manager` and want to use it in `eslint-plugin`, you'll need to `pnpm run build` either from the root or within `packages/scope-manager`.

## Validating Changes

Expand All @@ -40,46 +40,46 @@ You can also perform them locally.

We use [Prettier](https://prettier.io) to auto-format code.
A Git pre-commit hook should apply it to all committed changes.
Alternately, you can run `yarn format` in any package or in the root.
Alternately, you can run `pnpm run format` in any package or in the root.

### Linting

All code changes must pass ESLint.
You can run `yarn lint` in any package or in the root.
You can run `pnpm run lint` in any package or in the root.

### Proofreading

Changes must pass two linters for documentation and naming, the commands for which may be run from the root:

- `yarn check-spelling`: [CSpell](https://cspell.org), for all code
- `yarn lint-markdown`: [Markdownlint](https://github.com/DavidAnson/markdownlint), for Markdown documentation
- `pnpm run check-spelling`: [CSpell](https://cspell.org), for all code
- `pnpm run lint-markdown`: [Markdownlint](https://github.com/DavidAnson/markdownlint), for Markdown documentation

### Tests

All code changes should ideally be unit tested if possible.
You can run `yarn test` in any package to run its tests.
You can run `pnpm run test` in any package to run its tests.

> [VS Code launch tasks](https://code.visualstudio.com/docs/editor/tasks) tasks are provided that allow [visual debugging](https://code.visualstudio.com/docs/editor/debugging) tests.

### Type Checking

All code should pass TypeScript type checking.
You can run `yarn typecheck` in any package or in the root to run `tsc`.
You can run `pnpm run typecheck` in any package or in the root to run `tsc`.

> Run `yarn typecheck -w` to start `tsc` in watch mode.
> Run `pnpm run typecheck -w` to start `tsc` in watch mode.

## Rule Development

Some portions of this repository are generated by manually running scripts that read from rule files.
If you modify rules, you may need to run either or both of:

- `yarn generate-configs` from root: to regenerate [shared configs](../users/Shared_Configurations.mdx)
- `yarn test docs -u` from `packages/eslint-plugin`: to regenerate snapshots based on rule docs and options
- `pnpm run generate-configs` from root: to regenerate [shared configs](../users/Shared_Configurations.mdx)
- `pnpm run test docs -u` from `packages/eslint-plugin`: to regenerate snapshots based on rule docs and options

## Website Development

Our interactive documentation website is built with [Docusaurus](https://docusaurus.io).
Running `yarn start` from either the root or `packages/website` will start a local dev server on `localhost:3000`.
Running `pnpm run start` from either the root or `packages/website` will start a local dev server on `localhost:3000`.

> The `website` package relies on other packages being built.
> We recommend running `yarn build` from the root before `yarn start`.
> We recommend running `pnpm run build` from the root before `pnpm run start`.
6 changes: 3 additions & 3 deletions docs/contributing/Pull_Requests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Please don't:
### Code Coverage

We aim for 100% code coverage in all PRs when possible, except in the `website/` package.
Coverage reports are generated locally whenever `yarn test` is run.
Coverage reports are generated locally whenever `pnpm run test` is run.

The `codecov` bot also comments on each PR with its percentage, as well as links to the line-by-line coverage of each file touched by the PR.

Expand All @@ -54,8 +54,8 @@ AST tests belong in the `ast-spec` package, within `fixtures/` subfolders alongs

```bash
cd packages/eslint-plugin
yarn test docs -u
yarn test schemas -u
pnpm run test docs -u
pnpm run test schemas -u
```

## Raising the PR
Expand Down
12 changes: 6 additions & 6 deletions docs/contributing/local-development/Local_Linking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The command to put instead of that `#` comment, depends on the local downstream
Additionally, if you haven't yet built the typescript-eslint repository, do so now:

```shell
yarn build
pnpm run build
```

## Repository Linking
Expand Down Expand Up @@ -73,8 +73,8 @@ After that, you need to run your repository's `lint` script and your changes sho

:::note
Changes to `@typescript-eslint/` packages will not be reflected inside your linked repository until they're built locally.
To re-build all packages, run `yarn build` from the root.
To start a watch mode builder on just the ESLint plugin, run `yarn build --watch` from `./packages/eslint-plugin`.
To re-build all packages, run `pnpm run build` from the root.
To start a watch mode builder on just the ESLint plugin, run `pnpm run build --watch` from `./packages/eslint-plugin`.
:::

## Troubleshooting
Expand All @@ -92,17 +92,17 @@ Require stack:
In this case, you can manually install any missing packages in the local downstream repository as dev dependencies (`--save-dev`).

```shell
yarn add ts-api-utils -D
pnpm add ts-api-utils -D
```

### Rules Not Found (`Definition for rule ... was not found`)

Packages need to be built.
First try re-running `yarn build` from the typescript-eslint repository root.
First try re-running `pnpm run build` from the typescript-eslint repository root.

If you're adding new rules, you'll need to also modify [`packages/eslint-plugin/src/rules/index.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/index.ts) to export the rule object, then re-build.

If you're modifying preset configurations, you'll also need to run `yarn generate-configs`, then re-build.
If you're modifying preset configurations, you'll also need to run `pnpm run generate-configs`, then re-build.

### Yarn Link Failures (`Cannot link ... conflicts with parent dependency`)

Expand Down
22 changes: 11 additions & 11 deletions docs/maintenance/pull-requests/Dependency_Version_Upgrades.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,26 @@ You should generally avoid clicking the "Update branch" button in the Github UI
Occasionally it will be desirable to manually bump the dependencies in one commit rather than relying on renovate's many PRs. Doing so is just a matter of:

1. `git checkout main && git pull`
1. `yarn install`
1. `yarn update-interactive` - this will start yarn's prompt to update the deps.
1. `pnpm install`
1. `pnpm update --interactive` - this will start pnpm's prompt to update the deps.
1. Ignore the lines with `*` deps as these are intentionally set as such.
1. Avoid changing the dep ranges like the complex range we have for TypeScript (eg `>=4.7.4 <5.5.0`).
1. Once you're ready, hit `enter` and yarn will make the changes and rerun the install.
1. Once you're ready, hit `enter` and pnpm will make the changes and rerun the install.
1. Run all of the relevant checks locally so you can action any failures before raising a PR:
1. `yarn build`
1. `yarn typecheck`
1. `yarn lint`
1. `yarn test`
1. `yarn integration-test`
1. `pnpm run build`
1. `pnpm run typecheck`
1. `pnpm run lint`
1. `pnpm run test`
1. `pnpm run test-integration`
1. Create a new branch (a name like `update-deps-20231201` is good just to keep it unique), create, and land a PR.

### Babel

Our published packages only depend on `@babel/*` packages as devDependencies.
You can generally upgrade those dependencies with:

1. `yarn add -D @babel/code-frame @babel/core @babel/eslint-parser @babel/parser @babel/types`
2. `npx nx run ast-spec:test -u`
1. `pnpm add -D @babel/code-frame @babel/core @babel/eslint-parser @babel/parser @babel/types`
2. `pnpx nx run ast-spec:test -u`

The fixtures under `packages/ast-spec/` describe how the files are parsed under both Babel and our (TSESTree) parser.

Expand Down Expand Up @@ -137,7 +137,7 @@ We generally start the process of supporting a new TypeScript version just after
- In the parser's `getLib`, update the `switch (target)` and its preceding comment as needed (see [#6782](https://github.com/typescript-eslint/typescript-eslint/pull/6782))
- Change the `SUPPORTED_TYPESCRIPT_VERSIONS` constant's `<` version to the next version of TypeScript
- Change the `SUPPORTED_PRERELEASE_RANGES` constant to equal `['X.Y.1-rc']`
- Run `yarn generate-lib` to update `scope-manager`
- Run `pnpm run generate-lib` to update `scope-manager`
1. Once all PRs needed for the RC update PR are merged, merge the RC update PR
1. Once TypeScript releases the stable X.Y version, create and merge a PR with a title like `chore: bump TypeScript from X.YRC to X.Y` and the following changes:
- In the root `package.json`, remove `|| X.Y.1-rc2` from the `dependency` on `typescript`, and bump its `<` version to the next version of TypeScript
Expand Down
4 changes: 2 additions & 2 deletions docs/packages/TypeScript_ESTree.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ const { ast, services } = parseAndGenerateServices(code, {
## Debugging

If you encounter a bug with the parser that you want to investigate, you can turn on the debug logging via setting the environment variable: `DEBUG=typescript-eslint:*`.
I.e. in this repo you can run: `DEBUG=typescript-eslint:* yarn lint`.
I.e. in this repo you can run: `DEBUG=typescript-eslint:* pnpm run lint`.

This will include TypeScript server logs.
To turn off these logs, include `-typescript-eslint:typescript-estree:tsserver:*` when setting the environment variable.
I.e. for this repo change to: `DEBUG='typescript-eslint:*,-typescript-eslint:typescript-estree:tsserver:*' yarn lint`.
I.e. for this repo change to: `DEBUG='typescript-eslint:*,-typescript-eslint:typescript-estree:tsserver:*' pnpm run lint`.
6 changes: 3 additions & 3 deletions packages/ast-spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
"build": "tsc -b tsconfig.build.json && api-extractor run --local --config=./api-extractor.json",
"clean": "rimraf dist/ coverage/",
"clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"funding": {
"type": "opencollective",
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin-internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"dependencies": {
"@prettier/sync": "^0.5.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"format": "yarn run -T format",
"format": "pnpm --workspace-root run format",
"generate-breaking-changes": "tsx tools/generate-breaking-changes.mts",
"generate-configs": "yarn run -T generate-configs",
"lint": "yarn run -BT nx lint",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"test-single": "vitest --run --config=./vitest.config.mts --no-coverage",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"homepage": "https://typescript-eslint.io",
"license": "MIT",
"scripts": {
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"devDependencies": {
"@vitest/coverage-v8": "^3.1.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/rule-schema-to-typescript-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"dependencies": {
"@typescript-eslint/type-utils": "8.32.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/rule-tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"pretest-eslint-base": "tsc -b tsconfig.build.json",
"test-eslint-base": "mocha --require source-map-support/register ./tests/eslint-base/eslint-base.test.js",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"//": "NOTE - AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70",
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/scope-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"",
"format": "yarn run -T format",
"format": "pnpm --workspace-root run format",
"generate-lib": "yarn run -BT nx generate-lib repo",
"lint": "yarn run -BT nx lint",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.32.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/type-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"dependencies": {
"@typescript-eslint/typescript-estree": "8.32.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"copy-ast-spec": "tsx ./tools/copy-ast-spec.mts",
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ src/generated/ coverage/",
"format": "yarn run -T format",
"format": "pnpm --workspace-root run format",
"generate-lib": "yarn run -BT nx run scope-manager:generate-lib",
"lint": "yarn run -BT nx lint",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"devDependencies": {
"@vitest/coverage-v8": "^3.1.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/typescript-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "8.32.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/typescript-estree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ coverage/",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"format": "pnpm --workspace-root run format",
"lint": "pnpm --workspace-root exec nx lint",
"test": "vitest --run --config=./vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"check-types": "pnpm --workspace-root exec nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.32.1",
Expand Down
Loading