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

Update to stylelint 13 and latest schema #14

Merged
merged 5 commits into from
Apr 21, 2020
Merged

Conversation

jeddy3
Copy link
Member

@jeddy3 jeddy3 commented Apr 19, 2020

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

Closes #13

Is there anything in the PR that needs further explanation?

This pull request overhauls the repository to bring it in line with:

  • latest stylelint testRule schema
  • latest org tooling

What we've lacked recently is an easy way for plugin authors test using the schema. This pull request addresses that immediate need.

Following on from this pull request, we can:

  • add stylelint-tape to awesome-stylelint
  • update the writing plugins docs to refer to this preset and awesome-stylelint
  • create @stylelint/jest-preset for setting up a common jest environment for stylelint organisation repositories; the preset would include the settings removed in the pull request, along with the Jest plugins we use in the main repo, e.g. typeahead
  • import and merge this preset (once we've sorted the DI) and the scoped one within the main stylelint repository
  • close Remove createRuleTester stylelint#4267

@jeddy3 jeddy3 requested review from hudochenkov and ntwb April 19, 2020 09:14
@jeddy3
Copy link
Member Author

jeddy3 commented Apr 19, 2020

continuous-integration/travis-ci

Not sure why Travis is still expected. We can ignore it.

@hudochenkov
Copy link
Member

Not sure why Travis is still expected. We can ignore it.

It's because branch configuration wasn't changes: Settings → Branchesmaster Edit. There required checks should be marked.

Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

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

That's a great start, @jeddy3!

Don't release after merge, please. Let's discuss how can we use it for both stylelint core and stylelint plugins. I'll add my thoughts to stylelint/stylelint#4267 Actually, I'll create follow up PR after this one is merged. We'll keep same experience for outside users (add preset, and testRule is available). For stylelint core we'll export a function require('jest-preset-stylelint/create-test-rule'), which will inject stylelint and return testRule, which could be then added to global scope of stylelint core Jest runner.

package.json Outdated Show resolved Hide resolved
Co-Authored-By: Aleks Hudochenkov <aleks@hudochenkov.com>
@jeddy3
Copy link
Member Author

jeddy3 commented Apr 19, 2020

I'll create follow up PR after this one is merged. We'll keep same experience for outside users (add preset, and testRule is available). For stylelint core we'll export a function require('jest-preset-stylelint/create-test-rule'), which will inject stylelint and return testRule, which could be then added to global scope of stylelint core Jest runner.

Sounds good to me!

Are there any other changes, besides the peer dependency range change, that you'd like to see in this pull request?

jest-setup.js Outdated

jest.mock("./getOsEol.js", () => () => "\n");
jest.mock('./getOsEol', () => () => '\n');

global.testRule = (rule, schema) => {
Copy link
Member

Choose a reason for hiding this comment

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

BTW, why do we have rule here? It's not used anywhere. It looks like it was added long time ago, and since then never had been removed.

Copy link
Member Author

@jeddy3 jeddy3 Apr 20, 2020

Choose a reason for hiding this comment

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

I don't know. I'll remove it in this pull request. That'll make for a cleaner function signature in 2.0.0.

README.md Outdated

Turn on autofix.

### `only` \[boolean\]
Copy link
Member

Choose a reason for hiding this comment

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

I'm starting adding types #15 based on this PR, and discovered that this is incorrect.

only could be only on a test case, but not on the whole testRule. Same applies to skip.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.

});
```

## Schema properties
Copy link
Member

Choose a reason for hiding this comment

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

Missing syntax.

README.md Outdated

Description of the test case.

#### `fixed` \[string\]
Copy link
Member

Choose a reason for hiding this comment

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

Discovered that unfixable property description is missing.

@jeddy3
Copy link
Member Author

jeddy3 commented Apr 20, 2020

@hudochenkov Thanks for the further review. I've addressed the requested changes.

Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

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

Thanks for making changes!

Tiny typo to fix.

README.md Outdated Show resolved Hide resolved
Co-Authored-By: Aleks Hudochenkov <aleks@hudochenkov.com>
@jeddy3
Copy link
Member Author

jeddy3 commented Apr 20, 2020

Did you want to create the pull request into this branch to export the create-test-rule function, or shall I merge this into master?

@hudochenkov
Copy link
Member

hudochenkov commented Apr 20, 2020

Merge it. I'll follow up later this week. And I could test this preset later with stylelint-order.

Copy link
Member

@ntwb ntwb left a comment

Choose a reason for hiding this comment

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

Awesome work, have had a very quick look and looks good to me, thanks a bunch team 💯

@jeddy3
Copy link
Member Author

jeddy3 commented Apr 21, 2020

And I could test this preset later with stylelint-order.

Excellent. I've been testing it locally with stylelint-scales.

@jeddy3 jeddy3 merged commit eb49f36 into master Apr 21, 2020
@jeddy3 jeddy3 deleted the update-to-stylelint-13 branch April 21, 2020 11:11
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.

Throws when used with latest stylelint Remove createRuleTester
3 participants