简体   繁体   English

IntelliJ IDEA显示错误的JavaScript文件

[英]IntelliJ IDEA displaying JavaScript files with errors

在此处输入图片说明

I am new to IntelliJ Idea. 我是IntelliJ Idea的新手。 When viewing .js files through the IDE it will display an issue with pink color in the header saying 通过IDE查看.js文件时,标题中会显示一个粉红色的问题

JSCS: Cannot find 'jscs' script file under JSCS package directory. JSCS:在JSCS软件包目录下找不到'jscs'脚本文件。

I have tried to solve it by configuring JSCS settings but that import doesn't work. 我试图通过配置JSCS设置来解决该问题,但是该导入无法正常工作。 I think that occurred due to use strict keyword. 我认为是由于use strict关键字而发生的。

So how I can resolve that issue? 那么我该如何解决这个问题呢?

You have 2 options: 您有2个选择:

  1. Open File -> Settings and type jscs in the search box, then uncheck the enable checkbox. 打开文件->设置,然后在搜索框中键入jscs,然后取消选中启用复选框。 This will turn jscs off. 这将关闭jscs。
  2. Keep it enabled. 保持启用状态。 Install jscs: npm i jscs -g and then set JSCS Package to point to : C:\\Users\\<my_user>\\AppData\\Roaming\\npm\\node_modules\\jscs\\bin\\jscs (on windows, not sure where is it installed on linux). 安装jscs: npm i jscs -g ,然后将JSCS Package设置为指向: C:\\Users\\<my_user>\\AppData\\Roaming\\npm\\node_modules\\jscs\\bin\\jscs (在Windows上,不确定在哪里安装) Linux版)。 You also need to add a .jscsrc file in the root of your project, you can find a few presets here 您还需要在项目的根目录中添加.jscsrc文件,您可以在此处找到一些预设

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM