JSCS
Required plugin:
Javascript and TypeScript
- The plugin is available only in IntelliJ IDEA Ultimate, where it is enabled by default.
JSCS
- Install the plugin on the Settings | Plugins page, tab Marketplace.
The plugins are available only in IntelliJ IDEA Ultimate.
warning
Since IntelliJ IDEA 2020.2, JSCS support in the IDE has been deprecated, refer to the JSCS official website for details.
However, JSCS support is still available through the JSCS plugin, which can be installed on the Settings | Plugins page as described in Installing plugins from JetBrains Marketplace.
When JSCS support is enabled, IntelliJ IDEA highlights errors that JSCS detects, provides descriptions for them, and suggests quick-fixes where possible.
Descriptions of the errors detected in the current file and quick-fixes for them are available from the editor and from the File tab of the Problems tool window.
Errors in all previously opened files and quick-fixes for them are shown in the Project Errors tab of the Problems tool window. To open the tool window, click the Inspection widget in the upper-right corner of the editor:
For more information, refer to View problems and apply quick-fixes in the editor and Problems tool window.
IntelliJ IDEA also provides code completion in JSCS configuration files.
Download and install Node.js.
Install and enable the JSCS plugin on the Settings | Plugins page, tab Marketplace, as described in Installing plugins from JetBrains Marketplace.
If the JSCS repository plugin is missing, IntelliJ IDEA suggests installing it when you open a .jscsrc or a .jscs.json configuration file.
In the embedded Terminal () , type:
npm install --g jscs
In the Settings dialog () , go to Languages & Frameworks | JavaScript | Code Quality Tools | JSCS. On the JSCS page, that opens, select the Enable checkbox. After that the other controls on the page become available.
In the Node Interpreter field, specify the path to Node.js. If you followed the standard installation procedure, IntelliJ IDEA detects the path and fills in the field itself.
In the JSCS Package field, specify the location of the
jscs
package.If you installed JSCS through the Node Package Manager, IntelliJ IDEA locates the package itself and fills in the field automatically. Otherwise, type the path manually or click and select the package location in the dialog that opens.
Specify the configuration to use.
Search for config(s) - select this option if JSCS rules are configured in your project package.json, in .jscsrc, or in .jscs .json.
IntelliJ IDEA will first look for a
jscsConfig
property in the project package .json.If no
jscsConfig
property is found, IntelliJ IDEA will look for a .jscsrc or a .jscs.json configuration file. IntelliJ IDEA starts the search from the folder where the file to be checked is stored, then searches in the parent folder, and so on until the project root is reached.Configuration File - select this option if JSCS rules are configured in a custom JSON file. Specify the file location in the Path field. Select the path from the list or click and select the relevant file in the dialog that opens.
To apply a predefined set of rules associated with the code style you are using, select the set from the Code Style Preset list.
tip
You can use the selected set independently or in addition to a configuration file. Note that rules from configuration files override predefined rules.