Skip to content

Commit

Permalink
chore: Fix up rule deprecations.
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Nov 29, 2019
1 parent 3c75115 commit 392106c
Show file tree
Hide file tree
Showing 30 changed files with 52 additions and 13 deletions.
2 changes: 1 addition & 1 deletion source/rules/rxjsAddRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsDeepOperatorsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsNoAddRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoAsyncSubscribeRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 2 additions & 1 deletion source/rules/rxjsNoCompatRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoConnectableRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsNoDeepOperatorsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoExplicitGenericsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoExposedSubjectsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoIgnoredNotifierRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoIgnoredObservableRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoIgnoredReplayBufferRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoIgnoredSubscriptionRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 2 additions & 1 deletion source/rules/rxjsNoIndexRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 2 additions & 1 deletion source/rules/rxjsNoInternalRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoNestedSubscribeRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsNoOperatorRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsNoPatchedRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoRedundantNotifyRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoSharereplayRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsNoSubclassRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsNoUnboundMethodsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsNoUnusedAddRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsNoWholesaleRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsPreferAngularAsyncPipeRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsPreferAngularCompositionRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsPreferAngularTakeuntilRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
Expand Down
2 changes: 1 addition & 1 deletion source/rules/rxjsPreferObserverRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions source/rules/rxjsSuffixSubjectsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 4 additions & 0 deletions source/support/peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down

0 comments on commit 392106c

Please sign in to comment.