Skip to content

docs: add 'Rule Not Found' FAQ for Local Linking #9864

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
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
21 changes: 20 additions & 1 deletion docs/contributing/local-development/Local_Linking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The general strategy to do so is:
2. [Repository linking](#repository-linking): Use your package manager's link command to reference those global symlinks in the local downstream repository.
3. [Trying rules](#trying-rules): Test your local rules and plugins by enabling them in the local downstream repository.

:::tip
Before linking a repository, make sure it's gone through the steps in [Getting Started](../../getting-started/Quickstart.mdx) to be able to use typescript-eslint rules.
:::

## Global Linking

To make all `@typescript-eslint/*` packages available globally, run this command from your `typescript-eslint` repository root:
Expand All @@ -29,9 +33,15 @@ The command to put instead of that `#` comment, depends on the local downstream
- [Yarn v1 / classic](https://classic.yarnpkg.com/lang/en/docs/cli/link/ 'Yarn v1 / classic docs'): `yarn link`
- [Yarn v2 / v3 / berry](https://yarnpkg.com/cli/link 'Yarn v2 / v3 / berry docs'): _skip this step altogether_

Additionally, if you haven't yet built the typescript-eslint repository, do so now:

```shell
yarn build
```

## Repository Linking

Now that the `@typescript-eslint/*` packages are available locally, you can link to them in the local downstream repository.
Now that the `@typescript-eslint/*` packages are built and available locally, you can link to them in the local downstream repository.
Run that repository's package manager's link command for any `@typescript-eslint/*` packages that repository depends on:

- npm: `npm link @typescript-eslint/eslint-plugin @typescript-eslint/parser`
Expand Down Expand Up @@ -85,6 +95,15 @@ In this case, you can manually install any missing packages in the local downstr
yarn 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.

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.

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

Yarn v2 / v3 / berry can be strict about conflicting dependencies.
Expand Down
Loading