更新TSLint错误:找不到配置中指定的以下规则的实现 [英] Update TSLint Errors : Could not find implementations for the following rules specified in the configuration

查看:192
本文介绍了更新TSLint错误:找不到配置中指定的以下规则的实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将tslint升级到4.0.2,现在出现很多类似以下的错误

 找不到配置中指定的以下规则的实现:指令选择器名称组件选择器名称指令选择器类型组件选择器类型指令选择器前缀组件选择器前缀标签未定义无构造变量无重复密钥不可达使用限制 

我认为问题可能是我的tslint.json可能已过时,我需要对其进行更新,但是我没有找到任何有关如何执行此操作的信息,即使我的假设正确无误.

tslint.json

  {"rulesDirectory":["node_modules/codelyzer"],规则":{"directive-selector-name":[true,"camelCase"],"component-selector-name":[true,"kebab-case"],"directive-selector-type":[true,"attribute"],"component-selector-type":[true,"element"],"directive-selector-prefix":[true,"my"],"component-selector-prefix":[true,"my"],"use-input-property-decorator":是的,"use-output-property-decorator":是的,使用主机属性装饰器":是的,"no-attribute-parameter-decorator":是的,"no-input-rename":是的,"no-output-rename":是的,"no-forward-ref":是的,使用生命周期接口":是的,"use-pipe-transform-interface":是的,管道命名":[true,"camelCase","my"],"component-class-suffix":是的,"directive-class-suffix":是的,禁令":[是的,[_, 延长"],[_, 一片空白"],[_, 被定义为"]],类名":true,评论格式":[false,检查空间",检查小写"],"curly":是的,"eofline":是的,"forin":是的,缩进":[true,2],接口名称":true,"jsdoc格式":是的,标签位置":true,标签未定义":true,"max-line-length":[false,140],会员订购":[true,私有之前",事前静态",函数前的变量"],"no-arg":是的,无位":是的,无控制台":[true,调试",信息",时间","timeEnd",痕迹"],"no-construct":是的,"no-constructor-vars":否,"no-debugger":是的,无重复密钥":是的,无重复变量":true,无空":是的,无评价":是的,"no-string-literal":是的,无开关掉线":是的,逗号":是的,"no-trailing-spacespace":是的,"no-unused-expression":是的,没有未使用的变量":是的,不可逾越":是的,声明前不使用":是的,"no-var-requires":是的,一行":[是的,检查打开括号",检查赶上",检查其他",检查空白"],"quotemark":[true,"single"],"radix":是的,分号":是的,"triple-equals":[true,"allow-null-check"],"typedef":[是,"callSignature","indexSignature",范围","propertySignature","variableDeclarator"],"typedef-whitespace":[true,["callSignature","noSpace"],["catchClause","noSpace"],["indexSignature",空格"]],使用限制":false,变量名称":false,空白":[true,支票支票",检查决定",检查操作员",检查分隔符",检查类型"]}} 

packages.json

  {依赖关系":{"@ angular/common":"^ 2.2.4","@ angular/compiler":"^ 2.2.4","@ angular/core":"^ 2.2.4","@ angular/forms":"^ 2.2.4","@ angular/http":"^ 2.2.4","@ angular/platform-b​​rowser":"^ 2.2.4","@ angular/platform-b​​rowser-dynamic":"^ 2.2.4","@ angular/router":"^ 3.2.4","@ ng-bootstrap/ng-bootstrap":"^ 1.0.0-alpha.14","ag-grid":"^ 7.0.0","angularfire2":"^ 2.0.0-beta.5","core-js":"^ 2.4.1","firebase":"^ 3.6.2","rxjs":"5.0.0-rc.4","zone.js":"^ 0.7.2"},"devDependencies":{"del":"^ 2.0.2","gulp":"gulpjs/gulp#4ed9a4a3275559c73a396eff7e1fde3824951ebb","gulp-hub":"frankwallis/gulp-hub#d461b9c700df9010d0a8694e4af1fb96d9f38bf4","gulp-filter":"^ 4.0.0","gulp-util":"^ 3.0.7","gulp-sass":"^ 2.1.1","browser-sync":"^ 2.18.2","browser-sync-spa":"^ 1.0.3",业力":"^ 1.3.0","karma-coverage":"^ 1.1.1",业力茉莉花":"^ 1.0.2","karma-junit-reporter":"^ 1.1.0",茉莉花":"^ 2.4.1","es6-shim":"^ 0.35.0","karma-chrome-launcher":"^ 2.0.0","babel-plugin-istanbul":"^ 3.0.0","karma-webpack":"^ 1.7.0","webpack":"2.1.0-beta.20","html-webpack-plugin":"^ 2.24.1","style-loader":"^ 0.13.0","css-loader":"^ 0.26.0","postcss-loader":"^ 1.1.1","autoprefixer":"^ 6.5.3","json-loader":"^ 0.5.4","extract-text-webpack-plugin":"^ 2.0.0-beta.3","html-loader":"^ 0.4.3","ts-loader":"^ 1.2.2","sass-loader":"^ 4.0.2","node-sass":"^ 3.13.0","eslint":"^ 3.11.1","eslint-config-xo-space":"^ 0.15.0","eslint-loader":"^ 1.6.1","babel-loader":"^ 6.2.8","babel-eslint":"^ 7.1.1","eslint-plugin-babel":"^ 4.0.0","tslint":"^ 4.0.2","typescript":"^ 2.0.10","typings":"^ 2.0.0","tslint-loader":"^ 3.2.1","codelyzer":"^ 2.0.0-beta.1"},脚本":{"build":"gulp","serve":"gulp serve","serve:dist":"gulp serve:dist","test":大口测试","test:auto":大嘴测试:auto"},"eslintConfig":{"root":是的,"env":{浏览器":是的,茉莉花":true},扩展":["xo-space/esnext"]}} 

解决方案

我在同一条船上.我不知道您以前的tslint版本是什么,但对我来说,我从3.15.1升级到4.0.2,因此产生的破坏规则"列表与您的不同.不过,我可以为您和我的共同之处提供一些修复/说明.

我只是去了 tslint在GitHub上的更新日志,发现该规则已被打破,在行末得到了发行号,&查找了问题.导航的最简单方法是将发行号添加到其GitHub发行URL的末尾.例如, label-undefined 是http//github.com/palantir/tslint/issues/877

这是我必须弄清楚的那些

  • 标签未定义-> Typescript编译器现在可以处理此问题,因此从tslint.json中删除"label-undefined":true ,然后添加"allowUnusedLabels":假到tsconfig.json的editorOptions部分
  • 无构造变量->重命名了规则,因此将无构造变量" 更改为无参数属性"
  • 无重复键->删除无重复键":true 现在,b/c打字稿一共处理(如果使用重复键,则不会编译)).
  • 不可访问的->打字机编译器现在可以处理此问题,因此从tslint.json中删除"no-unreachable":true ,然后添加"noImplicitReturns":true 到tsconfig.json的editorOptions部分
  • 使用限制->删除"use-strict" 规则,现在b/c打字稿现在以严格模式解析所有模块主体.

I upgraded my tslint to 4.0.2 and now I get a lot of errors like the following

Could not find implementations for the following rules specified in the configuration:
    directive-selector-name
    component-selector-name
    directive-selector-type
    component-selector-type
    directive-selector-prefix
    component-selector-prefix
    label-undefined
    no-constructor-vars
    no-duplicate-key
    no-unreachable
    use-strict

I believe the issue may be that my tslint.json may be out of date and I need to update it, but I have not found any information on how to do that or even if my assumption is correct.

tslint.json

{
  "rulesDirectory": [
    "node_modules/codelyzer"
  ],
  "rules": {
    "directive-selector-name": [true, "camelCase"],
    "component-selector-name": [true, "kebab-case"],
    "directive-selector-type": [true, "attribute"],
    "component-selector-type": [true, "element"],
    "directive-selector-prefix": [true, "my"],
    "component-selector-prefix": [true, "my"],
    "use-input-property-decorator": true,
    "use-output-property-decorator": true,
    "use-host-property-decorator": true,
    "no-attribute-parameter-decorator": true,
    "no-input-rename": true,
    "no-output-rename": true,
    "no-forward-ref" :true,
    "use-life-cycle-interface": true,
    "use-pipe-transform-interface": true,
    "pipe-naming": [true, "camelCase", "my"],
    "component-class-suffix": true,
    "directive-class-suffix": true,
    "ban": [true,
      ["_", "extend"],
      ["_", "isNull"],
      ["_", "isDefined"]
    ],
    "class-name": true,
    "comment-format": [false,
      "check-space",
      "check-lowercase"
    ],
    "curly": true,
    "eofline": true,
    "forin": true,
    "indent": [true, 2],
    "interface-name": true,
    "jsdoc-format": true,
    "label-position": true,
    "label-undefined": true,
    "max-line-length": [false, 140],
    "member-ordering": [true,
      "public-before-private",
      "static-before-instance",
      "variables-before-functions"
    ],
    "no-arg": true,
    "no-bitwise": true,
    "no-console": [true,
      "debug",
      "info",
      "time",
      "timeEnd",
      "trace"
    ],
    "no-construct": true,
    "no-constructor-vars": false,
    "no-debugger": true,
    "no-duplicate-key": true,
    "no-duplicate-variable": true,
    "no-empty": true,
    "no-eval": true,
    "no-string-literal": true,
    "no-switch-case-fall-through": true,
    "trailing-comma": true,
    "no-trailing-whitespace": true,
    "no-unused-expression": true,
    "no-unused-variable": true,
    "no-unreachable": true,
    "no-use-before-declare": true,
    "no-var-requires": true,
    "one-line": [true,
      "check-open-brace",
      "check-catch",
      "check-else",
      "check-whitespace"
    ],
    "quotemark": [true, "single"],
    "radix": true,
    "semicolon": true,
    "triple-equals": [true, "allow-null-check"],
    "typedef": [true,
      "callSignature",
      "indexSignature",
      "parameter",
      "propertySignature",
      "variableDeclarator"
    ],
    "typedef-whitespace": [true,
      ["callSignature", "noSpace"],
      ["catchClause", "noSpace"],
      ["indexSignature", "space"]
    ],
    "use-strict": false,
    "variable-name": false,
    "whitespace": [true,
      "check-branch",
      "check-decl",
      "check-operator",
      "check-separator",
      "check-type"
    ]
  }
}

packages.json

{
  "dependencies": {
    "@angular/common": "^2.2.4",
    "@angular/compiler": "^2.2.4",
    "@angular/core": "^2.2.4",
    "@angular/forms": "^2.2.4",
    "@angular/http": "^2.2.4",
    "@angular/platform-browser": "^2.2.4",
    "@angular/platform-browser-dynamic": "^2.2.4",
    "@angular/router": "^3.2.4",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.14",
    "ag-grid": "^7.0.0",
    "angularfire2": "^2.0.0-beta.5",
    "core-js": "^2.4.1",
    "firebase": "^3.6.2",
    "rxjs": "5.0.0-rc.4",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "del": "^2.0.2",
    "gulp": "gulpjs/gulp#4ed9a4a3275559c73a396eff7e1fde3824951ebb",
    "gulp-hub": "frankwallis/gulp-hub#d461b9c700df9010d0a8694e4af1fb96d9f38bf4",
    "gulp-filter": "^4.0.0",
    "gulp-util": "^3.0.7",
    "gulp-sass": "^2.1.1",
    "browser-sync": "^2.18.2",
    "browser-sync-spa": "^1.0.3",
    "karma": "^1.3.0",
    "karma-coverage": "^1.1.1",
    "karma-jasmine": "^1.0.2",
    "karma-junit-reporter": "^1.1.0",
    "jasmine": "^2.4.1",
    "es6-shim": "^0.35.0",
    "karma-chrome-launcher": "^2.0.0",
    "babel-plugin-istanbul": "^3.0.0",
    "karma-webpack": "^1.7.0",
    "webpack": "2.1.0-beta.20",
    "html-webpack-plugin": "^2.24.1",
    "style-loader": "^0.13.0",
    "css-loader": "^0.26.0",
    "postcss-loader": "^1.1.1",
    "autoprefixer": "^6.5.3",
    "json-loader": "^0.5.4",
    "extract-text-webpack-plugin": "^2.0.0-beta.3",
    "html-loader": "^0.4.3",
    "ts-loader": "^1.2.2",
    "sass-loader": "^4.0.2",
    "node-sass": "^3.13.0",
    "eslint": "^3.11.1",
    "eslint-config-xo-space": "^0.15.0",
    "eslint-loader": "^1.6.1",
    "babel-loader": "^6.2.8",
    "babel-eslint": "^7.1.1",
    "eslint-plugin-babel": "^4.0.0",
    "tslint": "^4.0.2",
    "typescript": "^2.0.10",
    "typings": "^2.0.0",
    "tslint-loader": "^3.2.1",
    "codelyzer": "^2.0.0-beta.1"
  },
  "scripts": {
    "build": "gulp",
    "serve": "gulp serve",
    "serve:dist": "gulp serve:dist",
    "test": "gulp test",
    "test:auto": "gulp test:auto"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "browser": true,
      "jasmine": true
    },
    "extends": [
      "xo-space/esnext"
    ]
  }
}

解决方案

I was in the same boat. I don't know what your previous version of tslint was, but, for me, I upgraded from 3.15.1 to 4.0.2 and my resulting "broken rule" list is different than yours. Still, I can offer you a few fixes/explanations to the ones you and I had in common.

I just went to the tslint's changelog on GitHub, found the rule that was broken, got the issue number at the end of the line, & looked up the issue. Easiest way to navigate was to add the issue number to the end of their GitHub issue URL. For example, label-undefined was http//github.com/palantir/tslint/issues/877

Here's the ones I had to figure out

  • label-undefined -> typescript compiler handles this now, so remove "label-undefined": true from tslint.json and then add "allowUnusedLabels": false to the compilerOptions section of your tsconfig.json
  • no-constructor-vars -> renamed the rule, so change "no-constructor-vars" to "no-parameter-properties" in your tslint.json
  • no-duplicate-key -> remove "no-duplicate-key": true altogether b/c typescript now handles it (won't compile if dup keys).
  • no-unreachable -> typescript compiler handles this now, so remove "no-unreachable": true from tslint.json and then add "noImplicitReturns": true to the compilerOptions section of your tsconfig.json
  • use-strict -> remove "use-strict" rule altogether b/c typescript now parses all module bodies in strict mode.

这篇关于更新TSLint错误:找不到配置中指定的以下规则的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆