Skip to content
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

Bug: [consistent-type-imports] imported type used in 'satisfies' reported as 'used by decorator metadata' #6077

Closed
4 tasks done
jet2jet opened this issue Nov 24, 2022 · 3 comments
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@jet2jet
Copy link

jet2jet commented Nov 24, 2022

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play#ts=4.9.3&sourceType=module&code=PTAEAEBcGcFoFMAeAHeBjSCBOWD2WBYAKAEsBbZfSUSAT1VAG9QAxXXUAX1ADM8zQAch7tBAbmJpcAO2jURHALxNioUAEMAXEIWDi3aOsgloPEvGit2EokkpZqAE3g91AVwA2868SA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6MgeyeUuX0Ra0ipWpQC2xDtHyoMkRNGhTI4MAF8QaoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

// @ts-expect-error
import type { Foo } from 'foo';
const foo = {
  a: 'foo'
} satisfies Foo;
export default foo;

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/consistent-type-imports": "error"
  },
};

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

No error reported

Actual Result

Error reported: Type import "Foo" is used by decorator metadata. 2:1 - 2:32

Additional Info

No response

Versions

package version
@typescript-eslint/eslint-plugin 5.44.0
@typescript-eslint/parser 5.44.0
TypeScript 4.9.3
ESLint 8.15.0
node 18.12.0
@jet2jet jet2jet added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Nov 24, 2022
@jet2jet jet2jet changed the title Bug: [consistent-type-imports] type reference in 'satisfies' reported as 'used by decorator metadata' Bug: [consistent-type-imports] imported type used in 'satisfies' reported as 'used by decorator metadata' Nov 24, 2022
@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Nov 24, 2022
@bradzacher
Copy link
Member

This was fixed in #6059 and will be released tomorrow.
I.e. this is a duplicate of #6057

@kasperpeulen
Copy link

@bradzacher

I tried this out in the latest canary, but it seems to still cause issues:

import type { Meta, StoryObj } from '@storybook/react';

import { Button } from './Button';

// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
const meta = {
  title: 'Example/Button',
  component: Button,
  tags: ['docsPage'],
  argTypes: {
    backgroundColor: { control: 'color' },
  },
} satisfies Meta<typeof Button>;

export default meta;
type Story = StoryObj<typeof meta>;

// More on writing stories with args: https://storybook.js.org/docs/7.0/react/writing-stories/args
export const Primary: Story = {
  args: {
    primary: true,
    label: 'Button',
  },
};
/Users/kasperpeulen/code/storybook/storybook/code/renderers/react/template/cli/ts/Button.stories.ts
  1:1  error  Type import "Meta" is used by decorator metadata  @typescript-eslint/consistent-type-imports

Using 5.44.1-alpha.15

@jet2jet
Copy link
Author

jet2jet commented Dec 9, 2022

It seems this issue was fixed in version 5.45.0 (at least no error is reported in 5.46.0).
I'll close this issue.

@jet2jet jet2jet closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

4 participants