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

Change default @wordpress/scripts flag values #111

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

tyrann0us
Copy link
Member

@tyrann0us tyrann0us commented Feb 26, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature

What is the current behavior? (You can also link to an open issue here)
There are two separate issues with flags passed to @wordpress/scripts commands:

  1. Stylelint
    The STYLELINT_ARGS input defaults to --formatter github, so whenever a calling workflow uses this input, it must also provide this flag.
  2. Markdownlint
    The MARKDOWNLINT_ARGS input defaults to --ignore LICENSE.md --ignore node_modules. The latter was only introduced (c563285) because @wordpress/scripts' default behavior of ignoring the node_modules/ folder is overridden when an --ignore flag is used. However, adding the first flag was actually an error because (current) packages don't use LICENSE.md files but an extension-free plain text LICENSE file.

What is the new behavior (if this is a feature change)?
This PR introduces two changes: Both the STYLELINT_ARGS and the MARKDOWNLINT_ARGS inputs default to an empty string.

For Stylelint, the --formatter github flag is hardcoded appended to the command. This means calling workflows using STYLELINT_ARGS no longer have to pass this flag.

For Markdownlint, @wordpress/scripts will now ignore node_modules/ by default if no --ignore flag is passed via the MARKDOWNLINT_ARGS.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No.

Other information:
Fixes #110

@tyrann0us tyrann0us requested review from shvlv and Chrico February 26, 2024 14:08
Copy link
Member

@Chrico Chrico left a comment

Choose a reason for hiding this comment

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

LGTM 💪🏻

Copy link
Contributor

@shvlv shvlv left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@Chrico Chrico left a comment

Choose a reason for hiding this comment

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

When removing --formatter as default and setting it hard, could lead to errors due setting the formatter twice. We should parse the string if --formatter is present, and if not, set the default.

@tyrann0us tyrann0us requested a review from Chrico February 27, 2024 10:51
Copy link
Member

@Chrico Chrico left a comment

Choose a reason for hiding this comment

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

As discussed today (27.02.2024), we are not going to check for --formatter and hardcode it for stylelint to github. In case, in future, someone wants to choose between formatters, we are going to update that action and check via contains() the input and only append when a formatter is not set.

@tyrann0us tyrann0us merged commit 4784619 into main Feb 27, 2024
@tyrann0us tyrann0us deleted the feat/wp-scripts-default-flags branch February 27, 2024 11:02
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.

[Feature Request]: Evaluate possible default flag values for @wordpress/scripts
3 participants