Skip to content

Commit

Permalink
docs(eslint-plugin): [consistent-type-imports] make a note about `par…
Browse files Browse the repository at this point in the history
…serOptions.emitDecoratorMetadata` (#5904)

* docs(eslint-plugin): [consistent-type-imports] make a note about `parserOptions.emitDecoratorMetadata`

* Update consistent-type-imports.md

* Update consistent-type-imports.md

* Update consistent-type-imports.md

* Update consistent-type-imports.md
  • Loading branch information
bradzacher committed Oct 31, 2022
1 parent 5414194 commit 1f14c03
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/eslint-plugin/docs/rules/consistent-type-imports.md
Expand Up @@ -48,6 +48,12 @@ type T = import('Foo').Foo;
const x: import('Bar') = 1;
```

## Usage with `emitDecoratorMetadata`

The `emitDecoratorMetadata` compiler option changes the code the TypeScript emits. In short - it causes TypeScript to create references to value imports when they are used in a type-only location. If you are using `emitDecoratorMetadata` then our tooling will require additional information in order for the rule to work correctly.

If you are using [type-aware linting](https://typescript-eslint.io/docs/linting/typed-linting), then you just need to ensure that the `tsconfig.json` you've configured for `parserOptions.project` has `emitDecoratorMetadata` turned on. Otherwise you can explicitly tell our tooling to analyze your code as if the compiler option was turned on [by setting `parserOptions.emitDecoratorMetadata` to `true`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/README.md#parseroptionsemitdecoratormetadata).

## When Not To Use It

- If you specifically want to use both import kinds for stylistic reasons, you can disable this rule.

0 comments on commit 1f14c03

Please sign in to comment.