node.js 如何禁用 WebStorm 分号检查?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31583771/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 19:00:48  来源:igfitidea点击:

How to disable WebStorm semicolon check?

node.jsecmascript-6webstorm

提问by Haven

How to disable WebStorm semicolon check in Node.js?

如何在 Node.js 中禁用 WebStorm 分号检查?

I have tried the following method but they do not work:

我尝试了以下方法,但它们不起作用:

  • Checked out the option use semicolon to terminate statement
  • Changed JavaScript version to ecma6
  • 检查了选项 use semicolon to terminate statement
  • 将 JavaScript 版本更改为 ecma6

回答by LazyOne

  1. Settings/Preferences | Editor | Inspections
  2. JavaScript | Code style issues | Unterminated statement-- disable this inspection
  1. Settings/Preferences | Editor | Inspections
  2. JavaScript | Code style issues | Unterminated statement-- 禁用此检查

You can also reach the same inspection by:

您还可以通过以下方式进行相同的检查:

  1. Placing caret on problematic place in your Editor and bringing Quick Fix menu (Alt + Enteror by clicking on light bulb icon)
  2. Choosing right option in appeared menu (if not sure which one then try step #3 for few of them)
  3. Arrow Right(or click on small triangle on the right side) to open submenu
  4. Choose desired action
  1. 在编辑器中有问题的地方放置插入符号并带来快速修复菜单(Alt + Enter或通过单击灯泡图标)
  2. 在出现的菜单中选择正确的选项(如果不确定是哪一个,请尝试第 3 步)
  3. Arrow Right(或点击右侧的小三角)打开子菜单
  4. 选择想要的动作

P.S.JSLinh/JSHint and alike may also produce such warnings if you are using these tools.

PSJSLinh/JSHint 等也可能会在您使用这些工具时产生此类警告。



As for the actual code generated by IDE (e.g. when using Code | Reformat...or using code completion popup/functionality) -- such option is available at

至于由 IDE 生成的实际代码(例如,在使用Code | Reformat...或使用代码完成弹出窗口/功能时)——此类选项可在

  • Settings/Preferences | Editor | Code Style | JavaScript(similar path for TypeScript)
  • Punctuationtab
  • Settings/Preferences | Editor | Code Style | JavaScript(TypeScript 的类似路径)
  • Punctuation标签

enter image description here

在此处输入图片说明

回答by Aaron Zorel

In Preferences -> Editor -> Code Style -> JavaScript, click the Punctuationtab on the right hand side pane.

在首选项 -> 编辑器 -> 代码样式 -> JavaScript 中,单击Punctuation右侧窗格中的选项卡。

Set

Don't usesemicolon to terminate statements always

Don't use分号终止语句 always

This would allow you to check for unterminated statements while not flagging up the missing semicolons.

这将允许您检查未终止的语句,同时不标记丢失的分号。

回答by Philip O'Brien

Using Webstorm->Preferences->Editor->Code Style->JavaScript Use semicolon to terminate spacesworks fine for me. Maybe double check what Code Style scheme you are setting that for. Sometimes I have changed code style settings, but for a different scheme than the one being applied to the project in question.

使用Webstorm->Preferences->Editor->Code Style->JavaScript Use semicolon to terminate spaces对我来说很好。也许仔细检查您正在设置的代码样式方案。有时,我更改了代码样式设置,但使用的方案与应用于相关项目的方案不同。

enter image description here

在此处输入图片说明

回答by Airon Tark

Cmd(Ctrl) + Shift+ A→ Unterminated statement → OFF

Cmd( Ctrl) + Shift+ A→ 未终止语句 → OFF

enter image description here

在此处输入图片说明

回答by Vladislav Zaynchkovsky

We were also straggling with it all the time. To make our life easier we even commit idea styling file. To make it work for every team member.

我们也一直在挣扎。为了让我们的生活更轻松,我们甚至提交了想法样式文件。使其适用于每个团队成员。

Open setting/preferences => search by rule text => disable it.

打开设置/首选项 => 按规则文本搜索 => 禁用它。

Once you disabled this or any other rule. To stop it appear again you can add to .gitignore:

一旦禁用此规则或任何其他规则。要阻止它再次出现,您可以添加到 .gitignore:

### Commit specific idea files
.idea/*
!.idea/inspectionProfiles
.idea/inspectionProfiles/*
!.idea/inspectionProfiles/Project_Default.xml

I didn't find any better way to configure it. So...

我没有找到任何更好的方法来配置它。所以...

回答by Ivor Scott

In Webstorm 2017 its here, you just need to change "use" to "don't use" instead.

在 Webstorm 2017 中,您只需要将“使用”改为“不使用”即可。

Webstorm 2017

网络风暴 2017