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 getTestPackage to verify various attributes of packages #110

Open
romainmenke opened this issue Jul 19, 2024 · 3 comments
Open

Add getTestPackage to verify various attributes of packages #110

romainmenke opened this issue Jul 19, 2024 · 3 comments
Labels
status: ready to implement is ready to be worked on by someone

Comments

@romainmenke
Copy link
Member

What is the problem you're trying to solve?

see:

testRule and testRuleConfigs help people to write rule tests (as the name suggess :D ) but maintaining a good npm package with a Stylelint rule goes beyond writing rules.

For the PostCSS plugins we author under @csstools we found that we make the same mistakes over and over again and that we weren't following the PostCSS guidelines for plugins.

Things we often did wrong:

  • name doesn't start with postcss-
  • postcss-plugin was missing from keywords
  • postcss was not a peer dependency

In Stylelint we also have guidelines and docs for writing rules and they contain similar aspects: https://github.com/stylelint/stylelint/blob/main/docs/developer-guide/plugins.md#peer-dependencies

What solution would you like to see?

Maybe we can create a getTestPackage function that contains tests for package.json?

This has two benefits:

  • it is easier for authors to be consistent
  • we can amend the guidelines and use this test as a way to communicate and promote the new guidelines
@Mouvedia
Copy link
Member

Mouvedia commented Jul 19, 2024

  • keywords based on the type argument
  • files is missing a README at the root
  • mapping between engines.node and peer dependency version of stylelint
  • has either stylelint-test-rule-node or jest-preset-stylelint as a dependency
  • rules
    • messages start with either "Unexpected" or "Expected"
    • missing primaryOptionArray
  • etc.

@ybiquitous ybiquitous added the status: needs discussion triage needs further discussion label Jul 20, 2024
@ybiquitous
Copy link
Member

@romainmenke Thanks for opening the request. Sounds great. 👍🏼

If the new check works, we should want to port it to stylelint-test-rule-node.

@Mouvedia Thanks for the additional suggestions. They sound good to me. We can include them or start with minimal checks for baby steps. 👍🏼

@ybiquitous ybiquitous added type: enhancement status: ready to implement is ready to be worked on by someone and removed status: needs discussion triage needs further discussion labels Jul 20, 2024
@ybiquitous
Copy link
Member

I've labeled the issue as ready to implement. Please consider contributing if you have time.

If you still have any concerns about starting the work, feel free to comment. We can go back anytime. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to implement is ready to be worked on by someone
Projects
None yet
Development

No branches or pull requests

4 participants