From 3b16e379240eba350626d860bbd7d992ae0ad0d9 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 30 Oct 2022 05:43:00 -0700 Subject: [PATCH 1/5] docs(eslint-plugin): [consistent-type-imports] make a note about `parserOptions.emitDecoratorMetadata` --- .../eslint-plugin/docs/rules/consistent-type-imports.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index 6e6912d34cf2..89caf83b269e 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -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](../../../../docs/linting/TYPED_LINTING.md), 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 analyse 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. From b42e3f186e681fe4e41bc49857a74a1521bd9e7b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 30 Oct 2022 15:24:18 -0700 Subject: [PATCH 2/5] Update consistent-type-imports.md --- packages/eslint-plugin/docs/rules/consistent-type-imports.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index 89caf83b269e..bbb46c2462be 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -52,7 +52,7 @@ const x: import('Bar') = 1; 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](../../../../docs/linting/TYPED_LINTING.md), 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 analyse 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). +If you are using [type-aware linting](../../../../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 From 7a4f8b81833bdef6fe0c5c62cb32efc37bd29c7b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 30 Oct 2022 15:25:17 -0700 Subject: [PATCH 3/5] Update consistent-type-imports.md --- packages/eslint-plugin/docs/rules/consistent-type-imports.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index bbb46c2462be..7ca0de025cbb 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -52,7 +52,7 @@ const x: import('Bar') = 1; 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](../../../../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). +If you are using [type-aware linting](../../../../docs/linting/TYPED_LINTING.md), 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 From 2bb03949bc62cda2e080236ae7b5411433827984 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 30 Oct 2022 15:25:50 -0700 Subject: [PATCH 4/5] Update consistent-type-imports.md --- packages/eslint-plugin/docs/rules/consistent-type-imports.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index 7ca0de025cbb..3701162cf226 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -52,7 +52,7 @@ const x: import('Bar') = 1; 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](../../../../docs/linting/TYPED_LINTING.md), 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). +If you are using [type-aware linting](./docs/linting/TYPED_LINTING.md), 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 From 2a1ceb7a8f85549b27eb4288eea27a7cfe731113 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 30 Oct 2022 23:34:23 -0700 Subject: [PATCH 5/5] Update consistent-type-imports.md --- packages/eslint-plugin/docs/rules/consistent-type-imports.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index 3701162cf226..745930d0d54c 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -52,7 +52,7 @@ const x: import('Bar') = 1; 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](./docs/linting/TYPED_LINTING.md), 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). +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