CLion provides facilities to run CSS-specific code quality inspections through integration with the Stylelint code verification tool. The tool registers itself as a CLion 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.
Before you start
- Install Node.js and configure it as a local Node.js interpreter.
- Install and enable the NodeJS repository plugin on the Plugins page as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
Installing Stylelint globally
Open the embedded Terminal ( ) and type
npm install -g stylelint at the command prompt.
Activating and configuring Stylelint
- In the Settings/Preferences dialog (Ctrl+Alt+S), click Stylesheets under Languages and Frameworks, and then click Stylelint. The Stylelint page opens.
- Select the Enable checkbox to activate Stylelint. After that the controls in the dialog box become available.
- In the Node Interpreter field, specify the Node.js interpreter to use. If you choose the
Projectalias, CLion will automatically use the project default interpreter from the Node interpreter field on the Node.js and NPM page.
In most cases, CLion detects the project default interpreter and fills in the field itself. You can also choose another configured local interpreter or click and configure a new one.
- In the Stylelint Package field, specify the location of the
stylelintpackage installed globally or in the current project.