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

[feature]: Add support for dynamic imports in prefer-fluentui-v9 eslint rule #33553

Open
dmytrokirpa opened this issue Jan 6, 2025 · 0 comments

Comments

@dmytrokirpa
Copy link
Contributor

dmytrokirpa commented Jan 6, 2025

@fluentui/eslint-plugin-react-components The prefer-fluentui-v9 rule currently only supports static imports and does not accommodate dynamic imports such as:

// 1) .then
const Calendar = React.lazy(
  () => import('@fluentui/react-calendar-compat').then(m => ({ default: m.Calendar })
)

// 2) .then + destructuring
const Calendar = React.lazy(
  () => import('@fluentui/react-calendar-compat').then(({ Calendar }) => ({ default: Calendar })
)

// 3) await without inline destructuring
const Dialog = React.lazy(async () => {
  const m = await import('@fluentui/react-calendar-compat')

  return { default: m.Calendar }
})

// 4) await with inline destructuring
const Calendar = React.lazy(async () => {
  const { Calendar } = await import('@fluentui/react-calendar-compat')
  return { default: Calendar }
})

Therefore, we need to enhance the rule to support dynamic imports.

Originally posted by @dmytrokirpa in #33449 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants