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 support for ESM plugins #7339

Merged
merged 16 commits into from Nov 15, 2023
Merged

Add support for ESM plugins #7339

merged 16 commits into from Nov 15, 2023

Conversation

ybiquitous
Copy link
Member

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

Closes #7327

Is there anything in the PR that needs further explanation?

In addition, this change does the following:

  • improve the migration guide for v16
  • rewrite the writing plugin guide for ESM
  • make the changelog items more consistent

Note: I realized that #7279 produced a breaking change in stylelint.utils.checkAgainstRule.

Copy link

changeset-bot bot commented Nov 14, 2023

🦋 Changeset detected

Latest commit: af6d743

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

In addition, this change does the following:
- improve the migration guide for v16
- rewrite the writing plugin guide for ESM
- make the changelog items more consistent

Note: I realized that #7279 produced a breaking change in `stylelint.utils.checkAgainstRule`.
Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

Fantastic! @ybiquitous It's incredible to see this, and it was only made possible by your immense effort to migrate the entire codebase to ESM!

I've tested this branch locally with a mix of ESM and CommonJS plugins. It all worked well.

I've made some minor suggestions to the wording and code style.

Let's also add something to the migration guide. We can adopt the v15 format of "significant or breaking changes". For example:

# Migrating to 16.0.0

This release contains significant or breaking changes.

## Significant changes

- added support for ESM plugins

### Added support for ESM plugins

You can now create ESM plugins for Stylelint. This involved a year-long effort to migrate our codebase to ESM. We've updated our [developer guide](../developer-guide/plugins.md) with examples of ESM syntax.

## Breaking changes

This release contains breaking changes. We've:

- removed deprecated stylistic rules
- removed support for Node.js less than 18.12.0
- changed `.js` extension to `.mjs` and `.cjs`
- changed Node.js API returned resolved object
- changed Node.js API `stylelint.formatters` object
- changed Node.js API `stylelint.rules` object
- changed Node.js API `stylelint.utils.checkAgainstRule` function
- changed CLI to print problems to stderr
- changed CLI exit code for flag errors

### Removed deprecated stylistic rules

...

The rest of the headings will need to be bumped down a level too.

Let's do another prerelease after this PR is merged.

I'll create a follow-up issue about deprecating CommonJs plugins.

.changeset/beige-clouds-carry.md Outdated Show resolved Hide resolved
.changeset/twelve-spies-design.md Outdated Show resolved Hide resolved
docs/developer-guide/plugins.md Outdated Show resolved Hide resolved
docs/developer-guide/plugins.md Outdated Show resolved Hide resolved
docs/developer-guide/plugins.md Outdated Show resolved Hide resolved
docs/developer-guide/plugins.md Outdated Show resolved Hide resolved
lib/__tests__/fixtures/plugin-selector-no-foo.mjs Outdated Show resolved Hide resolved
lib/__tests__/fixtures/plugin-selector-no-foo.mjs Outdated Show resolved Hide resolved
lib/__tests__/fixtures/plugin-selector-no-foo.mjs Outdated Show resolved Hide resolved
lib/__tests__/fixtures/plugin-selector-no-foo.mjs Outdated Show resolved Hide resolved
@jeddy3 jeddy3 changed the title Add support for ESM plugin Add support for ESM plugins Nov 15, 2023
ybiquitous and others added 11 commits November 15, 2023 21:42
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
@ybiquitous
Copy link
Member Author

@jeddy3 Thanks a lot for the review. I've addressed and resolved all your review comments. 👌🏼

In addition, I've pushed one more improvement (101f65e) in the docs to clarify the stylelint.utils function notations, appending () like this:

-`stylelint.utils.report`
+`stylelint.utils.report()`

Any thoughts?

@jeddy3
Copy link
Member

jeddy3 commented Nov 15, 2023

The changes look good. As part of this PR, let's update the migration guide.

@ybiquitous
Copy link
Member Author

As part of this PR, let's update the migration guide.

Done! acd12ed

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

Wonderful, LGTM.

(I think we can merge and do another prerelease.)

@ybiquitous
Copy link
Member Author

Okay, I'll merge this PR and release 16.0.0-2 from now.

@ybiquitous ybiquitous merged commit 2debf67 into main Nov 15, 2023
16 checks passed
@ybiquitous ybiquitous deleted the issue-7327 branch November 15, 2023 14:57
@ybiquitous ybiquitous mentioned this pull request Nov 15, 2023
10 tasks
@ybiquitous
Copy link
Member Author

Done! https://github.com/stylelint/stylelint/releases/tag/16.0.0-2

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

Successfully merging this pull request may close these issues.

Support ESM plugins
3 participants