[英]Eslint - How to Indent Import Export Statements
I just upgraded my Eslint after a long time and all of a sudden, I have a lot of errors. 很长时间之后,我才升级了Eslint,突然之间,我有很多错误。 Of note & issues raised below is
indentation
. 值得注意的是,下面提出的问题是
indentation
。 Maybe its worth mentioning that I use tabs
instead of spaces
for my indentation 也许值得一提的是,我使用
tabs
代替spaces
来缩进
Problem: My import values are indented as per the eslint indentation terminology "first". 问题:我的导入值按照eslint缩进术语“ first”缩进。 "first" basically means, all additional declarations are indented to align with the first property.
“第一个”基本上意味着,所有其他声明都缩进以与第一个属性对齐。 See this:
看到这个:
Solutions I tried: Here is what my indentation rules look like within '.eslintrc' file: 我尝试过的解决方案:这是我的缩进规则在“ .eslintrc”文件中的样子:
"indent" : [ 1, "tab", {
"FunctionExpression": {
"body": 1,
"parameters": "first" },
"VariableDeclarator": {
"var" : 2,
"let" : 2,
"const" : 3
},
"MemberExpression": 0,
"FunctionDeclaration": {
"parameters": "first" },
"ObjectExpression" : "first"
}],
Even though I am using tab
, not space
for indetation, I still had to use the VariableDeclarator
rule above to align all the vars/lets/constants etc. However, import
& export
are still flagged up and I cannot find any rule which resolve these indentations. 即使我使用
tab
,而不是用于插入的space
,我仍然必须使用上面的VariableDeclarator
规则来对齐所有var / let / constants等。但是, import
和export
仍被标记,并且我找不到任何解决这些问题的规则压痕。 So, how do I indent import/export statements? 那么,如何缩进导入/导出语句?
There has been some work for this enhancement to indent
rule. 对于
indent
规则的这种增强有一些工作。 Please follow the conversation here: https://github.com/eslint/eslint/pull/8955 请在此处关注对话: https : //github.com/eslint/eslint/pull/8955
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.