WebStorm 2017.3 Help

Stylelint

WebStorm provides facilities to run CSS-specific code quality inspections through integration with the Stylelint code verification tool. The tool registers itself as a WebStorm code inspection: it checks CSS code for most common mistakes and discrepancies without running the application. When a tool is activated, it launches automatically on the edited CSS file. Discrepancies are highlighted and reported in pop-up information windows, a pop-up window appears when you hover the mouse pointer over a stripe in the Validation sidebar. You can also press Alt+Enter to examine errors and apply suggested quick fixes. Learn more about inspections and intention actions at Code Inspection and Intention Actions.

Before you start

  1. Integration with WebStorm is supported through the CSS plugin. The plugin is activated by default. If the plugin is disabled, enable it on the Plugins settings page as described in Enabling and Disabling Plugins.
  2. Stylelint is run through Node.js, therefore make sure the Node.js runtime environment is downloaded and installed on your computer. The runtime environment also contains the Node Package Manager(npm) through which Stylelint is installed.
  3. Integration with Node.js and NPM is supported through the NodeJs plugin. The plugin is activated by default. If the plugin is disabled, enable it on the Plugins settings page as described in Enabling and Disabling Plugins.

Installing Stylelint

  1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or WebStorm | Preferences for macOS, and click Node.js and NPM under Languages & Frameworks.
  2. On the Node.js and NPM page that opens, the Packages area shows all the Node.js-dependent packages that are currently installed on your computer, both at the global and at the project level. Click new.
  3. In the Available Packages dialog box that opens, select the stylelint package and click Install Package.

    Learn more about installing tools through NPM in NPM.

Activating and configuring Stylelint

  1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or WebStorm | Preferences for macOS. Expand the Languages & Frameworks node, and then click Stylelint under Stylesheets. The Stylelint page opens.
  2. Select the Enable checkbox to activate Stylelint. After that the controls in the dialog box become available.
  3. In the Node Interpreter field,

    specify the Node.js interpreter to use. Choose one of the configured interpreters or click browseButton.png and configure a new one as described in Configuring Node.js Interpreters.

  4. In the Stylelint Package field, specify the location of the stylelint package installed globally or in the current project, see Stylelint.
Last modified: 26 March 2018

See Also