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

[stylelint] improvements to stylelint rule (docusaurus/copyright-header) #2370

Closed
yangshun opened this issue Mar 7, 2020 · 4 comments · Fixed by #2415
Closed

[stylelint] improvements to stylelint rule (docusaurus/copyright-header) #2370

yangshun opened this issue Mar 7, 2020 · 4 comments · Fixed by #2415
Labels
better engineering Not a bug or feature request difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.

Comments

@yangshun
Copy link
Contributor

yangshun commented Mar 7, 2020

💥 Proposal

This is a follow up of #2361 and #2363 regarding improving our stylelint test (packages/stylelint-copyright)

  • It is using the Tape test runner and is not integrated into our CI. If we move the implementation to Jest, it'll be run as part of the repo root's yarn test flow which is part of CI and that'll be great. stylelint's rules are already using Jest and perhaps we can learn from how they do it
  • Allow for rule configuration options to specify the copyright pattern similar to eslint-plugin-header

Have you read the Contributing Guidelines on issues?

Yes

@yangshun yangshun added good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. better engineering Not a bug or feature request labels Mar 7, 2020
@ayshiff
Copy link
Contributor

ayshiff commented Mar 11, 2020

I would love to work on it @yangshun 👍

@yangshun
Copy link
Contributor Author

@ayshiff go ahead

@ayshiff
Copy link
Contributor

ayshiff commented Mar 14, 2020

Hey @yangshun, I have a question about the way stylelint rules should be tested !

I followed the way stylelint's rules were tested by adding a jest setup file and defining a testRule method.
I think I have to do some tricks around the way the plugin is created because it gives me the error "Unknown rule docusaurus/copyright-header."

Otherwise I checked the way "stylelint-test-rule-tape" was working and it uses the version « 9.1.1 » of stylelint where we can access a createRuleTester method to make our own rule tester. We can then create our own assertEquality function using Jest.

I think the best way is to follow the first method but I wanted to have your opinion before.

@yangshun
Copy link
Contributor Author

Please try to reuse the Jest file at the root of the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better engineering Not a bug or feature request difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants