Repository: ember-cli/eslint-plugin-ember
Pull request #1024 (2020-12-01 19:50:34)

Enable additional `recommended` rules for v10
Part of #960.


Patch:
diff --git a/README.md b/README.md
index 02c62dfe..d3fe2f27 100644
--- a/README.md
+++ b/README.md
@@ -108,7 +108,7 @@ Rules are grouped by category to help you understand their purpose. Each rule ha
 | :white_check_mark: | [no-new-mixins](./docs/rules/no-new-mixins.md) | disallow the creation of new mixins |
 | :white_check_mark: | [no-observers](./docs/rules/no-observers.md) | disallow usage of observers |
 | :white_check_mark::wrench: | [no-old-shims](./docs/rules/no-old-shims.md) | disallow usage of old shims for modules |
-|  | [no-string-prototype-extensions](./docs/rules/no-string-prototype-extensions.md) | disallow usage of `String` prototype extensions |
+| :white_check_mark: | [no-string-prototype-extensions](./docs/rules/no-string-prototype-extensions.md) | disallow usage of `String` prototype extensions |
 
 ### Ember Data
 
@@ -125,7 +125,7 @@ Rules are grouped by category to help you understand their purpose. Each rule ha
 | :white_check_mark::wrench: | [no-get-with-default](./docs/rules/no-get-with-default.md) | disallow usage of the Ember's `getWithDefault` function |
 | :white_check_mark::wrench: | [no-get](./docs/rules/no-get.md) | require using ES5 getters instead of Ember's `get` / `getProperties` functions |
 |  | [no-proxies](./docs/rules/no-proxies.md) | disallow using array or object proxies |
-|  | [no-try-invoke](./docs/rules/no-try-invoke.md) | disallow usage of the Ember's `tryInvoke` util |
+| :white_check_mark: | [no-try-invoke](./docs/rules/no-try-invoke.md) | disallow usage of the Ember's `tryInvoke` util |
 | :white_check_mark::wrench: | [require-super-in-lifecycle-hooks](./docs/rules/require-super-in-lifecycle-hooks.md) | require super to be called in lifecycle hooks |
 | :wrench: | [use-ember-get-and-set](./docs/rules/use-ember-get-and-set.md) | enforce usage of `Ember.get` and `Ember.set` |
 
@@ -138,7 +138,7 @@ Rules are grouped by category to help you understand their purpose. Each rule ha
 | :car: | [no-actions-hash](./docs/rules/no-actions-hash.md) | disallow the actions hash in components, controllers, and routes |
 | :car: | [no-classic-classes](./docs/rules/no-classic-classes.md) | disallow "classic" classes in favor of native JS classes |
 | :white_check_mark::wrench: | [no-ember-super-in-es-classes](./docs/rules/no-ember-super-in-es-classes.md) | disallow use of `this._super` in ES class methods |
-|  | [no-empty-glimmer-component-classes](./docs/rules/no-empty-glimmer-component-classes.md) | disallow empty backing classes for Glimmer components |
+| :white_check_mark: | [no-empty-glimmer-component-classes](./docs/rules/no-empty-glimmer-component-classes.md) | disallow empty backing classes for Glimmer components |
 
 ### jQuery
 
@@ -164,7 +164,7 @@ Rules are grouped by category to help you understand their purpose. Each rule ha
 | :white_check_mark: | [no-capital-letters-in-routes](./docs/rules/no-capital-letters-in-routes.md) | disallow routes with uppercased letters in router.js |
 | :white_check_mark: | [no-controller-access-in-routes](./docs/rules/no-controller-access-in-routes.md) | disallow routes from accessing the controller outside of setupController/resetController |
 | :white_check_mark: | [no-private-routing-service](./docs/rules/no-private-routing-service.md) | disallow injecting the private routing service |
-|  | [no-shadow-route-definition](./docs/rules/no-shadow-route-definition.md) | enforce no route path definition shadowing |
+| :white_check_mark: | [no-shadow-route-definition](./docs/rules/no-shadow-route-definition.md) | enforce no route path definition shadowing |
 |  | [no-unnecessary-index-route](./docs/rules/no-unnecessary-index-route.md) | disallow unnecessary `index` route definition |
 | :white_check_mark::wrench: | [no-unnecessary-route-path-option](./docs/rules/no-unnecessary-route-path-option.md) | disallow unnecessary usage of the route `path` option |
 |  | [route-path-style](./docs/rules/route-path-style.md) | enforce usage of kebab-case (instead of snake_case or camelCase) in route paths |
@@ -191,14 +191,14 @@ Rules are grouped by category to help you understand their purpose. Each rule ha
 | :white_check_mark: | [no-pause-test](./docs/rules/no-pause-test.md) | disallow usage of the `pauseTest` helper in tests |
 |  | [no-replace-test-comments](./docs/rules/no-replace-test-comments.md) | disallow 'Replace this with your real tests' comments in test files |
 | :white_check_mark: | [no-restricted-resolver-tests](./docs/rules/no-restricted-resolver-tests.md) | disallow the use of patterns that use the restricted resolver in tests |
-| :wrench: | [no-settled-after-test-helper](./docs/rules/no-settled-after-test-helper.md) | disallow usage of `await settled()` right after test helper that calls it internally |
+| :white_check_mark::wrench: | [no-settled-after-test-helper](./docs/rules/no-settled-after-test-helper.md) | disallow usage of `await settled()` right after test helper that calls it internally |
 | :white_check_mark: | [no-test-and-then](./docs/rules/no-test-and-then.md) | disallow usage of the `andThen` test wait helper |
 | :white_check_mark: | [no-test-import-export](./docs/rules/no-test-import-export.md) | disallow importing of "-test.js" in a test file and exporting from a test file |
 | :white_check_mark: | [no-test-module-for](./docs/rules/no-test-module-for.md) | disallow usage of `moduleFor`, `moduleForComponent`, etc |
-|  | [no-test-support-import](./docs/rules/no-test-support-import.md) | disallow importing of "test-support" files in production code. |
+| :white_check_mark: | [no-test-support-import](./docs/rules/no-test-support-import.md) | disallow importing of "test-support" files in production code. |
 | :white_check_mark: | [no-test-this-render](./docs/rules/no-test-this-render.md) | disallow usage of the `this.render` in tests, recommending to use @ember/test-helpers' `render` instead. |
 | :white_check_mark: | [prefer-ember-test-helpers](./docs/rules/prefer-ember-test-helpers.md) | enforce usage of `@ember/test-helpers` methods over native window methods |
-| :wrench: | [require-valid-css-selector-in-test-helpers](./docs/rules/require-valid-css-selector-in-test-helpers.md) | disallow using invalid CSS selectors in test helpers |
+| :white_check_mark::wrench: | [require-valid-css-selector-in-test-helpers](./docs/rules/require-valid-css-selector-in-test-helpers.md) | disallow using invalid CSS selectors in test helpers |
 
 <!--RULES_TABLE_END-->
 
diff --git a/docs/rules/no-empty-glimmer-component-classes.md b/docs/rules/no-empty-glimmer-component-classes.md
index e5fa0d6d..2a302c2e 100644
--- a/docs/rules/no-empty-glimmer-component-classes.md
+++ b/docs/rules/no-empty-glimmer-component-classes.md
@@ -1,5 +1,7 @@
 # no-empty-glimmer-component-classes
 
+:white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.
+
 This rule will catch and prevent the use of empty backing classes for Glimmer components.
 
 ## Rule Details
diff --git a/docs/rules/no-shadow-route-definition.md b/docs/rules/no-shadow-route-definition.md
index fbb637bc..4f200ea9 100644
--- a/docs/rules/no-shadow-route-definition.md
+++ b/docs/rules/no-shadow-route-definition.md
@@ -1,5 +1,7 @@
 # no-shadow-route-definition
 
+:white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.
+
 Enforce no route path definition shadowing in Router.
 
 ## Rule Details
diff --git a/docs/rules/no-string-prototype-extensions.md b/docs/rules/no-string-prototype-extensions.md
index ec06f459..c539dae2 100644
--- a/docs/rules/no-string-prototype-extensions.md
+++ b/docs/rules/no-string-prototype-extensions.md
@@ -1,5 +1,7 @@
 # no-string-prototype-extensions
 
+:white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.
+
 Ember by default extends certain native JavaScript objects with additional
 methods. This can lead to problems in certain situations. One example is relying
 on these methods in addons, but that addon being used in an app that has the
diff --git a/docs/rules/no-try-invoke.md b/docs/rules/no-try-invoke.md
index f39e36a4..0eda8d34 100644
--- a/docs/rules/no-try-invoke.md
+++ b/docs/rules/no-try-invoke.md
@@ -1,5 +1,7 @@
 # no-try-invoke
 
+:white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.
+
 This rule will catch and prevent the use of `tryInvoke`.
 
 ## Rule Details
diff --git a/lib/recommended-rules.js b/lib/recommended-rules.js
index 6babb876..559f8988 100644
--- a/lib/recommended-rules.js
+++ b/lib/recommended-rules.js
@@ -20,6 +20,7 @@ module.exports = {
   "ember/no-duplicate-dependent-keys": "error",
   "ember/no-ember-super-in-es-classes": "error",
   "ember/no-ember-testing-in-module-scope": "error",
+  "ember/no-empty-glimmer-component-classes": "error",
   "ember/no-function-prototype-extensions": "error",
   "ember/no-get-with-default": "error",
   "ember/no-get": "error",
@@ -40,11 +41,16 @@ module.exports = {
   "ember/no-pause-test": "error",
   "ember/no-private-routing-service": "error",
   "ember/no-restricted-resolver-tests": "error",
+  "ember/no-settled-after-test-helper": "error",
+  "ember/no-shadow-route-definition": "error",
   "ember/no-side-effects": "error",
+  "ember/no-string-prototype-extensions": "error",
   "ember/no-test-and-then": "error",
   "ember/no-test-import-export": "error",
   "ember/no-test-module-for": "error",
+  "ember/no-test-support-import": "error",
   "ember/no-test-this-render": "error",
+  "ember/no-try-invoke": "error",
   "ember/no-unnecessary-route-path-option": "error",
   "ember/no-volatile-computed-properties": "error",
   "ember/prefer-ember-test-helpers": "error",
@@ -52,6 +58,7 @@ module.exports = {
   "ember/require-computed-property-dependencies": "error",
   "ember/require-return-from-computed": "error",
   "ember/require-super-in-lifecycle-hooks": "error",
+  "ember/require-valid-css-selector-in-test-helpers": "error",
   "ember/routes-segments-snake-case": "error",
   "ember/use-brace-expansion": "error",
   "ember/use-ember-data-rfc-395-imports": "error"
diff --git a/lib/rules/no-empty-glimmer-component-classes.js b/lib/rules/no-empty-glimmer-component-classes.js
index 128e4198..e8eff0ad 100644
--- a/lib/rules/no-empty-glimmer-component-classes.js
+++ b/lib/rules/no-empty-glimmer-component-classes.js
@@ -14,7 +14,7 @@ module.exports = {
     docs: {
       description: 'disallow empty backing classes for Glimmer components',
       category: 'Ember Octane',
-      recommended: false,
+      recommended: true,
       url:
         'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-empty-glimmer-component-classes.md',
     },
diff --git a/lib/rules/no-shadow-route-definition.js b/lib/rules/no-shadow-route-definition.js
index f489329a..6085d525 100644
--- a/lib/rules/no-shadow-route-definition.js
+++ b/lib/rules/no-shadow-route-definition.js
@@ -30,7 +30,7 @@ module.exports = {
     docs: {
       description: 'enforce no route path definition shadowing',
       category: 'Routes',
-      recommended: false,
+      recommended: true,
       url:
         'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-shadow-route-definition.md',
     },
diff --git a/lib/rules/no-string-prototype-extensions.js b/lib/rules/no-string-prototype-extensions.js
index 21e6fdb8..0dbdc2cb 100644
--- a/lib/rules/no-string-prototype-extensions.js
+++ b/lib/rules/no-string-prototype-extensions.js
@@ -20,6 +20,7 @@ module.exports = {
     docs: {
       description: 'disallow usage of `String` prototype extensions',
       category: 'Deprecations',
+      recommended: true,
       url:
         'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-string-prototype-extensions.md',
     },
diff --git a/lib/rules/no-try-invoke.js b/lib/rules/no-try-invoke.js
index beafe336..e42a6910 100644
--- a/lib/rules/no-try-invoke.js
+++ b/lib/rules/no-try-invoke.js
@@ -12,7 +12,7 @@ module.exports = {
     docs: {
       description: "disallow usage of the Ember's `tryInvoke` util",
       category: 'Ember Object',
-      recommended: false,
+      recommended: true,
       url:
         'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-try-invoke.md',
     },


Test patch:
diff --git a/docs/rules/no-settled-after-test-helper.md b/docs/rules/no-settled-after-test-helper.md
index ab166075..df3d7036 100644
--- a/docs/rules/no-settled-after-test-helper.md
+++ b/docs/rules/no-settled-after-test-helper.md
@@ -1,5 +1,7 @@
 # no-settled-after-test-helper
 
+:white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.
+
 :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
 
 Most of the test helper functions in
diff --git a/docs/rules/no-test-support-import.md b/docs/rules/no-test-support-import.md
index 687aea98..6deba30a 100644
--- a/docs/rules/no-test-support-import.md
+++ b/docs/rules/no-test-support-import.md
@@ -1,5 +1,7 @@
 # no-test-support-import
 
+:white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.
+
 No importing of test support files into non-test code..
 
 **TL;DR** Do not import from a file located in addon-test-support into non-test code. Doing so will result in production errors that are not capable of being caught in tests as require statements are available in tests but not on production builds.
diff --git a/docs/rules/require-valid-css-selector-in-test-helpers.md b/docs/rules/require-valid-css-selector-in-test-helpers.md
index ccb3ab55..321005c2 100644
--- a/docs/rules/require-valid-css-selector-in-test-helpers.md
+++ b/docs/rules/require-valid-css-selector-in-test-helpers.md
@@ -1,5 +1,7 @@
 # require-valid-css-selector-in-test-helpers
 
+:white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.
+
 :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
 
 Test helpers and querySelector methods should be called with valid CSS selectors. Most of the time invalid selectors will result in a failing test but that is not always the case.
diff --git a/lib/rules/no-settled-after-test-helper.js b/lib/rules/no-settled-after-test-helper.js
index 4ab035e7..786c061f 100644
--- a/lib/rules/no-settled-after-test-helper.js
+++ b/lib/rules/no-settled-after-test-helper.js
@@ -26,6 +26,7 @@ module.exports = {
       description:
         'disallow usage of `await settled()` right after test helper that calls it internally',
       category: 'Testing',
+      recommended: true,
       url:
         'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-settled-after-test-helper.md',
     },
diff --git a/lib/rules/no-test-support-import.js b/lib/rules/no-test-support-import.js
index 0c8fa310..4b6b3173 100644
--- a/lib/rules/no-test-support-import.js
+++ b/lib/rules/no-test-support-import.js
@@ -17,7 +17,7 @@ module.exports = {
     docs: {
       description: 'disallow importing of "test-support" files in production code.',
       category: 'Testing',
-      recommended: false,
+      recommended: true,
       url:
         'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-test-support-import.md',
     },
diff --git a/lib/rules/require-valid-css-selector-in-test-helpers.js b/lib/rules/require-valid-css-selector-in-test-helpers.js
index 6a578be1..bc4ea30d 100644
--- a/lib/rules/require-valid-css-selector-in-test-helpers.js
+++ b/lib/rules/require-valid-css-selector-in-test-helpers.js
@@ -89,7 +89,7 @@ module.exports = {
     docs: {
       description: 'disallow using invalid CSS selectors in test helpers',
       category: 'Testing',
-      recommended: false,
+      recommended: true,
       url:
         'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/require-valid-css-selector-in-test-helpers.md',
     },
diff --git a/tests/__snapshots__/recommended.js.snap b/tests/__snapshots__/recommended.js.snap
index 5d386ce5..a43c403a 100644
--- a/tests/__snapshots__/recommended.js.snap
+++ b/tests/__snapshots__/recommended.js.snap
@@ -17,6 +17,7 @@ Array [
   "no-duplicate-dependent-keys",
   "no-ember-super-in-es-classes",
   "no-ember-testing-in-module-scope",
+  "no-empty-glimmer-component-classes",
   "no-function-prototype-extensions",
   "no-get-with-default",
   "no-get",
@@ -37,11 +38,16 @@ Array [
   "no-pause-test",
   "no-private-routing-service",
   "no-restricted-resolver-tests",
+  "no-settled-after-test-helper",
+  "no-shadow-route-definition",
   "no-side-effects",
+  "no-string-prototype-extensions",
   "no-test-and-then",
   "no-test-import-export",
   "no-test-module-for",
+  "no-test-support-import",
   "no-test-this-render",
+  "no-try-invoke",
   "no-unnecessary-route-path-option",
   "no-volatile-computed-properties",
   "prefer-ember-test-helpers",
@@ -49,6 +55,7 @@ Array [
   "require-computed-property-dependencies",
   "require-return-from-computed",
   "require-super-in-lifecycle-hooks",
+  "require-valid-css-selector-in-test-helpers",
   "routes-segments-snake-case",
   "use-brace-expansion",
   "use-ember-data-rfc-395-imports",