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

Remove deprecated CommonJS Node.js API #7395

Open
Tracked by #7396
ybiquitous opened this issue Dec 11, 2023 · 5 comments
Open
Tracked by #7396

Remove deprecated CommonJS Node.js API #7395

ybiquitous opened this issue Dec 11, 2023 · 5 comments
Labels
status: agreed but held is agreed on but implementation is held type: enhancement a new feature that isn't related to rules
Milestone

Comments

@ybiquitous
Copy link
Member

ybiquitous commented Dec 11, 2023

When releasing 16.0.0, we announced we would remove the CommonJS Node.js API in the next major version. See the migration guide:

We've migrated our source code to [ECMAScript modules](https://nodejs.org/docs/latest/api/esm.html) (ESM) — a year-long effort to allow ESM plugins, custom syntaxes and formatters, and a step towards updating our pure ESM dependencies.
To give the community time to migrate to ESM, we'll publish a hybrid package to support the (now deprecated) CommonJS Node.js API until our next major release.

Also, we must drop the support for CommonJS plugins because Stylelint plugins written in CommonJS cannot import pure ESM Stylelint modules (e.g., require('stylelint') will be errored).

// NOTE: This '.cjs' check is limited. Some CommonJS plugins may have the '.js' extension.
if (!quietDeprecationWarnings && pluginLookup.endsWith('.cjs')) {
console.warn(
`CommonJS plugins are deprecated ("${pluginLookup}"). See https://stylelint.io/migration-guide/to-16`,
);
}

By doing this, we will be able to achieve:

  • Remove .cjs files (the package size reduces)
  • Remove the build workflow via Rollup
  • Make the codebase pure ESM (maybe with .mjs.js change?)
  • Bump outdated pure ESM dependencies
@ybiquitous ybiquitous added the status: needs discussion triage needs further discussion label Dec 11, 2023
@ybiquitous ybiquitous added this to the future-major milestone Dec 11, 2023
@ybiquitous
Copy link
Member Author

@jeddy3 If you have additional info or find some mistakes, please feel free to edit the issue description.

@jeddy3 jeddy3 mentioned this issue Dec 11, 2023
6 tasks
@jeddy3
Copy link
Member

jeddy3 commented Dec 11, 2023

All looks good to me! I've created a new label for things that are agreed on but held for a time.

When the time is right, we'll switch to status: ready to implement.

@jeddy3 jeddy3 added type: enhancement a new feature that isn't related to rules status: agreed but held is agreed on but implementation is held and removed status: needs discussion triage needs further discussion labels Dec 11, 2023
@ybiquitous
Copy link
Member Author

Yeah, it will be a while (maybe 1 year later?)

@ybiquitous
Copy link
Member Author

I've just opened an issue #7397, too.

@jeddy3
Copy link
Member

jeddy3 commented Dec 11, 2023

Yeah, it will be a while (maybe 1 year later?)

I agree that it may be a while. We can check every few months to see how far along the JavaScript and Stylelint communities are in migrating to ESM, rather than put a fixed time on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: agreed but held is agreed on but implementation is held type: enhancement a new feature that isn't related to rules
Development

No branches or pull requests

2 participants