Skip to content

Commit fe88cbb

Browse files
authored
refactor(rules): rename rules (ReactiveX#18)
* refactor(rules): rename rules Fix ReactiveX#17 * refactor: update rxjsCollapseImportsRule
1 parent 04ca59c commit fe88cbb

9 files changed

+37
-37
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ TSLint rules for rxjs.
66

77
This repository provides the following rules:
88

9-
| Rule Name | Configuration | Description |
10-
| :---------------------------------: | :-----------: | :-----------------------------------------------------: |
11-
| `collapse-rxjs-imports` | none | Collapses multiple imports from `rxjs` to a single one. |
12-
| `migrate-to-pipeable-operators` | none | Migrates side-effect operators to pipeables. |
13-
| `migrate-static-observable-methods` | none | Migrates static `Observable` method calls |
14-
| `update-rxjs-imports` | none | Updates RxJS 5.x.x imports to RxJS 6.0 |
9+
| Rule name | Configuration | Description |
10+
| --------------------------------- | ------------- | ---------------------------------------------------- |
11+
| rxjs-collapse-imports | none | Collapses multiple imports from rxjs to a single one |
12+
| rxjs-pipeable-operators-only | none | Migrates side-effect operators to pipeables |
13+
| rxjs-no-static-observable-methods | none | Migrates static Observable method calls |
14+
| rxjs-proper-imports | none | Updates RxJS 5.x.x imports to RxJS 6.0 |
1515

1616
## Migration to RxJS 6
1717

@@ -29,10 +29,10 @@ npm i rxjs-tslint
2929
{
3030
"rulesDirectory": ["node_modules/rxjs-tslint"],
3131
"rules": {
32-
"update-rxjs-imports": true,
33-
"migrate-to-pipeable-operators": true,
34-
"migrate-static-observable-methods": true,
35-
"collapse-rxjs-imports": true
32+
"rxjs-proper-imports": true,
33+
"rxjs-pipeable-operators-only": true,
34+
"rxjs-no-static-observable-methods": true,
35+
"rxjs-collapse-imports": true
3636
}
3737
}
3838
```

migrate-tslint.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"rulesDirectory": ["dist/src"],
33
"rules": {
4-
"update-rxjs-imports": true,
5-
"migrate-to-pipeable-operators": true,
6-
"migrate-static-observable-methods": true,
7-
"collapse-rxjs-imports": true
4+
"rxjs-proper-imports": true,
5+
"rxjs-pipeable-operators-only": true,
6+
"rxjs-no-static-observable-methods": true,
7+
"rxjs-collapse-imports": true
88
}
99
}

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { Rule as CollapseRxjsImports } from './collapseRxjsImportsRule';
2-
export { Rule as UpdateRxjsImports } from './updateRxjsImportsRule';
3-
export { Rule as MigrateToPipeableOperators } from './migrateToPipeableOperatorsRule';
4-
export { Rule as MigrateStaticObservableMethods } from './migrateStaticObservableMethodsRule';
1+
export { Rule as RxjsCollapseImports } from './rxjsCollapseImportsRule';
2+
export { Rule as RxjsProperImports } from './rxjsProperImportsRule';
3+
export { Rule as RxjsPipeableOperatorsOnly } from './rxjsPipeableOperatorsOnlyRule';
4+
export { Rule as RxjsNoStaticObservableMethods } from './rxjsNoStaticObservableMethods';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const FAILURE_STRING = 'duplicate RxJS import';
1111
*/
1212
export class Rule extends Lint.Rules.AbstractRule {
1313
static metadata: Lint.IRuleMetadata = {
14-
ruleName: 'collapse-rxjs-imports',
14+
ruleName: 'rxjs-collapse-imports',
1515
description:
1616
`In RxJS v6.0 most imports are just ` +
1717
`"import {...} from 'rxjs';". This TSLint rule collapses the ` +
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { subtractSets, concatSets, isObservable, returnsObservable, computeInser
99
*/
1010
export class Rule extends Lint.Rules.TypedRule {
1111
static metadata: Lint.IRuleMetadata = {
12-
ruleName: 'migrate-static-observable-methods',
12+
ruleName: 'rxjs-no-static-observable-methods',
1313
description: 'Updates the static methods of the Observable class.',
1414
optionsDescription: '',
1515
options: null,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { subtractSets, concatSets, isObservable, returnsObservable, computeInser
1111
*/
1212
export class Rule extends Lint.Rules.TypedRule {
1313
static metadata: Lint.IRuleMetadata = {
14-
ruleName: 'migrate-to-pipeable-operators',
14+
ruleName: 'rxjs-pipeable-operators-only',
1515
description: `Pipeable operators offer a new way of composing observable chains and
1616
they have advantages for both application developers and library
1717
authors.`,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as ts from 'typescript';
33

44
export class Rule extends Lint.Rules.AbstractRule {
55
public static metadata: Lint.IRuleMetadata = {
6-
ruleName: 'update-rxjs-imports',
6+
ruleName: 'rxjs-proper-imports',
77
type: 'functionality',
88
description: 'Updates the paths of the rxjs imports to the version 6',
99
rationale: 'RxJS version 6 updated their API which requires changes in some of the import paths.',
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { assert } from 'chai';
99
import { RuleFailure } from 'tslint';
1010

11-
describe('collapse-rxjs-imports', () => {
11+
describe('rxjs-collapse-imports', () => {
1212
it('should collapse imports', () => {
1313
const source = `
1414
import { foo } from 'rxjs';
@@ -18,7 +18,7 @@ describe('collapse-rxjs-imports', () => {
1818
`;
1919

2020
const err = assertMultipleAnnotated({
21-
ruleName: 'collapse-rxjs-imports',
21+
ruleName: 'rxjs-collapse-imports',
2222
failures: [
2323
{
2424
msg: 'duplicate RxJS import',
@@ -51,7 +51,7 @@ describe('collapse-rxjs-imports', () => {
5151
`;
5252

5353
const err = assertMultipleAnnotated({
54-
ruleName: 'collapse-rxjs-imports',
54+
ruleName: 'rxjs-collapse-imports',
5555
failures: [
5656
{
5757
msg: 'duplicate RxJS import',
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import {
88
import { assert } from 'chai';
99
import { RuleFailure } from 'tslint';
1010

11-
describe('update-rxjs-imports', () => {
11+
describe('rxjs-proper-imports', () => {
1212
describe('invalid import', () => {
1313
it('should update the old import', () => {
1414
const source = `
1515
import { foo } from 'rxjs/Subscriber';
1616
~~~~~~~~~~~~~~~
1717
`;
1818
const err = assertAnnotated({
19-
ruleName: 'update-rxjs-imports',
19+
ruleName: 'rxjs-proper-imports',
2020
message: 'outdated import path',
2121
source
2222
});
@@ -40,7 +40,7 @@ describe('update-rxjs-imports', () => {
4040
`;
4141

4242
const err = assertAnnotated({
43-
ruleName: 'update-rxjs-imports',
43+
ruleName: 'rxjs-proper-imports',
4444
message: 'outdated import path',
4545
source
4646
});
@@ -60,7 +60,7 @@ describe('update-rxjs-imports', () => {
6060
import 'rxjs/operators/do';
6161
`;
6262

63-
assertSuccess('update-rxjs-imports', source);
63+
assertSuccess('rxjs-proper-imports', source);
6464
});
6565
});
6666

@@ -73,7 +73,7 @@ describe('update-rxjs-imports', () => {
7373
import { EMPTY as empty } from 'rxjs';
7474
`;
7575

76-
const err = assertFailures('update-rxjs-imports', source, [
76+
const err = assertFailures('rxjs-proper-imports', source, [
7777
{
7878
startPosition: {
7979
line: 1,
@@ -109,7 +109,7 @@ describe('update-rxjs-imports', () => {
109109
import { EMPTY as Empty } from 'rxjs';
110110
`;
111111

112-
const err = assertFailures('update-rxjs-imports', source, [
112+
const err = assertFailures('rxjs-proper-imports', source, [
113113
{
114114
startPosition: {
115115
line: 1,
@@ -145,7 +145,7 @@ describe('update-rxjs-imports', () => {
145145
import { NEVER as never } from 'rxjs';
146146
`;
147147

148-
const err = assertFailures('update-rxjs-imports', source, [
148+
const err = assertFailures('rxjs-proper-imports', source, [
149149
{
150150
startPosition: {
151151
line: 1,
@@ -181,7 +181,7 @@ describe('update-rxjs-imports', () => {
181181
import { NEVER as Bar } from 'rxjs';
182182
`;
183183

184-
const err = assertFailures('update-rxjs-imports', source, [
184+
const err = assertFailures('rxjs-proper-imports', source, [
185185
{
186186
startPosition: {
187187
line: 1,
@@ -219,7 +219,7 @@ describe('update-rxjs-imports', () => {
219219
import { Unsubscribable as AnonymousSubscription } from 'rxjs';
220220
`;
221221

222-
const err = assertFailures('update-rxjs-imports', source, [
222+
const err = assertFailures('rxjs-proper-imports', source, [
223223
{
224224
startPosition: {
225225
line: 1,
@@ -255,7 +255,7 @@ describe('update-rxjs-imports', () => {
255255
import { Unsubscribable as AnonymousSubscription, SubscriptionLike as ISubscription } from 'rxjs';
256256
`;
257257

258-
const err = assertFailures('update-rxjs-imports', source, [
258+
const err = assertFailures('rxjs-proper-imports', source, [
259259
{
260260
startPosition: {
261261
line: 1,
@@ -302,7 +302,7 @@ describe('update-rxjs-imports', () => {
302302
import { from as fromPromise } from 'rxjs';
303303
`;
304304

305-
const err = assertFailures('update-rxjs-imports', source, [
305+
const err = assertFailures('rxjs-proper-imports', source, [
306306
{
307307
startPosition: {
308308
line: 1,
@@ -338,7 +338,7 @@ describe('update-rxjs-imports', () => {
338338
import { throwError as _throw } from 'rxjs';
339339
`;
340340

341-
const err = assertFailures('update-rxjs-imports', source, [
341+
const err = assertFailures('rxjs-proper-imports', source, [
342342
{
343343
startPosition: {
344344
line: 1,

0 commit comments

Comments
 (0)