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

Acknowledge Ignored Files by Skipping #3

Open
whilelucky opened this issue Dec 20, 2017 · 4 comments
Open

Acknowledge Ignored Files by Skipping #3

whilelucky opened this issue Dec 20, 2017 · 4 comments

Comments

@whilelucky
Copy link

Hey @keplersj, first off, thanks for creating this project :)

Wanted to see if there's gonna be any feature to respect .stylelintignore rules automatically like jest-runner-eslint?

Right now it seems to be matching all *.css files(based on testMatch) regardless of what is mentioned in the .stylelintignore config.

@keplersj
Copy link
Owner

Hey @lakshyaranganath, thanks for checking it out! 😀

Hmm... Have you tried it to see if it doesn't work? Under the hood of this runner, stylelint should support that by default out of the box.

If it doesn't work let me know and I should be able to do something about that.

@whilelucky
Copy link
Author

Hey @keplersj, yeah I'm reporting this only after trying it for myself.
So I'm using the following setup to lint my *.js files. (since I used styled-components, I have my styles in my *.js files)

jest config

displayName: 'stylelint',
runner: 'jest-runner-stylelint',
testMatch: ['**/*.js'],

.stylelintignore

.idea
.vscode
es
lib
docs
coverage
node_modules
npm-debug.log*

Output from jest

 RUNS   stylelint  lib/components/Tabs/index.js
 RUNS   stylelint  lib/theme/theme.js
 RUNS   stylelint  es/components/Chip/index.js
 RUNS   stylelint  lib/components/TextInput/TextInput.js
 RUNS   stylelint  es/components/Notification/Notification.js
 RUNS   stylelint  lib/components/Card/index.js
 RUNS   stylelint  es/components/Card/Card.js
 RUNS   stylelint  lib/components/Aux/Aux.js
 RUNS   stylelint  lib/components/Divider/Divider.js
 RUNS   stylelint  lib/index.js
 RUNS   stylelint  lib/components/Divider/index.js
 RUNS   stylelint  lib/components/Dropdown/Dropdown.js
 RUNS   stylelint  es/components/Flex/index.js
 RUNS   stylelint  lib/components/List/ListItem.js
 RUNS   stylelint  es/components/Modal/ModalHeader.js
 RUNS   stylelint  es/components/Modal/index.js
 RUNS   stylelint  lib/components/List/List.js
 RUNS   stylelint  es/index.js
 RUNS   stylelint  es/components/Modal/ModalContent.js
 RUNS   stylelint  lib/components/Dropdown/index.js

as you can see it tries to lint files in the es/* and lib/* directories although its ignored in the .stylelintignore file.

Let me know if you need any other info regarding this. Will be super glad to help :)

@keplersj
Copy link
Owner

Ah. I think I know what's happening. Under the hood of this runner stylelint is ignoring the files in es/*, however Jest isn't. Jest reports the files in es/* as running because from Jest's perspective they are being run. And because those files are being ignored by stylelint they are not reporting errors, and Jest is told that the file is successful.

I'm not sure what the behavior should be with this scenario to be honest. It looks like stylelint does include if a linted file is ignored so I can handle this case pretty easily, just not sure what would work best. I believe there are two options - either not report anything for ignored files (which should prevent them from showing up as running and successful) or do the more verbose and explicit behavior and mark the file as skipped, equivalent to describe.skip.

Let me know what your preferred solution is, I'm leaning a bit more toward the skipping functionality but I also tend to lean more toward explicit solutions.

@whilelucky
Copy link
Author

Sweet, thanks for catching that so quickly.

Marking the files skipped seems to be the preferred way runners are written. Even the jest-runner-eslint package marks all .eslintignore files skipped to keep the explicitness and verbosity :)

@keplersj keplersj changed the title Does not use .stylelintignore Acknowledge Ignored Files by Skipping Dec 20, 2017
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

No branches or pull requests

2 participants