Pattern: Malformed component suffix
Issue: -
This rule follows the recommendation from the Angular styleguide.
Examples of incorrect code for this rule (with default configuration):
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
class App {}
Example of correct code for this rule:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
class AppComponent {}
By default, the suffix will be Component
. You may pass an array of suffixes, for example:
{
"@angular-eslint/component-class-suffix": [
"error",
{
"suffixes": ["Component", "Comp"]
}
]
}
Examples of incorrect code with the above options:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppCompe {}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class App {}
Example of correct code with the above options:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComp {}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {}