javascript - 找不到配置中指定的以下规则的实现
问题描述
我正在使用下面将我的 tslint 转换为 eslint
这是我的tslint.json
文件:
https://github.com/kumaresan-subramani/ESlint-tester/blob/main/tslint.json
我的 eslint.json 文件
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"@typescript-eslint/tslint"
],
"parserOptions": {
"project": "tsconfig.json"
},
"rules": {
"@typescript-eslint/tslint/config": ["warn", {
"lintFile": "./tslint.json", // path to tslint.json of your project
"rules": {},
"rulesDirectory": [
"node_modules/tslint-eslint-rules/dist/rules"
]
}]
},
"reportUnusedDisableDirectives": true
}
在给出以下命令时 ia 面临错误
纱线运行 eslint src
错误
D:\today\ESlint-tester>yarn run eslint src
yarn run v1.21.1
$ D:\today\ESlint-tester\node_modules\.bin\eslint src
Could not find implementations for the following rules specified in the configuration:
chai-vague-errors
no-redundant-jsdoc
missing-optional-annotation
no-backbone-get-set-outside-model
no-banned-terms
no-cookies
no-delete-expression
no-document-write
no-document-domain
no-disable-auto-sanitization
no-duplicate-parameter-names
no-empty-interfaces
no-exec-script
no-function-constructor-with-string-args
no-function-expression
no-for-in
no-multiline-string
no-multiple-var-decl
no-unnecessary-bind
no-unnecessary-semicolons
no-octal-literal
no-sparse-arrays
no-string-based-set-immediate
no-string-based-set-interval
no-unused-imports
no-with-statement
prefer-array-literal
promise-must-complete
react-no-dangerous-html
use-named-parameter
max-func-body-length
no-empty-line-after-opening-brace
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.
解决方案
您正在使用typescript-eslint这是一个:
ESLint 插件 [that] 包装了 TSLint 配置并使用 TSLint 对整个源代码进行 lints。
但是错误信息:
Could not find implementations for the following rules specified in the configuration:
来自 TSLint 本身。原因是您的规则tslint.json
与您的 TSLint 版本不兼容。
您必须更改 TSLint 版本或通过查看TSLint ChangeLog来调整规则。请注意,typescript-eslint 需要 5.x 或 6.x TSLint 版本(参见它的package.json)。
您还可以检查这个 SO 问题:更新 TSLint 错误:找不到配置中指定的以下规则的实现
推荐阅读
- html - CSS 选择器选择一个元素,如果它只包含另一个元素,没有任何其他文本
- python - 使用套接字的 MetaTrader 5 和 Python 集成
- java - 如何在应用程序图标上设置通知徽章
- java - 如何在Java中找到数组中的最大数
- bash - 如果条件在 shell 脚本中不起作用
- c# - TableLayoutPanel 的适当锚点设置以实现所需的行为
- ios - 关于使用 PHAuthorizationStatus.authorizationStatus() 的问题
- swift - “无法分配 'AuthDataResult 类型的值?' 键入“用户?” 并且“AuthDataResult”类型的值没有成员“uid”
- amazon-kinesis - 尝试放置记录时出现运动异常
- r - 如何基于列创建成对表以在r中的元素之间进行划分