From 902eb143df462fb832c29c567a6afdfc41354779 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sat, 28 Aug 2021 18:25:05 +1200 Subject: [PATCH] feat!(no-method-signature): deprecate rule in favor of prefer-readonly-type-declaration --- README.md | 11 +++++------ src/configs/all.ts | 1 - src/configs/no-mutations.ts | 1 - src/rules/no-method-signature.ts | 5 +++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ff98c2130..1d75c8321 100644 --- a/README.md +++ b/README.md @@ -186,12 +186,11 @@ The [below section](#supported-rules) gives details on which rules are enabled b :see_no_evil: = `no-mutations` Ruleset. -| Name | Description | :see_no_evil: | :hear_no_evil: | :speak_no_evil: | :wrench: | :blue_heart: | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | :---------------------------------------------: | :--------------------------------------: | :----------------------------------------------: | :------: | :---------------: | -| [`immutable-data`](./docs/rules/immutable-data.md) | Disallow mutating objects and arrays | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :blue_heart: | -| [`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-readonly-type-declaration`](./docs/rules/prefer-readonly-type-declaration.md) | Encore use of readonly types where possible | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :wrench: | :thought_balloon: | +| Name | Description | :see_no_evil: | :hear_no_evil: | :speak_no_evil: | :wrench: | :blue_heart: | +| -------------------------------------------------------------------------------------- | ------------------------------------------- | :---------------------------------------------: | :--------------------------------------: | :----------------------------------------------: | :------: | :---------------: | +| [`immutable-data`](./docs/rules/immutable-data.md) | Disallow mutating objects and arrays | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :blue_heart: | +| [`no-let`](./docs/rules/no-let.md) | Disallow mutable variables | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | +| [`prefer-readonly-type-declaration`](./docs/rules/prefer-readonly-type-declaration.md) | Encore use of readonly types where possible | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :wrench: | :thought_balloon: | ### No Object-Orientation Rules diff --git a/src/configs/all.ts b/src/configs/all.ts index 690bc34d1..cdd88ab7d 100644 --- a/src/configs/all.ts +++ b/src/configs/all.ts @@ -19,7 +19,6 @@ const config: Linter.Config = { { files: ["*.ts", "*.tsx"], rules: { - "functional/no-method-signature": "error", "functional/no-mixed-type": "error", "functional/prefer-readonly-type-declaration": "error", "functional/prefer-tacit": ["error", { assumeTypes: false }], diff --git a/src/configs/no-mutations.ts b/src/configs/no-mutations.ts index acd249f7d..4da9ff73b 100644 --- a/src/configs/no-mutations.ts +++ b/src/configs/no-mutations.ts @@ -9,7 +9,6 @@ const config: Linter.Config = { { files: ["*.ts", "*.tsx"], rules: { - "functional/no-method-signature": "warn", "functional/prefer-readonly-type-declaration": "error", }, }, diff --git a/src/rules/no-method-signature.ts b/src/rules/no-method-signature.ts index 4cc46997a..0782c02ec 100644 --- a/src/rules/no-method-signature.ts +++ b/src/rules/no-method-signature.ts @@ -40,10 +40,11 @@ const errorMessages = { // The meta data for this rule. const meta: RuleMetaData = { + deprecated: true, + replacedBy: ["prefer-readonly-type-declaration"], type: "suggestion", docs: { - description: - "Prefer property signatures with readonly modifiers over method signatures.", + description: "Prefer property signatures over method signatures.", recommended: "warn", }, messages: errorMessages,