网上搜了一下才知道,在升级 angular 19 的过程中更新 npm 包时将 eslint 从 8 升级到了 9,问题是 eslint 9 的 breaking changes 引起的。 eslint 9 采用了新的 flat config,与之前的配置文件不兼容,园子博客后台之前使用的是.eslintrc.js,但 eslint 9 不认,所以报错 "Could not find config file"。
use-component-selectorComponent selector must be declared use-component-view-encapsulationDisallows usingViewEncapsulation.None💡 use-injectable-provided-inUsing theprovidedInproperty makesInjectablestree-shakable💡 use-lifecycle-interfaceEnsures that classes implement lifecycle interfaces corresponding to the dec...
"plugin:@angular-eslint/template/process-inline-templates" ], "rules": { "@angular-eslint/directive-selector": [ "error", { "type": "attribute", "prefix": "app", "style": "camelCase" } ], "@angular-eslint/component-selector": [ "error", { "type": "element", "prefix": "a...
@angular-eslint/template/process-inline-templates" ], "rules": { // 自定义规则 "@angular-eslint/component-selector": [ "error", { "type": "element", "prefix": "app", "style": "kebab-case" } ], "@angular-eslint/directive-selector": [ "error", { "type": "attribute", "...
],"@angular-eslint/component-selector": ["error", {"type": "element","prefix": "cp","style": "kebab-case"} ] } }, {"files": ["*.html"],"extends": ["plugin:@angular-eslint/template/recommended"],"rules": {} }, {"files": ["*.html"],"excludedFiles": ["*inline-templat...
可以通过在TypeScript文件中添加标记来禁用Lint规则。更多信息请点击此处。要禁用验证模板或样式的规则,需要在引用模板或样式的TypeScript文件中添加标记。import { Component } from '@angular/core'; /* tslint:disable:template-use-track-by-function */ @Component({ selector: 'codelyzer', templateUrl: './...
Therefore, as an example (because these versions may or may not exist yet when you read this): @angular-eslint packages at 12.x.x and @angular/cli@12.x.x are compatible @angular-eslint packages at 13.x.x and @angular/cli@13.x.x are compatible @angular-eslint packages at 14.x....
content_copyimport { Component } from '@angular/core'; @Component({ selector: 'hero-detail', template: ` <h2>Windstorm details!</h2> <div><label>id: </label>1</div> ` }) export class HeroDetailComponent { } 如果你想在 AngularJS 中使用这个组件,就得用 downgradeComponent()方法把它降...
: "camelCase" } ], "@angular-eslint/component-selector": [ "error", { ...
(1)没有了 Controller 这个概念了,里面的绑定属性就是符合 ES Class 的标准,使用: ```javascript class SomeOneComponent { title: string; // 这就是可以在模板中用了,很简单。 } ``` (2)模板的语法,提取常用的进行新人入门,比如: *ngIf *ngFor (3)绑定语法 [] Model => View () View => Model...