javascript - 如何为制表符而不是空格配置 ESLint?
问题描述
我的根目录中有一个 .eslintrc 文件:
{
"extends": "airbnb",
"env": {
"browser": true,
"node": true,
"jquery": true
},
"rules": {
"no-unused-vars": [0,{"argsIgnorePartern": "res|next|~err"}],
"arrow-body-style": ["error", "as-needed"],
"no-param-reassign": 0,
"eqeqeq": [
"error",
"smart"
],
"no-shadow": "off",
"allowIndentationTabs": true,
"import/newline-after-import": ["error", { "count": 0 }],
"no-console": 0,
"import": 0,
"func-names": 0,
"space-before-function-paren": 0,
"comma-dangle": 0,
"max-len": 0,
"no-underscore-dangle": 0,
"react/prefer-es6-class": 0,
"radix": 0,
"indent": [1, "tab"],
"react/jsx-indent": ["error", 4],
"arrow-parens": [2, "as-needed"],
"function-paren-newline": ["error", "consistent"],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/prefer-stateless-function": "off",
"no-use-before-define": ["error",{ "functions": false, "variables": false }],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }]}
}
我收到以下错误:
意外的制表符 eslint(无制表符)
所以我添加了这条规则:"allowIndentationTabs": true
但是,我仍然收到该错误。我还确保我的 VSCode 配置为制表符而不是空格。这有点让我发疯。我想,该规则会覆盖任何 airbnbs 规则,但我想不会。我勒个去?!
解决方案
好像airbnb还有一条规则,所以我就改写了:
"no-tabs": 0
推荐阅读
- c# - languageext 或 asyn 与聚合绑定与验证
- flutter - 如何在 Flutter 中基于 Firebase AuthState 向作为路由器工作的 StreamBuilder 添加动画?
- laravel - 使用 laravel 向存储在数据库中的所有号码发送 nexmo 短信
- flutter - 无法在我的颤振项目中安装依赖项
- data-structures - 如果Redis Sorted Set是用Skip List实现的,为什么ZPOPMIN时间复杂度是O(log n)?
- java - 为上传的文件创建 URL
- security - 如何创造加工挑战
- reactjs - Redux Saga 中的无限循环
- c++ - 在 Cmake 中链接 libavcodec,find_library 不适用于任何库
- sh - 使用busybox sh将多行输出捕获到Bash变量中