Skip to content

Commit

Permalink
feat(prefer-readonly-type): deprecated this rule
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens committed Jan 28, 2023
1 parent d2624cd commit 82816a0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ The [below section](#supported-rules) gives details on which rules are enabled b
| [`no-let`](./docs/rules/no-let.md) | Disallow mutable variables | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
| [`no-method-signature`](./docs/rules/no-method-signature.md) | Enforce property signatures with readonly modifiers over method signatures | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :thought_balloon: |
| [`prefer-immutable-parameter-types`](./docs/rules/prefer-immutable-parameter-types.md) | Require function parameters to be typed as certain immutability | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :thought_balloon: |
| [`prefer-readonly-type`](./docs/rules/prefer-readonly-type.md) | Use readonly types and readonly modifiers where possible | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :wrench: | :thought_balloon: |
| [`type-declaration-immutability`](./docs/rules/type-declaration-immutability.md) | Enforce the immutability of types based on patterns | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :thought_balloon: |

### No Object-Orientation Rules
Expand Down
6 changes: 5 additions & 1 deletion docs/rules/prefer-readonly-type.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Prefer readonly types over mutable types (prefer-readonly-type)

This rule enforces use of the readonly modifier and readonly types.
## :warning: This rule is deprecated

This rule has been replaced by
[prefer-immutable-parameter-types](./prefer-immutable-parameter-types.md) and
[type-declaration-immutability](./type-declaration-immutability.md).

## Rule Details

Expand Down
2 changes: 1 addition & 1 deletion src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const config: Linter.Config = {
"functional/no-method-signature": "error",
"functional/no-mixed-type": "error",
"functional/prefer-immutable-parameter-types": "error",
"functional/prefer-readonly-type": "error",
"functional/prefer-property-signatures": "error",
"functional/prefer-tacit": ["error", { assumeTypes: false }],
"functional/no-return-void": "error",
"functional/type-declaration-immutability": "error",
Expand Down
1 change: 0 additions & 1 deletion src/configs/no-mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const config: Linter.Config = {
rules: {
"functional/no-method-signature": "warn",
"functional/prefer-immutable-parameter-types": "error",
"functional/prefer-readonly-type": "error",
"functional/type-declaration-immutability": "error",
},
},
Expand Down
5 changes: 5 additions & 0 deletions src/rules/prefer-readonly-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ const errorMessages = {
* The meta data for this rule.
*/
const meta: ESLintUtils.NamedCreateRuleMeta<keyof typeof errorMessages> = {
deprecated: true,
replacedBy: [
"functional/prefer-immutable-parameter-types",
"functional/type-declaration-immutability",
],
type: "suggestion",
docs: {
description: "Prefer readonly array over mutable arrays.",
Expand Down

0 comments on commit 82816a0

Please sign in to comment.