Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.15 KB

no-controllers.md

File metadata and controls

37 lines (25 loc) · 1.15 KB

no-controllers

Some people may prefer to avoid the use of controllers in their applications, typically in favor of components which can be more portable and easier to test.

This rule disallows controller usage, except when the controller is used to define queryParams (a feature currently only available in controllers).

Note: this rule will not be added to the recommended configuration until controller usage has become less common / deprecated.

Examples

Examples of incorrect code for this rule:

import Controller from '@ember/controller';

export default class ArticlesController extends Controller {
  // Controller disallowed since it doesn't use `queryParams`.
  // ...
}

Examples of correct code for this rule:

import Controller from '@ember/controller';

export default class ArticlesController extends Controller {
  queryParams = ['category']; // Controller allowed for defining `queryParams`.
  @tracked category = null;
  // ...
}

Further Reading