ionic报错: Lifecyclemethods should not be empty eslint(mangulare-method)
(method)ProductViewPage.ngOnInit():void
A callback method that is invoked immediately after the default change detector has checked the directive's data-bound properties for the frst time, and before anyof the view or content children have been checked. lt is invoked only once when the directive is instantiated.
如下如:
修复方法:将“eslintrc.json”加入"@angular-eslint/no-empty-lifecycle-method": "off" 保存即可正常。如下:
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/component-class-suffix": [
"error",
{
"suffixes": ["Page", "Component"]
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/no-empty-lifecycle-method": "off"
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {}
}
]
}