首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >删除一些tslint规则

删除一些tslint规则
EN

Stack Overflow用户
提问于 2019-11-05 05:55:42
回答 3查看 3.3K关注 0票数 0

我需要从我的tslint.json中删除下面的tslint规则。

应该以newline

  • trailing whitespace

  • missing空格

  • 结尾的
  1. 文件应该是'

为了删除空白,我通过查看这个check-type删除了issue

但是,当我在cli上运行ng lint命令时,仍然会出现错误。有人知道如何从我的tslint.json文件中删除上述规则吗?

tslint.json

代码语言:javascript
复制
    {
  "rulesDirectory": [
    "node_modules/codelyzer"
  ],
  "rules": {
    "arrow-return-shorthand": true,
    "callable-types": true,
    "class-name": true,
    "comment-format": [
      false,
      "check-space"
    ],
    "curly": true,
    "eofline": true,
    "forin": true,
    "import-blacklist": [
      true,
      "rxjs",
      "rxjs/Rx"
    ],
    "import-spacing": true,
    "indent": [
      false,
      "spaces"
    ],
    "interface-over-type-literal": true,
    "label-position": true,
    "max-line-length": [
      true,
      200
    ],
    "member-access": false,
    "member-ordering": [
      true,
      {
        "order": [
          "static-field",
          "instance-field",
          "static-method",
          "instance-method"
        ]
      }
    ],
    "no-arg": true,
    "no-bitwise": true,
    "no-console": [
      true,
      "debug",
      "info",
      "time",
      "timeEnd",
      "trace"
    ],
    "no-construct": true,
    "no-debugger": true,
    "no-duplicate-super": true,
    "no-empty": false,
    "no-empty-interface": true,
    "no-eval": true,
    "no-inferrable-types": [
      true,
      "ignore-params"
    ],
    "no-misused-new": true,
    "no-non-null-assertion": true,
    "no-shadowed-variable": true,
    "no-string-literal": false,
    "no-string-throw": true,
    "no-switch-case-fall-through": true,
    "no-trailing-whitespace": true,
    "no-unnecessary-initializer": true,
    "no-unused-expression": true,
    "no-use-before-declare": true,
    "no-var-keyword": true,
    "object-literal-sort-keys": false,
    "one-line": [
      true,
      "check-open-brace",
      "check-catch",
      "check-else",
      "check-whitespace"
    ],
    "prefer-const": true,
    "quotemark": [
      true,
      "single"
    ],
    "radix": true,
    "semicolon": [
      true,
      "always"
    ],
    "triple-equals": [
      true,
      "allow-null-check"
    ],
    "typedef-whitespace": [
      true,
      {
        "call-signature": "nospace",
        "index-signature": "nospace",
        "parameter": "nospace",
        "property-declaration": "nospace",
        "variable-declaration": "nospace"
      }
    ],
    "typeof-compare": true,
    "unified-signatures": true,
    "variable-name": false,
    "whitespace": [
      false,
      "check-branch",
      "check-decl",
      "check-operator",
      "check-separator",
      "check-type"
    ],
    "directive-selector": [
      true,
      "attribute",
      "app",
      "camelCase"
    ],
    "component-selector": [
      true,
      "element",
      "app",
      "kebab-case"
    ],
    "use-input-property-decorator": true,
    "use-output-property-decorator": true,
    "use-host-property-decorator": true,
    "no-input-rename": true,
    "no-output-rename": true,
    "use-life-cycle-interface": true,
    "use-pipe-transform-interface": true,
    "component-class-suffix": true,
    "directive-class-suffix": true,
    "invoke-injectable": true
  }
}
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2019-11-05 06:08:06

删除tsLint中的以下内容:

"no-trailing-whitespace": true,

"whitespace": [ false, "check-branch", "check-decl", "check-operator", "check-separator", "check-type" ],

"quotemark": [ true, "single" ],

"eofline": true,

票数 0
EN

Stack Overflow用户

发布于 2019-11-05 06:15:43

1.文件应以新行结尾。

代码语言:javascript
复制
"eofline": true,

2.尾随空格

代码语言:javascript
复制
"no-trailing-whitespace": false,

3.缺失的空白

代码语言:javascript
复制
"whitespace": [
  false,
  "check-branch",
  "check-decl",
  "check-operator",
  "check-separator",
  "check-type"
],

4.“应该是”

代码语言:javascript
复制
"quotemark": [
  true,
  "single"
],
票数 1
EN

Stack Overflow用户

发布于 2019-11-05 06:21:12

下面是我在根文件夹中如何实现tslint.json文件的方法:

但是首先将"no-trailing-whitespace": true改为false in tslint.json

只是警告你。更漂亮的强制执行。你可能想看看那些更漂亮的医生。我花了一段时间微调我的曲子。现在我只是在我所有的应用程序中使用它。

  1. 在我的.editorconfig文件中,我有以下内容,每一个新的角度应用程序都有:

编辑器配置,见http://editorconfig.org root = true * charset = utf-8 indent_style = space indent_size =2 insert_final_newline = true trim_trailing_whitespace = true *.md max_line_length = off trim_trailing_whitespace = false

  1. 使用更漂亮。使用.prettierrc文件:

{ "arrowParens":“避免”,"bracketSpacing":真,"endOfLine":"auto","htmlWhitespaceSensitivity":“严格”,“半”:真,"singleQuote":真,"tabWidth":2,"trailingComma":"all","useTabs":false }

recommendation:文件夹vscode中的

  1. (只要启动vs代码,就会提示您安装extensions.json )。

//请参阅http://go.microsoft.com/fwlink/?LinkId=827846以了解工作区建议。//扩展标识符格式:${publisher}.${name}。示例: vscode.csharp //扩展列表,这些扩展应该推荐给此工作区的用户。{“建议”:“Angular.ng-模板”、"DavidAnson.vscode-markdownlint“、"eamodio.gitlens”、"EditorConfig.EditorConfig“、”esbenp.premier-vscode“、"mike-co.import-sorter”、“ms-vscode.vscode-typescript-tslint”、"unwantedRecommendations":“amatiasq.sort-import”、"eg2.tslint“、"HookyQR.beautify”}

  1. package.json添加这些,然后做npm install

“更漂亮”:"1.18.2",“量角器”:"5.4.2",“tslint漂亮”:"1.18.0",“tslint-一致性-codestyle”:"1.16.0",“tslint漂亮”:"2.0.1",

  1. In tslint.json (使用下面的内容,如果您不在上面添加#4 ),您将得到一个警告,说明它们丢失了,并且恼人的黄色代码突出显示:

{ "defaultSeverity":“错误”,“扩展”:“tslint:最新”,“tslint-config-漂亮”,“tslint-一致-codestyle”,“规则”:{……

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58705282

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档