You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we support only a custom formatter written in CommonJS (CJS). But, it would be useful if people could also specify a custom formatter in ESM.
This seems like a reasonable idea to me! From my understanding, it wouldn't be too complicated right (?) - as we can synchronously load CJS from ESM code?
(perhaps we could also look to the community and see which formatters are popular, which could help us guide the API)
I guess we could use dynamic import (aka import()), which is available both ESM and CJS modules as the Node.js document says:
Dynamic import() is supported in both CommonJS and ES modules. In CommonJS modules it can be used to load ES modules.
We must change the code using Promise when adopting this approach since import() returns a Promise. But this should not be problematic because the cli.mjs's main function is already an async function.
What is the problem you're trying to solve?
Currently, we support only a custom formatter written in CommonJS (CJS). But, it would be useful if people could also specify a custom formatter in ESM.
stylelint/lib/cli.mjs
Lines 396 to 400 in 958bf36
Related to #6930
What solution would you like to see?
I suggest supporting a custom formatter written in ESM. This means we need to change the current requiring logic.
The text was updated successfully, but these errors were encountered: