admin管理员组文章数量:1136516
I have following .eslintrc
{
"extends": "standard"
}
I have following code in my javascript file
import React from 'react';
Above line of code is incorrect according to eslint. It gives following complain.
"; Extra semicolon
How can I allow semi colons in eslint?
I have following .eslintrc
{
"extends": "standard"
}
I have following code in my javascript file
import React from 'react';
Above line of code is incorrect according to eslint. It gives following complain.
"; Extra semicolon
How can I allow semi colons in eslint?
Share Improve this question asked Nov 6, 2016 at 20:01 Om3gaOm3ga 32.8k45 gold badges149 silver badges229 bronze badges 1- Standard JS is well-known for omitting semicolons. Why do you want to add them if you're using Standard? – Ryan Commented Feb 1, 2018 at 1:57
2 Answers
Reset to default 186eslint-config-standard
uses the following rule for semicolons:
"semi": [2, "never"]
The documentation for the rule lists its options:
"always"
(default) requires semicolons at the end of statements"never"
disallows semicolons as the end of statements (except to disambiguate statements beginning with[
,(
,/
,+
, or-
To overide the rule, you could modify your .eslintrc
to always require semicolons:
{
"extends": "standard",
"rules": {
"semi": [2, "always"]
}
}
Or to disable the rule:
{
"extends": "standard",
"rules": {
"semi": 0
}
}
Modify your .eslintrc
(deprecated) or .eslintrc.js
(recommended) with
{
"extends": "standard",
"rules": {
"semi": [1, "always"]
}
}
Good Luck...
本文标签: buildallow semi colons in javascript eslintStack Overflow
版权声明:本文标题:build - allow semi colons in javascript eslint - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736945575a1957260.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论