- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近从我的 Angular 项目中删除了 tslint - 我读到它已经贬值了,所以我想我最好亲自动手并切换到 eslint。
因此,我删除了 tslint 文件,运行 ng add @angular-eslint/schematics
来安装 lint 原理图,安装了 airbnb typescript linter,修改了 ng lint
任务像这样运行...
"lint": "eslint -c .eslintrc.js --ext .ts ./src/app"
我添加了一个 .eslintrc.js
文件并使用以下内容填充它
module.exports = {
root: true,
extends: [
'airbnb-typescript/base',
'plugin:@angular-eslint/recommended'
],
ignorePatterns: [
'node_modules/',
'build/',
'dist/',
'e2e/'
],
rules: {
'comma-dangle': ['error', 'only-multiline'],
'max-len': ['error', {code: 120, tabWidth: 4}],
'no-underscore-dangle': 'off',
'no-await-in-loop': 'off',
'import/prefer-default-export': 'off',
'no-param-reassign': ['error', {props: false}],
'strict': ['error', 'global'],
'func-names': 'off', // I use a lot of unnamed functions
'global-require': 'off',
'class-methods-use-this': 'off', // Disabled for Angular Controllers,
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
ts: 'never',
}
]
},
plugins: [
'@angular-eslint/eslint-plugin'
],
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
}
}
一切都运行得很好...但是当我运行 ng lint
时,我收到以下错误...
1:1 错误 找不到规则“@typescript-eslint/space-infix-ops”的定义 @typescript-eslint/space-infix-ops1:1 错误未找到规则“@typescript-eslint/object-curly-spacing”的定义@typescript-eslint/object-curly-spacing
这很奇怪,因为我没有在 .eslintrc.js
文件中包含这些规则?然后我运行 npm update 希望可以解决问题,但没有解决?我目前正在通过 stackoverflow 寻找答案,但如果有人有直接答案,请告诉我该怎么做,我们将不胜感激。
我不确定这是否有帮助,但这是我的 package.json 上的内容
"@angular-devkit/build-angular": "^0.1102.3",
"@angular-eslint/builder": "1.2.0",
"@angular-eslint/eslint-plugin": "1.2.0",
"@angular-eslint/eslint-plugin-template": "1.2.0",
"@angular-eslint/schematics": "1.2.0",
"@angular-eslint/template-parser": "1.2.0",
"@angular/animations": "^11.2.4",
"@angular/cli": "^11.2.3",
"@angular/common": "^11.2.4",
"@angular/compiler": "^11.2.4",
"@angular/compiler-cli": "^11.2.4",
"@angular/core": "^11.2.4",
"@angular/forms": "^11.2.4",
"@angular/http": "~7.0.0",
"@angular/language-service": "^11.2.4",
"@angular/platform-browser": "^11.2.4",
"@angular/platform-browser-dynamic": "^11.2.4",
"@angular/router": "^11.2.4",
"@compodoc/compodoc": "^1.1.11",
"@types/jasmine": "^2.8.17",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^8.10.66",
"@typescript-eslint/eslint-plugin": "4.3.0",
"@typescript-eslint/parser": "4.3.0",
"codelyzer": "~4.5.0",
"core-js": "^2.6.9",
"eslint": "^7.6.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"eslint-plugin-prettier": "^3.3.1",
"is-docker": "^1.1.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"material-design-icons": "^3.0.1",
"ng-packagr": "^11.2.4",
"ngx-highlightjs": "^4.1.3",
"prettier": "^2.2.1",
"protractor": "^5.4.4",
"roboto-fontface": "^0.10.0",
"rxjs": "~6.6.6",
"scss-bundle": "^2.5.1",
"tsickle": "^0.33.1",
"tslint": "~5.11.0",
"typescript": "~4.1.5",
"zone.js": "~0.11.4"
最佳答案
我设法通过强制版本 "@typescript-eslint/eslint-plugin": "^4.17.0"
解决了这个问题 - 仅使用 npm update 似乎不起作用
关于Angular 和 eslint - 未找到规则 '@typescript-eslint/space-infix-ops' 的定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66561002/
我在玩infixr , infixl和 infix声明。我明白了infixr和 infixl作品: -- Test expression: 40 +++ 20 +++ 50 +++ 10 * 10 -
如何将负数从中缀转换为后缀? 假设我有一个表达式 a = - b - (-c-d) 在我读到的某些地方,您可以将负数归为一类,例如 a = (-b) - (-c-d) 但在这里,如果我这样做,我会在后
我想知道是否有办法使用 2 个堆栈一次性解决中缀表达式?堆栈可以一个用于运算符,另一个用于操作数... shunt-yard算法求解的标准方法是将中缀表达式转换为后缀表达式(反向波兰)然后求解。我不想
我想知道是否有一种方法可以使用 2 个堆栈一次解决中缀表达式?堆栈可以是一个用于运算符,另一个用于操作数... shunt-yard算法求解的标准方法是将中缀表达式转换为后缀(逆向抛光),然后求解。我
我正在阅读 advanced operators swift 。 基本功能: func add(a: Unicorn, b: Unicorn) -> Unicorn { return a + b }
我在使用 toString() 方法并打印括号时遇到问题。在我的中缀表示法中。例如,现在如果我输入 12+3* 它将打印出 1 + 2 * 3。我希望它打印出 ((1+2) *3)。 另外,我希望在输
这是我尝试编写一个程序,可以将任何中缀格式的表达式转换为后缀格式。我将 -1 分配给顶部以指示堆栈为空。当push时,top增加,当pop时,top减少。但是,当我输入 a+b 时,输出只给出 ab
我正在使用 MathNet 并尝试将 2x^2 + x 解析为 epression using Infix.Print(Infix.ParseOrUndefined("2x^2 + x")); 但它返
我正在编写一个中缀计算器,它执行 5*(2+1) 等运算。我的代码中有一个我无法识别的错误。我写了一个最小的代码来展示这个问题: #include #include struct x{ d
这里我有一个使用 Stack 将 Infix 转换为 Postfix 的代码 代码编译没有错误,但我的问题是当我输入任何中缀时,例如 A+B,我得到一个没有运算符或括号的 AB 后缀,我无法解决这个问
我昨晚问了一个关于计算机科学类(class)的问题,我必须在其中将中缀转换为后缀表示法并进行评估。我能够调试它并使其正常工作(某种程度上),但是,对于某些表达式,我仍然会得到奇怪的输出。 它适用于基本
我的任务是编写一个应用程序(不幸的是在 C 上),它读取中缀表示法(带有变量、一元和二元运算符)的表达式并将其存储在内存中,然后对其求值。此外,还应检查正确性。 例如: 3*(A+B)-(-2-78)
假设您有一个巨大的数据缓存,需要通过 4 种方式进行搜索: 完全匹配 前缀% %后缀 %中缀% 我正在使用 Trie对于前 3 种类型的搜索,但除了对大量元素的顺序处理之外,我不知道如何处理第四种类型
我读了一本书,在示例程序中使用了 infix、infixr 和 infixl。我想知道有什么区别。我猜测 infixr 从右到左执行操作,反之亦然。 最佳答案 是的,r/l 表示结合性。如果没有测试,
我遇到了流行data.table包和一件事特别引起了我的兴趣。它有一个就地赋值运算符 := 这在基础 R 中没有定义。事实上,如果你没有加载 data.table包,如果您尝试使用它(例如, a :=
我正在阅读A Gentle Introduction to Haskell (这不是那么温和)并且它重复使用 : 运算符,而没有直接解释它的作用。 那么,它到底有什么作用呢? 最佳答案 : 是“前置”
这个问题已经有答案了: Handling parenthesis while converting infix expressions to postfix expressions (2 个回答) 已
我想包含连字符的单词,例如:长期、自尊等等,作为 Spacy 中的单个标记。在 StackOverflow 上查看了一些类似的帖子后,Github ,其 documentation和 elsewher
我想使用 ** 重载指数函数。如果我使用类似“^”的东西,我会工作,但 python 的做法是 ** 我想将它与 Swift 一起使用。有什么办法吗? error: Operator implemen
尝试使用中缀运算符,我对以下内容感到惊讶: let (>~~~) = function null -> String.Empty | s -> s // compiles fine, see scr
我是一名优秀的程序员,十分优秀!