Ionic Framework generate and Angular ESLint 02-03 styleguide rule component naming conflict

37 Views Asked by At

I use Ionic 6 and Angular 16. In Ionic there is opportunity to generate pages and other components by using generate command:

ionic generate page pagename

This command creates folder in project with page template. In my example ionic generate will create these component code:

@Component({
  selector: 'app-pagename',
  templateUrl: './pagename.page.html',
  styleUrls: ['./pagename.page.scss'],
})
export class PagenamePage implements OnInit {

  constructor() { }

  ngOnInit() {
  }

}

As you see component called PagenamePage. Problem is that when I check my code with ESLint

ng lint

it shows me styleguide error:

.../src/app/pagename/pagename.page.ts
   8:14  error  Component class names should end with one of these suffixes: "Component" (https://angular.io/styleguide#style-02-03)

Reference to styleguide is https://angular.io/guide/styleguide#style-02-03. So problem is that ESLint requires that all components have "Component" at tha end of name, but Ionic generates components with "Page" at the end of name.

So question is: How to resolve this conflict?

I see only two decisions:

  1. Rename every Ionic component that page
  2. Switch off some ESLint option to not check this rule

As for me second variant is better because in fact Ionic generates page, not component. But I don't know how to disable ESLint to not check rule.

0

There are 0 best solutions below