I configured stylelint in my WebStorm (2018.2.3) in Settings -> Languages and Frameworks -> Stylesheets -> Stylelint
. And I have .stylelintrc in my root.
Right now stylelint successfully underlines errors in my css file.
But is there a way to fix them also with WebStorm help (without running --fix
command in console)?
Activate and configure Stylelint To activate Stylelint, open the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Languages & Frameworks | Style Sheets | Stylelint, and select the Enable checkbox.
I configured stylelint in my WebStorm (2018.2.3) in Settings -> Languages and Frameworks -> Stylesheets -> Stylelint. And I have .stylelintrc in my root. Right now stylelint successfully underlines errors in my css file.
Stylelint can automatically fix detected problems in the current file in unambiguous cases using the Stylelint Auto Fix functionality. To apply Auto Fix, click Stylelint: Fix current file in the popup. Alternatively, press Alt+Enter and select Stylelint: Fix current file from the list.
To enable running eslint --fix on save for the current project, go to Preferences / Settings | Languages and Frameworks | JavaScript | Code Quality Tools | ESLint and tick the Run eslint --fix on save checkbox. By default, WebStorm will run ESLint to autofix .js, .ts, .jsx, .tsx, .html, and .vue files.
Had the errors reported to my terminal and run npx stylelint src/scss/_file.scss --fix Try npx stylelint --fix style.css (note the --fix is before the CSS files path).
Stylelint autofixes are not yet supported, please follow WEB-25069 for updates.
You can set up a file watcher to have stylelint --fix
triggered in Save All
:
I created the external tool in Settings | Tools | External Tools, like this:
And then added the shortcut keymap for this command in here:
So now it fixes the whole file on the keymap press
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With