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

Add loadLint option #77

Merged
merged 1 commit into from
Oct 5, 2023
Merged

Add loadLint option #77

merged 1 commit into from
Oct 5, 2023

Conversation

ybiquitous
Copy link
Member

Which issue, if any, is this issue related to?

Ref stylelint/stylelint#5291

Is there anything in the PR that needs further explanation?

This option allows to use the dynamic import() function. For example:

{
  loadLint: () => import('stylelint').then((m) => m.default.lint)
}

This option allows to use the dynamic `import()` function.
@ybiquitous ybiquitous marked this pull request as ready for review October 5, 2023 14:39
Copy link
Member

@mattxwang mattxwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

(after merging this, would you then update stylelint/stylelint#7211?)

@ybiquitous
Copy link
Member Author

Thanks for the review!

(after merging this, would you then update stylelint/stylelint#7211?)

Unfortunately, we cannot do it yet because we still require CJS rules in lib/rules/index.mjs:

importLazy(() => require('./alpha-value-notation/index.cjs'))()

We need to replace importLazy() and rewrite to Promise-based code like this:

() => import('./alpha-value-notation/index.mjs').then(m => m.default)

@ybiquitous ybiquitous merged commit 9bf2b15 into main Oct 5, 2023
7 checks passed
@ybiquitous ybiquitous deleted the load-lint-option branch October 5, 2023 23:44
@ybiquitous
Copy link
Member Author

Released https://github.com/stylelint/jest-preset-stylelint/releases/tag/6.3.0 🎉

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

Successfully merging this pull request may close these issues.

2 participants