Repository: ember-cli/eslint-plugin-ember (js)

Issue:
New Octane Rule: `no-classic-components`
Pulled from https://github.com/ember-cli/eslint-plugin-ember/issues/533 which proposes a new set of rules for Octane related best practices

Disallow usage of the `@ember/component` base class. Use `@glimmer/component` instead.

```js
// ### Good
import Component from '@glimmer/component'

// ### Bad
import Component from '@ember/component'
```

If anyone would like to implement this please comment that you'll take it and work away.

Pull request:
Add new `no-classic-components` rule
Fixes #542 

Patch:
diff --git a/README.md b/README.md
index c16eda0a..dea63870 100644
--- a/README.md
+++ b/README.md
@@ -142,6 +142,7 @@ The `--fix` option on the command line automatically fixes problems reported by
 
 |    | Rule ID | Description |
 |:---|:--------|:------------|
+|  | [no-classic-components](./docs/rules/no-classic-components.md) | Enforces Glimmer components |
 |  | [no-computed-properties-in-native-classes](./docs/rules/no-computed-properties-in-native-classes.md) | Disallows using computed properties in native classes |
 
 
diff --git a/docs/rules/no-classic-components.md b/docs/rules/no-classic-components.md
new file mode 100644
index 00000000..43a07831
--- /dev/null
+++ b/docs/rules/no-classic-components.md
@@ -0,0 +1,39 @@
+# No classic components (no-classic-components)
+
+This rule aims to enforce Glimmer components instead of classic ones. We should migrate to Glimmer components because
+they have few adventages:
+- Simpler API
+- No wrapper element
+- Namespaced Arguments
+- Less lifecycle hooks
+- Stateless Template-Only Components
+- Unidirectional Dataflow
+
+With that simpler API we could improve the DX and also lower the entry level for Ember.
+
+## Rule Details
+
+If you want to migrate to Glimmer components this rule can help find the classic components that you need to migrate.
+
+Examples of **incorrect** code for this rule:
+
+```js
+
+import Component from '@ember/component';
+
+```
+
+Examples of **correct** code for this rule:
+
+```js
+
+import Component from '@glimmer/component';
+
+```
+
+## References
+
+* [Ember 3.13 Release Notes](https://blog.emberjs.com/2019/09/25/ember-3-13-released.html)
+* [Ember Glimmer Components RFC](https://github.com/emberjs/rfcs/blob/master/text/0416-glimmer-components.md)
+* [Ember Octane Release Plan](https://blog.emberjs.com/2019/08/15/octane-release-plan.html)
+* [Glimmer Components Explained](https://www.pzuraq.com/coming-soon-in-ember-octane-part-5-glimmer-components/)
diff --git a/lib/index.js b/lib/index.js
index 1f90b5ea..c2047aca 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -16,6 +16,7 @@ module.exports = {
     'no-attrs-in-components': require('./rules/no-attrs-in-components'),
     'no-attrs-snapshot': require('./rules/no-attrs-snapshot'),
     'no-capital-letters-in-routes': require('./rules/no-capital-letters-in-routes'),
+    'no-classic-components': require('./rules/no-classic-components'),
     'no-computed-properties-in-native-classes': require('./rules/no-computed-properties-in-native-classes'),
     'no-deeply-nested-dependent-keys-with-each': require('./rules/no-deeply-nested-dependent-keys-with-each'),
     'no-duplicate-dependent-keys': require('./rules/no-duplicate-dependent-keys'),
diff --git a/lib/recommended-rules.js b/lib/recommended-rules.js
index f261a08d..05868ea6 100644
--- a/lib/recommended-rules.js
+++ b/lib/recommended-rules.js
@@ -19,6 +19,7 @@ module.exports = {
   "ember/no-attrs-in-components": "error",
   "ember/no-attrs-snapshot": "error",
   "ember/no-capital-letters-in-routes": "error",
+  "ember/no-classic-components": "off",
   "ember/no-computed-properties-in-native-classes": "off",
   "ember/no-deeply-nested-dependent-keys-with-each": "error",
   "ember/no-duplicate-dependent-keys": "error",
diff --git a/lib/rules/no-classic-components.js b/lib/rules/no-classic-components.js
new file mode 100644
index 00000000..f3db6fc5
--- /dev/null
+++ b/lib/rules/no-classic-components.js
@@ -0,0 +1,35 @@
+'use strict';
+
+const ERROR_MESSAGE =
+  'Use Glimmer components(@glimmer/component) instead of classic components(@ember/component)';
+
+module.exports = {
+  meta: {
+    docs: {
+      description: 'Enforces Glimmer components',
+      category: 'Ember Octane',
+      recommended: false,
+      url:
+        'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-classic-components.md',
+    },
+    fixable: null,
+  },
+
+  ERROR_MESSAGE,
+
+  create(context) {
+    const report = function(node) {
+      context.report(node, ERROR_MESSAGE);
+    };
+
+    return {
+      ImportDeclaration(node) {
+        const importSource = node.source.value;
+
+        if (importSource === '@ember/component') {
+          report(node);
+        }
+      },
+    };
+  },
+};


Test patch:
diff --git a/tests/lib/rules/no-classic-components.js b/tests/lib/rules/no-classic-components.js
new file mode 100644
index 00000000..63179dd0
--- /dev/null
+++ b/tests/lib/rules/no-classic-components.js
@@ -0,0 +1,35 @@
+'use strict';
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const rule = require('../../../lib/rules/no-classic-components');
+const RuleTester = require('eslint').RuleTester;
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+const { ERROR_MESSAGE } = rule;
+const parserOptions = {
+  ecmaVersion: 6,
+  sourceType: 'module',
+};
+const ruleTester = new RuleTester({ parserOptions });
+
+ruleTester.run('no-classic-components', rule, {
+  valid: ["import Component from '@glimmer/component';"],
+
+  invalid: [
+    {
+      code: "import Component from '@ember/component';",
+      errors: [
+        {
+          message: ERROR_MESSAGE,
+          type: 'ImportDeclaration',
+        },
+      ],
+    },
+  ],
+});