diff --git a/docs/rules/_TEMPLATE_.md b/docs/rules/_TEMPLATE_.md index 2cdd40b8be..28213594a4 100644 --- a/docs/rules/_TEMPLATE_.md +++ b/docs/rules/_TEMPLATE_.md @@ -41,11 +41,10 @@ TODO: suggest any fast/automated techniques for fixing violations in a large cod ## Configuration -TODO: exclude this section if the rule has no extra configuration - -- object -- containing the following properties: - - string -- `parameterName1` -- TODO: description of parameter including the possible values and default value - - boolean -- `parameterName2` -- TODO: description of parameter including the possible values and default value + +TODO: exclude this section if the rule has no extra configuration. +TODO: ensure `meta.schema` contains descriptions, constraints, defaults, etc for all options. + ## Related Rules diff --git a/docs/rules/named-functions-in-promises.md b/docs/rules/named-functions-in-promises.md index cf12c2268f..8947dd7aab 100644 --- a/docs/rules/named-functions-in-promises.md +++ b/docs/rules/named-functions-in-promises.md @@ -67,6 +67,10 @@ test('it reloads user in promise handler', function (assert) { ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `allowSimpleArrowFunction` -- (default false) setting to `true` allows arrow function expressions that do not have block bodies. These simple arrow functions must also only contain a single function call. For example: `.then(user => this._reloadUser(user))`. +| Name | Description | Type | Default | +| :------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `allowSimpleArrowFunction` | Enabling allows arrow function expressions that do not have block bodies. These simple arrow functions must also only contain a single function call. For example: `.then(user => this._reloadUser(user))`. | Boolean | `false` | + + diff --git a/docs/rules/no-arrow-function-computed-properties.md b/docs/rules/no-arrow-function-computed-properties.md index 83a3a663c2..44eb677d00 100644 --- a/docs/rules/no-arrow-function-computed-properties.md +++ b/docs/rules/no-arrow-function-computed-properties.md @@ -38,9 +38,13 @@ const Person = EmberObject.extend({ ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `onlyThisContexts` -- whether the rule should allow or disallow computed properties where the arrow function body does not contain a `this` reference (default: `false`) +| Name | Description | Type | Default | +| :----------------- | :------------------------------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `onlyThisContexts` | Whether the rule should allow or disallow computed properties where the arrow function body does not contain a `this` reference. | Boolean | `false` | + + ## References diff --git a/docs/rules/no-classic-classes.md b/docs/rules/no-classic-classes.md index a653a3b7b3..6334a686fc 100644 --- a/docs/rules/no-classic-classes.md +++ b/docs/rules/no-classic-classes.md @@ -49,9 +49,13 @@ export default class MyComponent extends Component.extend(Evented) {} ## Configuration -This rule takes an optional object containing: + -- `string[]` -- `additionalClassImports` -- Allows you to specify additional imports that should be flagged to disallow calling `extend` on. This allows you to handle the case where your app or addon is importing from a module that performs the `extend`. +| Name | Description | Type | +| :----------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---- | +| `additionalClassImports` | Allows you to specify additional imports that should be flagged to disallow calling `extend` on. This allows you to handle the case where your app or addon is importing from a module that performs the `extend`. | Array | + + ## When Not To Use It diff --git a/docs/rules/no-computed-properties-in-native-classes.md b/docs/rules/no-computed-properties-in-native-classes.md index 86d5ef7ffd..5962e729ab 100644 --- a/docs/rules/no-computed-properties-in-native-classes.md +++ b/docs/rules/no-computed-properties-in-native-classes.md @@ -68,9 +68,13 @@ export default class MyComponent extends Component {} ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `ignoreClassic` -- whether the rule should ignore usage inside of native classes labeled with `@classic` (default `true`) +| Name | Description | Type | Default | +| :-------------- | :------------------------------------------------------------------------------------- | :------ | :------ | +| `ignoreClassic` | Whether the rule should ignore usage inside of native classes labeled with `@classic`. | Boolean | `true` | + + ## References diff --git a/docs/rules/no-controller-access-in-routes.md b/docs/rules/no-controller-access-in-routes.md index ec19c219e0..90867c0605 100644 --- a/docs/rules/no-controller-access-in-routes.md +++ b/docs/rules/no-controller-access-in-routes.md @@ -66,5 +66,10 @@ export default class MyRoute extends Route { ## Configuration -- object -- containing the following properties: - - boolean -- `allowControllerFor` -- whether the rule should allow or disallow routes from accessing the controller outside of `setupController`/`resetController` via `controllerFor` (default: `false`) + + +| Name | Description | Type | Default | +| :------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `allowControllerFor` | Whether the rule should allow or disallow routes from accessing the controller outside of `setupController`/`resetController` via `controllerFor`. | Boolean | `false` | + + diff --git a/docs/rules/no-get-with-default.md b/docs/rules/no-get-with-default.md index df4258cc51..3b06f78f72 100644 --- a/docs/rules/no-get-with-default.md +++ b/docs/rules/no-get-with-default.md @@ -44,10 +44,14 @@ const test = this.key || []; ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `catchSafeObjects` -- whether the rule should catch non-`this` imported usages like `getWithDefault(person, 'name', '')` (default `true`) -- `boolean` -- `catchUnsafeObjects` -- whether the rule should catch non-`this` usages like `person.getWithDefault('name', '')` even though we don't know for sure if `person` is an Ember object (default `true`) +| Name | Description | Type | Default | +| :------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `catchSafeObjects` | Whether the rule should catch non-`this` imported usages like `getWithDefault(person, 'name', '')`. | Boolean | `true` | +| `catchUnsafeObjects` | Whether the rule should catch non-`this` usages like `person.getWithDefault('name', '')` even though we don't know for sure if `person` is an Ember object. | Boolean | `true` | + + ## References diff --git a/docs/rules/no-get.md b/docs/rules/no-get.md index b1f02420da..cdd86ea99f 100644 --- a/docs/rules/no-get.md +++ b/docs/rules/no-get.md @@ -91,14 +91,18 @@ export default EmberObject.extend({ ## Configuration -This rule takes an optional object containing: - -- `boolean` -- `ignoreGetProperties` -- whether the rule should ignore `getProperties` (default `false`) -- `boolean` -- `ignoreNestedPaths` -- whether the rule should ignore `this.get('some.nested.property')` (can't be enabled at the same time as `useOptionalChaining`) (default `false`) -- `boolean` -- `useAt` -- whether the rule should use `at(-1)` [Array.prototype.at()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at) to replace `lastObject` (default `true`) -- `boolean` -- `useOptionalChaining` -- whether the rule should use the [optional chaining operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) `?.` to autofix nested paths such as `this.get('some.nested.property')` to `this.some?.nested?.property` (when this option is off, these nested paths won't be autofixed at all) (default `true`) -- `boolean` -- `catchSafeObjects` -- whether the rule should catch non-`this` imported usages like `get(foo, 'bar')` (default `true`) -- `boolean` -- `catchUnsafeObjects` -- whether the rule should catch non-`this` usages like `foo.get('bar')` even though we don't know for sure if `foo` is an Ember object (default `false`) + + +| Name | Description | Type | Default | +| :-------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `catchSafeObjects` | Whether the rule should catch non-`this` imported usages like `get(foo, 'bar')`. | Boolean | `true` | +| `catchUnsafeObjects` | Whether the rule should catch non-`this` usages like `foo.get('bar')` even though we don't know for sure if `foo` is an Ember object. | Boolean | `false` | +| `ignoreGetProperties` | Whether the rule should ignore `getProperties`. | Boolean | `false` | +| `ignoreNestedPaths` | Whether the rule should ignore `this.get('some.nested.property')` (can't be enabled at the same time as `useOptionalChaining`). | Boolean | `false` | +| `useAt` | Whether the rule should use `at(-1)` [Array.prototype.at()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at) to replace `lastObject`. | Boolean | `true` | +| `useOptionalChaining` | Whether the rule should use the [optional chaining operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) `?.` to autofix nested paths such as `this.get('some.nested.property')` to `this.some?.nested?.property` (when this option is off, these nested paths won't be autofixed at all). | Boolean | `true` | + + ## Related Rules diff --git a/docs/rules/no-private-routing-service.md b/docs/rules/no-private-routing-service.md index 9b8eeaaef8..be4e8ecd14 100644 --- a/docs/rules/no-private-routing-service.md +++ b/docs/rules/no-private-routing-service.md @@ -83,10 +83,14 @@ export default class MyComponent extends Component { ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `catchRouterMicrolib` -- whether the rule should catch usages of the private property `_routerMicrolib` (default `true`) -- `boolean` -- `catchRouterMain` -- whether the rule should catch usages of the private property `router:main` (default `true`) +| Name | Description | Type | Default | +| :-------------------- | :------------------------------------------------------------------------------ | :------ | :------ | +| `catchRouterMain` | Whether the rule should catch usages of the private property `router:main`. | Boolean | `true` | +| `catchRouterMicrolib` | Whether the rule should catch usages of the private property `_routerMicrolib`. | Boolean | `true` | + + ## References diff --git a/docs/rules/no-restricted-property-modifications.md b/docs/rules/no-restricted-property-modifications.md index f5c99ac68c..8e602e23cd 100644 --- a/docs/rules/no-restricted-property-modifications.md +++ b/docs/rules/no-restricted-property-modifications.md @@ -56,7 +56,12 @@ export default class MyComponent extends Component { ## Configuration -- object -- containing the following properties: - - `String[]` -- `properties` -- array of names of properties that should not be modified (modifying child/nested/sub-properties of these is also not allowed) + + +| Name | Description | Type | Required | +| :----------- | :----------------------------------------------------------------------------------------------------------------------------- | :---- | :------- | +| `properties` | Array of names of properties that should not be modified (modifying child/nested/sub-properties of these is also not allowed). | Array | Yes | + + Not yet implemented: There is currently no way to configure whether sub-properties are restricted from modification. To make this configurable, the `properties` array option could be updated to also accept objects of the form `{ name: 'myPropertyName', includeSubProperties: false }` where `includeSubProperties` defaults to `true`. diff --git a/docs/rules/no-restricted-service-injections.md b/docs/rules/no-restricted-service-injections.md index e9c3c139ca..0914239500 100644 --- a/docs/rules/no-restricted-service-injections.md +++ b/docs/rules/no-restricted-service-injections.md @@ -45,10 +45,17 @@ class MyComponent extends Component { ## Configuration -- object[] -- containing the following properties: - - string[] -- `services` -- list of (kebab-case) service names that should be disallowed from being injected under the specified paths - - string[] -- `paths` -- optional list of regexp file paths that injecting the specified services should be disallowed under (omit this field to match any path) (for glob patterns, use [ESLint `overrides`](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) instead) - - string -- `message` -- optional custom error message to display for violations +Accepts an array of the objects with the following options: + + + +| Name | Description | Type | Required | +| :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----- | :------- | +| `message` | Optional custom error message to display for violations. | String | | +| `paths` | Optional list of regexp file paths that injecting the specified services should be disallowed under (omit this field to match any path) (for glob patterns, use [ESLint `overrides`](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) instead). | Array | | +| `services` | List of (kebab-case) service names that should be disallowed from being injected under the specified paths. | Array | Yes | + + ## Related Rules diff --git a/docs/rules/no-runloop.md b/docs/rules/no-runloop.md index 151409937f..34219a9be0 100644 --- a/docs/rules/no-runloop.md +++ b/docs/rules/no-runloop.md @@ -58,7 +58,13 @@ export default class MyComponent extends Component { ## Configuration -If you have `@ember/runloop` functions that you wish to allow, you can configure this rule to allow specific methods. The configuration takes an object with the `allowList` property, which is an array of strings where the strings must be names of runloop functions. + + +| Name | Description | Type | +| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---- | +| `allowList` | If you have `@ember/runloop` functions that you wish to allow, you can configure this rule to allow specific methods. The configuration takes an object with the `allowList` property, which is an array of strings where the strings must be names of runloop functions. | Array | + + ```js module.exports = { diff --git a/docs/rules/no-side-effects.md b/docs/rules/no-side-effects.md index 72b7488da1..773d95b2b8 100644 --- a/docs/rules/no-side-effects.md +++ b/docs/rules/no-side-effects.md @@ -46,7 +46,11 @@ export default Component.extend({ ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `catchEvents` -- whether the rule should catch function calls that send actions or events (default `true`) -- `boolean` -- `checkPlainGetters` -- whether the rule should check plain (non-computed) getters in native classes for side effects (default `true`) +| Name | Description | Type | Default | +| :------------------ | :--------------------------------------------------------------------------------------------- | :------ | :------ | +| `catchEvents` | Whether the rule should catch function calls that send actions or events. | Boolean | `true` | +| `checkPlainGetters` | Whether the rule should check plain (non-computed) getters in native classes for side effects. | Boolean | `true` | + + diff --git a/docs/rules/order-in-components.md b/docs/rules/order-in-components.md index a92f1cff97..8ea251283e 100644 --- a/docs/rules/order-in-components.md +++ b/docs/rules/order-in-components.md @@ -8,6 +8,14 @@ Note: this rule will not be added to the `recommended` configuration because it ## Configuration + + +| Name | Type | +| :------ | :---- | +| `order` | Array | + + + ```js const rules = { 'ember/order-in-components': [ diff --git a/docs/rules/order-in-controllers.md b/docs/rules/order-in-controllers.md index e1ff7f7c95..2288ba3159 100644 --- a/docs/rules/order-in-controllers.md +++ b/docs/rules/order-in-controllers.md @@ -8,6 +8,14 @@ Note: this rule will not be added to the `recommended` configuration because it ## Configuration + + +| Name | Type | +| :------ | :---- | +| `order` | Array | + + + ```js const rules = { 'ember/order-in-controllers': [ diff --git a/docs/rules/order-in-models.md b/docs/rules/order-in-models.md index 19e842180e..9d837c1cfb 100644 --- a/docs/rules/order-in-models.md +++ b/docs/rules/order-in-models.md @@ -8,6 +8,14 @@ Note: this rule will not be added to the `recommended` configuration because it ## Configuration + + +| Name | Type | +| :------ | :---- | +| `order` | Array | + + + ```js const rules = { 'ember/order-in-models': [ diff --git a/docs/rules/order-in-routes.md b/docs/rules/order-in-routes.md index 4fc7813c64..0d018d8fb4 100644 --- a/docs/rules/order-in-routes.md +++ b/docs/rules/order-in-routes.md @@ -8,6 +8,14 @@ Note: this rule will not be added to the `recommended` configuration because it ## Configuration + + +| Name | Type | +| :------ | :---- | +| `order` | Array | + + + ```js const rules = { 'ember/order-in-routes': [ diff --git a/docs/rules/require-computed-macros.md b/docs/rules/require-computed-macros.md index 54e8f20f42..a8993b7dfb 100644 --- a/docs/rules/require-computed-macros.md +++ b/docs/rules/require-computed-macros.md @@ -119,9 +119,13 @@ export default Component.extend({ ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `includeNativeGetters` -- whether the rule should check and autofix computed properties with native getters (i.e. `@computed() get someProp() {}`) to use computed property macros (default `false`). This is off by default because in the Ember Octane world, the better improvement would be to keep the native getter and use tracked properties instead of computed properties. +| Name | Description | Type | Default | +| :--------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `includeNativeGetters` | Whether the rule should check and autofix computed properties with native getters (i.e. `@computed() get someProp() {}`) to use computed property macros (default `false`). This is off by default because in the Ember Octane world, the better improvement would be to keep the native getter and use tracked properties instead of computed properties. | Boolean | `false` | + + ## References diff --git a/docs/rules/require-computed-property-dependencies.md b/docs/rules/require-computed-property-dependencies.md index beaec353ce..7354c65e0c 100644 --- a/docs/rules/require-computed-property-dependencies.md +++ b/docs/rules/require-computed-property-dependencies.md @@ -47,10 +47,14 @@ export default EmberObject.extend({ ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `allowDynamicKeys` -- whether the rule should allow or disallow dynamic (variable / non-string) dependency keys in computed properties (default `true`) -- `boolean` -- `requireServiceNames` -- whether the rule should require injected service names to be listed as dependency keys in computed properties (default `false`) +| Name | Description | Type | Default | +| :-------------------- | :---------------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `allowDynamicKeys` | Whether the rule should allow or disallow dynamic (variable / non-string) dependency keys in computed properties. | Boolean | `true` | +| `requireServiceNames` | Whether the rule should require injected service names to be listed as dependency keys in computed properties. | Boolean | `false` | + + ## References diff --git a/docs/rules/require-super-in-lifecycle-hooks.md b/docs/rules/require-super-in-lifecycle-hooks.md index c209e72106..36dda9adf2 100644 --- a/docs/rules/require-super-in-lifecycle-hooks.md +++ b/docs/rules/require-super-in-lifecycle-hooks.md @@ -92,7 +92,11 @@ class Foo extends Component { ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `checkInitOnly` -- whether the rule should only check the `init` lifecycle hook and not other lifecycle hooks (default `false`) -- `boolean` -- `checkNativeClasses` -- whether the rule should check lifecycle hooks in native classes (in addition to classic classes) (default `true`) +| Name | Description | Type | Default | +| :------------------- | :------------------------------------------------------------------------------------------------ | :------ | :------ | +| `checkInitOnly` | Whether the rule should only check the `init` lifecycle hook and not other lifecycle hooks. | Boolean | `false` | +| `checkNativeClasses` | Whether the rule should check lifecycle hooks in native classes (in addition to classic classes). | Boolean | `true` | + + diff --git a/docs/rules/use-ember-get-and-set.md b/docs/rules/use-ember-get-and-set.md index 305fd5bf8c..cf0b31d293 100644 --- a/docs/rules/use-ember-get-and-set.md +++ b/docs/rules/use-ember-get-and-set.md @@ -43,7 +43,11 @@ setProperties(object, { foo: 'bar', baz: 'qux' }); ## Configuration -This rule takes an optional object containing: + -- `boolean` -- `ignoreThisExpressions` -- setting to `true` allows use of `this.get()` and `this.set()` where you will generally know if `this` is an `Ember.Object`. -- `boolean` -- `ignoreNonThisExpressions` -- setting to `true` allows use of non-Ember objects like `server.get()` and `map.set()`. +| Name | Description | Type | Default | +| :------------------------- | :----------------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `ignoreNonThisExpressions` | Enabling allows use of `this.get()` and `this.set()` where you will generally know if `this` is an `Ember.Object`. | Boolean | `false` | +| `ignoreThisExpressions` | Enabling allows use of `this.get()` and `this.set()` where you will generally know if `this` is an `Ember.Object`. | Boolean | `false` | + + diff --git a/lib/rules/named-functions-in-promises.js b/lib/rules/named-functions-in-promises.js index 581b6f409e..610a11cbb7 100644 --- a/lib/rules/named-functions-in-promises.js +++ b/lib/rules/named-functions-in-promises.js @@ -24,6 +24,7 @@ module.exports = { allowSimpleArrowFunction: { type: 'boolean', default: false, + description: 'Enabling allows arrow function expressions that do not have block bodies. These simple arrow functions must also only contain a single function call. For example: `.then(user => this._reloadUser(user))`.' }, }, additionalProperties: false, diff --git a/lib/rules/no-arrow-function-computed-properties.js b/lib/rules/no-arrow-function-computed-properties.js index 22ebd9d06c..29d8fcc1ff 100644 --- a/lib/rules/no-arrow-function-computed-properties.js +++ b/lib/rules/no-arrow-function-computed-properties.js @@ -25,6 +25,7 @@ module.exports = { onlyThisContexts: { type: 'boolean', default: false, + description: 'Whether the rule should allow or disallow computed properties where the arrow function body does not contain a `this` reference.', }, }, additionalProperties: false, diff --git a/lib/rules/no-classic-classes.js b/lib/rules/no-classic-classes.js index ebf55a93f7..b001b40634 100644 --- a/lib/rules/no-classic-classes.js +++ b/lib/rules/no-classic-classes.js @@ -59,6 +59,7 @@ module.exports = { items: { type: 'string', }, + description: 'Allows you to specify additional imports that should be flagged to disallow calling `extend` on. This allows you to handle the case where your app or addon is importing from a module that performs the `extend`.' }, }, additionalProperties: false, diff --git a/lib/rules/no-computed-properties-in-native-classes.js b/lib/rules/no-computed-properties-in-native-classes.js index 39057a806c..b1b5451953 100644 --- a/lib/rules/no-computed-properties-in-native-classes.js +++ b/lib/rules/no-computed-properties-in-native-classes.js @@ -44,6 +44,7 @@ module.exports = { ignoreClassic: { type: 'boolean', default: true, + description: 'Whether the rule should ignore usage inside of native classes labeled with `@classic`.', }, }, additionalProperties: false, diff --git a/lib/rules/no-controller-access-in-routes.js b/lib/rules/no-controller-access-in-routes.js index f43063be67..aa79e3bf56 100644 --- a/lib/rules/no-controller-access-in-routes.js +++ b/lib/rules/no-controller-access-in-routes.js @@ -30,6 +30,7 @@ module.exports = { allowControllerFor: { type: 'boolean', default: false, + description: 'Whether the rule should allow or disallow routes from accessing the controller outside of `setupController`/`resetController` via `controllerFor`.' }, }, additionalProperties: false, diff --git a/lib/rules/no-get-with-default.js b/lib/rules/no-get-with-default.js index b4322d5178..0bbec55196 100644 --- a/lib/rules/no-get-with-default.js +++ b/lib/rules/no-get-with-default.js @@ -24,10 +24,12 @@ module.exports = { catchSafeObjects: { type: 'boolean', default: true, + description: "Whether the rule should catch non-`this` imported usages like `getWithDefault(person, 'name', '')`." }, catchUnsafeObjects: { type: 'boolean', default: true, + description: "Whether the rule should catch non-`this` usages like `person.getWithDefault('name', '')` even though we don't know for sure if `person` is an Ember object." }, }, additionalProperties: false, diff --git a/lib/rules/no-get.js b/lib/rules/no-get.js index a76a175012..a4e2a933fc 100644 --- a/lib/rules/no-get.js +++ b/lib/rules/no-get.js @@ -171,26 +171,32 @@ module.exports = { ignoreGetProperties: { type: 'boolean', default: false, + description: "Whether the rule should ignore `getProperties`." }, ignoreNestedPaths: { type: 'boolean', default: false, + description: "Whether the rule should ignore `this.get('some.nested.property')` (can't be enabled at the same time as `useOptionalChaining`)." }, useOptionalChaining: { type: 'boolean', default: true, + description: "Whether the rule should use the [optional chaining operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) `?.` to autofix nested paths such as `this.get('some.nested.property')` to `this.some?.nested?.property` (when this option is off, these nested paths won't be autofixed at all)." }, catchSafeObjects: { type: 'boolean', default: true, + description: "Whether the rule should catch non-`this` imported usages like `get(foo, 'bar')`." }, catchUnsafeObjects: { type: 'boolean', default: false, + description: "Whether the rule should catch non-`this` usages like `foo.get('bar')` even though we don't know for sure if `foo` is an Ember object." }, useAt: { type: 'boolean', default: true, + description: "Whether the rule should use `at(-1)` [Array.prototype.at()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at) to replace `lastObject`." }, }, additionalProperties: false, diff --git a/lib/rules/no-private-routing-service.js b/lib/rules/no-private-routing-service.js index 80d0a29273..bf4aa5ac06 100644 --- a/lib/rules/no-private-routing-service.js +++ b/lib/rules/no-private-routing-service.js @@ -36,10 +36,12 @@ module.exports = { catchRouterMicrolib: { type: 'boolean', default: true, + description: "Whether the rule should catch usages of the private property `_routerMicrolib`." }, catchRouterMain: { type: 'boolean', default: true, + description: "Whether the rule should catch usages of the private property `router:main`.", }, }, additionalProperties: false, diff --git a/lib/rules/no-restricted-property-modifications.js b/lib/rules/no-restricted-property-modifications.js index f17bce485a..509bcb7ad3 100644 --- a/lib/rules/no-restricted-property-modifications.js +++ b/lib/rules/no-restricted-property-modifications.js @@ -30,6 +30,7 @@ module.exports = { }, minItems: 1, uniqueItems: true, + description: "Array of names of properties that should not be modified (modifying child/nested/sub-properties of these is also not allowed)." }, }, required: ['properties'], diff --git a/lib/rules/no-restricted-service-injections.js b/lib/rules/no-restricted-service-injections.js index b2ec4224ab..e9fdb6d11c 100644 --- a/lib/rules/no-restricted-service-injections.js +++ b/lib/rules/no-restricted-service-injections.js @@ -32,6 +32,7 @@ module.exports = { items: { type: 'string', }, + description: "Optional list of regexp file paths that injecting the specified services should be disallowed under (omit this field to match any path) (for glob patterns, use [ESLint `overrides`](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) instead)." }, services: { type: 'array', @@ -40,9 +41,11 @@ module.exports = { items: { type: 'string', }, + description: "List of (kebab-case) service names that should be disallowed from being injected under the specified paths." }, message: { type: 'string', + description: "Optional custom error message to display for violations." }, }, additionalProperties: false, diff --git a/lib/rules/no-runloop.js b/lib/rules/no-runloop.js index c13587e5ee..6e7c6aa0ca 100644 --- a/lib/rules/no-runloop.js +++ b/lib/rules/no-runloop.js @@ -58,6 +58,7 @@ module.exports = { enum: EMBER_RUNLOOP_FUNCTIONS, minItems: 1, }, + description: "If you have `@ember/runloop` functions that you wish to allow, you can configure this rule to allow specific methods. The configuration takes an object with the `allowList` property, which is an array of strings where the strings must be names of runloop functions." }, }, additionalProperties: false, diff --git a/lib/rules/no-side-effects.js b/lib/rules/no-side-effects.js index f349573e50..4e694ae927 100644 --- a/lib/rules/no-side-effects.js +++ b/lib/rules/no-side-effects.js @@ -154,10 +154,12 @@ module.exports = { catchEvents: { type: 'boolean', default: true, + description: "Whether the rule should catch function calls that send actions or events." }, checkPlainGetters: { type: 'boolean', default: true, + description: "Whether the rule should check plain (non-computed) getters in native classes for side effects." }, }, }, diff --git a/lib/rules/require-computed-macros.js b/lib/rules/require-computed-macros.js index 1d253f1c43..0c14cc5be6 100644 --- a/lib/rules/require-computed-macros.js +++ b/lib/rules/require-computed-macros.js @@ -140,6 +140,7 @@ module.exports = { includeNativeGetters: { type: 'boolean', default: false, + description: "Whether the rule should check and autofix computed properties with native getters (i.e. `@computed() get someProp() {}`) to use computed property macros (default `false`). This is off by default because in the Ember Octane world, the better improvement would be to keep the native getter and use tracked properties instead of computed properties." }, }, additionalProperties: false, diff --git a/lib/rules/require-computed-property-dependencies.js b/lib/rules/require-computed-property-dependencies.js index cd58b03e1d..45f5957ae3 100644 --- a/lib/rules/require-computed-property-dependencies.js +++ b/lib/rules/require-computed-property-dependencies.js @@ -73,7 +73,6 @@ function nodeToStringValue(node) { return node.left.value + node.right.value; } else { assert(false); - return undefined; } } @@ -260,10 +259,12 @@ module.exports = { allowDynamicKeys: { type: 'boolean', default: true, + description: "Whether the rule should allow or disallow dynamic (variable / non-string) dependency keys in computed properties." }, requireServiceNames: { type: 'boolean', default: false, + description: "Whether the rule should require injected service names to be listed as dependency keys in computed properties." }, }, additionalProperties: false, diff --git a/lib/rules/require-super-in-lifecycle-hooks.js b/lib/rules/require-super-in-lifecycle-hooks.js index 03d91c337d..2bfbf9856d 100644 --- a/lib/rules/require-super-in-lifecycle-hooks.js +++ b/lib/rules/require-super-in-lifecycle-hooks.js @@ -74,10 +74,12 @@ module.exports = { checkInitOnly: { type: 'boolean', default: false, + description: "Whether the rule should only check the `init` lifecycle hook and not other lifecycle hooks." }, checkNativeClasses: { type: 'boolean', default: true, + description: "Whether the rule should check lifecycle hooks in native classes (in addition to classic classes)." }, }, additionalProperties: false, diff --git a/lib/rules/use-ember-get-and-set.js b/lib/rules/use-ember-get-and-set.js index 2b7399b6dd..4e6421d061 100644 --- a/lib/rules/use-ember-get-and-set.js +++ b/lib/rules/use-ember-get-and-set.js @@ -30,10 +30,12 @@ module.exports = { ignoreThisExpressions: { type: 'boolean', default: false, + description: "Enabling allows use of `this.get()` and `this.set()` where you will generally know if `this` is an `Ember.Object`." }, ignoreNonThisExpressions: { type: 'boolean', default: false, + description: "Enabling allows use of `this.get()` and `this.set()` where you will generally know if `this` is an `Ember.Object`." }, }, additionalProperties: false,