Reputation: 3141
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)?
Upvotes: 10
Views: 13180
Reputation: 311
Ceate watcher (Settings > Tools > File Wathcers) with settings below:
Program - $ProjectFileDir$\node_modules\.bin\stylelint
Arguments - $FilePath$ --fix
Outout path to refresh - $FilePath$
Working directory - $FileDir$
Upvotes: 1
Reputation: 3141
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
Upvotes: 18
Reputation: 93738
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
:
Upvotes: 15