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

Issue #1950: Fix lint:styles script not matching files in deep subdirectories #1951

Merged
merged 1 commit into from
Aug 17, 2017

Conversation

oxyc
Copy link
Contributor

@oxyc oxyc commented Aug 17, 2017

Fix #1950 by not relying on the user's shell but rather passing the unexpanded pattern directly to stylelint which in turn expands it using node-glob.

@retlehs retlehs merged commit 6022309 into roots:master Aug 17, 2017
@retlehs
Copy link
Member

retlehs commented Aug 17, 2017

tyvm 🙏

@oxyc oxyc deleted the patch-1 branch August 17, 2017 03:22
@mtx-z
Copy link

mtx-z commented Aug 20, 2017

Hey, I just deployed the latest dev-master, and this update cause following error (Windows 8.1/Wamp64 Apache, Node 6.112, npm 3.10.10, Yarn 0.27.5) :

yarn run lint:styles
yarn run v0.27.5
$ stylelint 'resources/assets/styles/**/*.{css,sass,scss,sss,less}'

Error: 'resources/assets/styles/**/*.{css,sass,scss,sss,less}' does not match any files
    at globby.then.filePaths (C:\wamp64\www\project\wp-content\themes\theme\node_modules\stylelint\lib\standalone.js:124:33)
error Command failed with exit code 80.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run build
yarn run v0.27.5
$ webpack --progress --config resources/assets/build/webpack.config.js
Error: Failed because of a stylelint error.

    at linterSuccess (C:\wamp64\www\project\wp-content\themes\theme\node_modules\stylelint-webpack-plugin\lib\run-compilation.js:34:14)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Removing the added quote around resources/assets/styles/**/*.{css,sass,scss,sss,less} fix the issue.

After removing the quote, run lint:styles correctly output styles errors. But, run build do not throw anything more "useful" than Error: Failed because of a stylelint error. Would be cool to have the Lint output on global build.
errors and errorDetails are true in webpack.config.js.

Test:
Setting StyleLintPlugin failOnError at false seems to finish the build successfuly, even if command end outputing error Command failed with exit code 2. Note that before this last message, Lint errors about my SCSS are outputed.

Related: https://discourse.roots.io/t/yarn-build-error-exit-code-2/10225

@oxyc
Copy link
Contributor Author

oxyc commented Aug 20, 2017

Seems cmd.exe passes along single quotes according to eslint/eslint#5796 (comment). Using double quotes would work just as well on *nix and should fix it on Windows I guess. @mtx-z could you test if it works if you change the task in package.json to use " rather than '.

@oxyc
Copy link
Contributor Author

oxyc commented Aug 20, 2017

@mtx-z I opened up a PR, could you verify if it fixes the issue.

@mtx-z
Copy link

mtx-z commented Aug 20, 2017

@oxyc you are right, it works with double quote. But they need to be escaped as we already are between two double quotes.

To resume:
WORK (w/ escaped double quotes):
"lint:styles": "stylelint \"resources/assets/styles/**/*.{css,sass,scss,sss,less}\""

FAIL (w/ single quotes):
"lint:styles": "stylelint 'resources/assets/styles/**/*.{css,sass,scss,sss,less}'"

WORK (without any quote, but i understand we need them)
"lint:styles": "stylelint resources/assets/styles/**/*.{css,sass,scss,sss,less}"

@oxyc oxyc mentioned this pull request May 1, 2019
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.

3 participants