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

Refactor mock custom formatter to rename to CJS #7264

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

ybiquitous
Copy link
Member

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

Ref #5291

Is there anything in the PR that needs further explanation?

Note that a custom formatter in ESM is unsupported.

Note that a custom formatter in ESM is unsupported.
@changeset-bot

This comment was marked as resolved.

@Mouvedia
Copy link
Member

Note that a custom formatter in ESM is unsupported.

import stringFormatter from '../formatters/stringFormatter.mjs';

I guess it's different for formatter.

@ybiquitous
Copy link
Member Author

@Mouvedia We're currently using require(). But we should support ESM as well.

stylelint/lib/cli.mjs

Lines 396 to 400 in 958bf36

if (cli.flags.customFormatter) {
const customFormatter = resolveCustomFormatter(cli.flags.customFormatter);
formatter = require(customFormatter);
}

@ybiquitous
Copy link
Member Author

I've just opened an issue (#7267) for an ESM custom formatter.

Copy link
Member

@Mouvedia Mouvedia left a comment

Choose a reason for hiding this comment

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

LGTM

offtopic
https://github.com/stylelint/stylelint/blob/v16/lib/__tests__/fixtures/custom-formatter.mjs
should probably be moved in the formatters directory

@ybiquitous
Copy link
Member Author

Thanks for the review.

offtopic
v16/lib/tests/fixtures/custom-formatter.mjs
should probably be moved in the formatters directory

This file is used only by resolveCustomFormatter.test.js:

const aRelativePath = 'lib/__tests__/fixtures/custom-formatter.mjs';

@ybiquitous ybiquitous merged commit 2e6b326 into v16 Oct 20, 2023
14 checks passed
@ybiquitous ybiquitous deleted the esm-mock-custom-formatter branch October 20, 2023 01:50
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.

None yet

2 participants