diff --git a/source/rules/rxjsAddRule.ts b/source/rules/rxjsAddRule.ts index f2bb87c9..4ff321cf 100644 --- a/source/rules/rxjsAddRule.ts +++ b/source/rules/rxjsAddRule.ts @@ -17,7 +17,7 @@ import { UsedWalker } from "../support/used-walker"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { deprecationMessage: - peer.v6 && !peer.compat ? "Rule not needed for v6." : undefined, + peer.v6 && !peer.compat ? peer.v6NotNeededMessage : undefined, description: "Enforces the importation of patched observables and operators used in the module.", options: { diff --git a/source/rules/rxjsDeepOperatorsRule.ts b/source/rules/rxjsDeepOperatorsRule.ts index 9896c922..f984394e 100644 --- a/source/rules/rxjsDeepOperatorsRule.ts +++ b/source/rules/rxjsDeepOperatorsRule.ts @@ -11,7 +11,7 @@ import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { deprecationMessage: - peer.v6 && !peer.compat ? "Rule not needed for v6." : undefined, + peer.v6 && !peer.compat ? peer.v6NotNeededMessage : undefined, description: "Enforces deep importation from within 'rxjs/operators'.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoAddRule.ts b/source/rules/rxjsNoAddRule.ts index 77ae6877..e3d48907 100644 --- a/source/rules/rxjsNoAddRule.ts +++ b/source/rules/rxjsNoAddRule.ts @@ -11,7 +11,7 @@ import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { deprecationMessage: - peer.v6 && !peer.compat ? "Rule not needed for v6." : undefined, + peer.v6 && !peer.compat ? peer.v6NotNeededMessage : undefined, description: "Disallows the importation of patched observables and operators.", options: { diff --git a/source/rules/rxjsNoAsyncSubscribeRule.ts b/source/rules/rxjsNoAsyncSubscribeRule.ts index 3fd8ee9c..86a1c714 100644 --- a/source/rules/rxjsNoAsyncSubscribeRule.ts +++ b/source/rules/rxjsNoAsyncSubscribeRule.ts @@ -7,10 +7,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as tsutils from "tsutils"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows passing async functions to subscribe.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoCompatRule.ts b/source/rules/rxjsNoCompatRule.ts index 3b2e8384..9ca3af6a 100644 --- a/source/rules/rxjsNoCompatRule.ts +++ b/source/rules/rxjsNoCompatRule.ts @@ -6,10 +6,11 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { - deprecationMessage: undefined, + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows importation from locations that depend upon 'rxjs-compat'.", options: null, diff --git a/source/rules/rxjsNoConnectableRule.ts b/source/rules/rxjsNoConnectableRule.ts index dc5c01eb..48453468 100644 --- a/source/rules/rxjsNoConnectableRule.ts +++ b/source/rules/rxjsNoConnectableRule.ts @@ -6,10 +6,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeFunction } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows operators that return connectable observables.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoDeepOperatorsRule.ts b/source/rules/rxjsNoDeepOperatorsRule.ts index 0c7dfc04..25629716 100644 --- a/source/rules/rxjsNoDeepOperatorsRule.ts +++ b/source/rules/rxjsNoDeepOperatorsRule.ts @@ -11,7 +11,7 @@ import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { deprecationMessage: - peer.v6 && !peer.compat ? "Rule not needed for v6." : undefined, + peer.v6 && !peer.compat ? peer.v6NotNeededMessage : undefined, description: "Disallows deep importation from 'rxjs/operators'.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoExplicitGenericsRule.ts b/source/rules/rxjsNoExplicitGenericsRule.ts index c4a17609..64507a22 100644 --- a/source/rules/rxjsNoExplicitGenericsRule.ts +++ b/source/rules/rxjsNoExplicitGenericsRule.ts @@ -7,9 +7,11 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as tsutils from "tsutils"; import * as ts from "typescript"; +import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows explicit generic type arguments.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoExposedSubjectsRule.ts b/source/rules/rxjsNoExposedSubjectsRule.ts index 2fc83092..a8b64108 100644 --- a/source/rules/rxjsNoExposedSubjectsRule.ts +++ b/source/rules/rxjsNoExposedSubjectsRule.ts @@ -7,12 +7,14 @@ import * as Lint from "tslint"; import * as tsutils from "tsutils"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; const defaultAllowedTypesRegExp = /^EventEmitter$/; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows exposed subjects.", options: { properties: { diff --git a/source/rules/rxjsNoIgnoredNotifierRule.ts b/source/rules/rxjsNoIgnoredNotifierRule.ts index 38b5f04d..9ace7380 100644 --- a/source/rules/rxjsNoIgnoredNotifierRule.ts +++ b/source/rules/rxjsNoIgnoredNotifierRule.ts @@ -7,10 +7,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as tsutils from "tsutils"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows observables not composed from the `repeatWhen` or `retryWhen` notifier.", options: null, diff --git a/source/rules/rxjsNoIgnoredObservableRule.ts b/source/rules/rxjsNoIgnoredObservableRule.ts index 5c6a3746..566630e9 100644 --- a/source/rules/rxjsNoIgnoredObservableRule.ts +++ b/source/rules/rxjsNoIgnoredObservableRule.ts @@ -6,10 +6,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows the ignoring of observables returned by functions.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoIgnoredReplayBufferRule.ts b/source/rules/rxjsNoIgnoredReplayBufferRule.ts index 1738741e..8411e2d0 100644 --- a/source/rules/rxjsNoIgnoredReplayBufferRule.ts +++ b/source/rules/rxjsNoIgnoredReplayBufferRule.ts @@ -6,9 +6,11 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows using `ReplaySubject`, `publishReplay` or `shareReplay` without specifying the buffer size.", options: null, diff --git a/source/rules/rxjsNoIgnoredSubscriptionRule.ts b/source/rules/rxjsNoIgnoredSubscriptionRule.ts index 0cda224e..0f6e652b 100644 --- a/source/rules/rxjsNoIgnoredSubscriptionRule.ts +++ b/source/rules/rxjsNoIgnoredSubscriptionRule.ts @@ -7,10 +7,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as tsutils from "tsutils"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows ignoring the subscription returned by subscribe.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoIndexRule.ts b/source/rules/rxjsNoIndexRule.ts index eca09f14..cda41889 100644 --- a/source/rules/rxjsNoIndexRule.ts +++ b/source/rules/rxjsNoIndexRule.ts @@ -6,10 +6,11 @@ import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { - deprecationMessage: undefined, + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows the importation from index modules.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoInternalRule.ts b/source/rules/rxjsNoInternalRule.ts index 63bfea21..2e3e3e53 100644 --- a/source/rules/rxjsNoInternalRule.ts +++ b/source/rules/rxjsNoInternalRule.ts @@ -6,10 +6,11 @@ import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { - deprecationMessage: undefined, + deprecationMessage: peer.v5 ? peer.v6OnlyMessage : undefined, description: "Disallows the importation of internals.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoNestedSubscribeRule.ts b/source/rules/rxjsNoNestedSubscribeRule.ts index 10efb090..6394c5d2 100644 --- a/source/rules/rxjsNoNestedSubscribeRule.ts +++ b/source/rules/rxjsNoNestedSubscribeRule.ts @@ -7,10 +7,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as tsutils from "tsutils"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows the calling of `subscribe` within a `subscribe` callback.", options: null, diff --git a/source/rules/rxjsNoOperatorRule.ts b/source/rules/rxjsNoOperatorRule.ts index 3c35a693..04d313fb 100644 --- a/source/rules/rxjsNoOperatorRule.ts +++ b/source/rules/rxjsNoOperatorRule.ts @@ -11,7 +11,7 @@ import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { deprecationMessage: - peer.v6 && !peer.compat ? "Rule not needed for v6." : undefined, + peer.v6 && !peer.compat ? peer.v6NotNeededMessage : undefined, description: "Disallows importation from 'rxjs/operator'.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoPatchedRule.ts b/source/rules/rxjsNoPatchedRule.ts index 6453dbd8..b2c74d9e 100644 --- a/source/rules/rxjsNoPatchedRule.ts +++ b/source/rules/rxjsNoPatchedRule.ts @@ -13,7 +13,7 @@ import { UsedWalker } from "../support/used-walker"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { deprecationMessage: - peer.v6 && !peer.compat ? "Rule not needed for v6." : undefined, + peer.v6 && !peer.compat ? peer.v6NotNeededMessage : undefined, description: "Disallows the calling of patched methods.", options: { properties: { diff --git a/source/rules/rxjsNoRedundantNotifyRule.ts b/source/rules/rxjsNoRedundantNotifyRule.ts index 9391d1a6..38c9f9e1 100644 --- a/source/rules/rxjsNoRedundantNotifyRule.ts +++ b/source/rules/rxjsNoRedundantNotifyRule.ts @@ -6,10 +6,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows redundant notifications from completed or errored observables.", options: null, diff --git a/source/rules/rxjsNoSharereplayRule.ts b/source/rules/rxjsNoSharereplayRule.ts index 7ef25c2c..3175694a 100644 --- a/source/rules/rxjsNoSharereplayRule.ts +++ b/source/rules/rxjsNoSharereplayRule.ts @@ -7,9 +7,11 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as tsutils from "tsutils"; import * as ts from "typescript"; +import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows using the `shareReplay` operator.", options: { properties: { diff --git a/source/rules/rxjsNoSubclassRule.ts b/source/rules/rxjsNoSubclassRule.ts index 0b245aa1..272da15f 100644 --- a/source/rules/rxjsNoSubclassRule.ts +++ b/source/rules/rxjsNoSubclassRule.ts @@ -6,10 +6,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows subclassing RxJS classes.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoUnboundMethodsRule.ts b/source/rules/rxjsNoUnboundMethodsRule.ts index e909c530..5c108018 100644 --- a/source/rules/rxjsNoUnboundMethodsRule.ts +++ b/source/rules/rxjsNoUnboundMethodsRule.ts @@ -13,7 +13,7 @@ import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { - deprecationMessage: peer.v5 || peer.compat ? "Rule is v6-only." : undefined, + deprecationMessage: peer.v5 ? peer.v6OnlyMessage : undefined, description: "Disallows the passing of unbound methods.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsNoUnusedAddRule.ts b/source/rules/rxjsNoUnusedAddRule.ts index 5f70af1c..f6da2633 100644 --- a/source/rules/rxjsNoUnusedAddRule.ts +++ b/source/rules/rxjsNoUnusedAddRule.ts @@ -14,7 +14,7 @@ import { UsedWalker } from "../support/used-walker"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { deprecationMessage: - peer.v6 && !peer.compat ? "Rule not needed for v6." : undefined, + peer.v6 && !peer.compat ? peer.v6NotNeededMessage : undefined, description: "Disallows the importation of patched observables or operators that are not used in the module.", options: null, diff --git a/source/rules/rxjsNoWholesaleRule.ts b/source/rules/rxjsNoWholesaleRule.ts index 9d9082a1..ff2ac488 100644 --- a/source/rules/rxjsNoWholesaleRule.ts +++ b/source/rules/rxjsNoWholesaleRule.ts @@ -11,7 +11,7 @@ import * as peer from "../support/peer"; export class Rule extends Lint.Rules.AbstractRule { public static metadata: Lint.IRuleMetadata = { deprecationMessage: - peer.v6 && !peer.compat ? "Rule not needed for v6." : undefined, + peer.v6 && !peer.compat ? peer.v6NotNeededMessage : undefined, description: "Disallows the wholesale importation of `rxjs` or `rxjs/Rx`.", options: null, optionsDescription: "Not configurable.", diff --git a/source/rules/rxjsPreferAngularAsyncPipeRule.ts b/source/rules/rxjsPreferAngularAsyncPipeRule.ts index 2d8f416c..8a6de4fe 100644 --- a/source/rules/rxjsPreferAngularAsyncPipeRule.ts +++ b/source/rules/rxjsPreferAngularAsyncPipeRule.ts @@ -6,10 +6,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disallows the calling of `subscribe` within an Angular component.", options: null, diff --git a/source/rules/rxjsPreferAngularCompositionRule.ts b/source/rules/rxjsPreferAngularCompositionRule.ts index ad9b6542..07c1f018 100644 --- a/source/rules/rxjsPreferAngularCompositionRule.ts +++ b/source/rules/rxjsPreferAngularCompositionRule.ts @@ -6,10 +6,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType, isThis } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Enforces the composition of subscriptions within an Angular component.", options: null, diff --git a/source/rules/rxjsPreferAngularTakeuntilRule.ts b/source/rules/rxjsPreferAngularTakeuntilRule.ts index 087b708d..ac15082e 100644 --- a/source/rules/rxjsPreferAngularTakeuntilRule.ts +++ b/source/rules/rxjsPreferAngularTakeuntilRule.ts @@ -8,10 +8,12 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as tsutils from "tsutils"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType, isThis } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: Lint.Utils .dedent`Enforces the application of the takeUntil operator when calling subscribe within an Angular component.`, diff --git a/source/rules/rxjsPreferObserverRule.ts b/source/rules/rxjsPreferObserverRule.ts index d2a5606d..61aac409 100644 --- a/source/rules/rxjsPreferObserverRule.ts +++ b/source/rules/rxjsPreferObserverRule.ts @@ -12,7 +12,7 @@ import { couldBeFunction, couldBeType } from "../support/util"; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { - deprecationMessage: peer.v5 || peer.compat ? "Rule is v6-only." : undefined, + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Enforces the passing of observers to `subscribe` and `tap`.", options: { properties: { diff --git a/source/rules/rxjsSuffixSubjectsRule.ts b/source/rules/rxjsSuffixSubjectsRule.ts index 83182d70..f353a7a6 100644 --- a/source/rules/rxjsSuffixSubjectsRule.ts +++ b/source/rules/rxjsSuffixSubjectsRule.ts @@ -6,12 +6,14 @@ import { tsquery } from "@phenomnomnominal/tsquery"; import * as Lint from "tslint"; import * as ts from "typescript"; +import * as peer from "../support/peer"; import { couldBeType } from "../support/util"; const defaultTypesRegExp = /^EventEmitter$/; export class Rule extends Lint.Rules.TypedRule { public static metadata: Lint.IRuleMetadata = { + deprecationMessage: peer.v5 ? peer.v5NotSupportedMessage : undefined, description: "Disalllows subjects that don't end with the specified `suffix` option.", options: { diff --git a/source/support/peer.ts b/source/support/peer.ts index 3d6cbed0..bbbd7a8d 100644 --- a/source/support/peer.ts +++ b/source/support/peer.ts @@ -36,7 +36,11 @@ export const compat = peerDir export const dir = peerDir; export const version = peerVersion; export const v5 = peerVersion && semver.satisfies(peerVersion, "^5.0.0"); +export const v5NotSupportedMessage = + "This rule is v6-only. The rule might work with v5, it has not been tested and is not supported."; export const v6 = peerVersion && semver.satisfies(peerVersion, "^6.0.0-rc.0"); +export const v6NotNeededMessage = "Rule not needed for v6."; +export const v6OnlyMessage = "This rule is v6-only."; export function warn(dir: string = ""): void { /*tslint:disable-next-line:no-console*/