我已经跟随 .eslintrc
.eslintrc
{ "extends": "standard" }
在我的 javascript 文件中有以下代码
import React from 'react';
根据 eslint 的说法,上面的代码行是不正确的。
"; Extra semicolon
我怎么能在 eslint 中使用分号呢?
eslint-config-standard uses the following rule for semicolons:
eslint-config-standard
"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 -
"always"
"never"
[
(
/
+
-
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
.eslintrc.js
{ "extends": "standard", "rules": { "semi": [1, "always"] } }
Good Luck...