Skip to content

Commit 82d5842

Browse files
committed
fixup code so tests will run
1 parent b6c37a9 commit 82d5842

File tree

6 files changed

+19
-16
lines changed

6 files changed

+19
-16
lines changed

packages/eslint-plugin-rxjs/src/lib/rules/no-unsafe-switchmap.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const defaultOptions: readonly {
1919
observable?: string;
2020
}[] = [];
2121

22+
export type RuleOptions = typeof defaultOptions;
2223
export const messageId = 'forbidden';
2324
export default ESLintUtils.RuleCreator(() => __filename)({
2425
meta: {

packages/eslint-plugin-rxjs/src/lib/rules/no-unsafe-takeuntil.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const defaultOptions: readonly {
1515
allow?: string[];
1616
}[] = [];
1717

18+
export type RuleOptions = typeof defaultOptions;
19+
1820
export const messageId = 'forbidden';
1921
export default ESLintUtils.RuleCreator(() => __filename)({
2022
meta: {

packages/eslint-plugin-rxjs/src/lib/tests/rules/no-unsafe-switchmap.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { convertAnnotatedSourceToFailureCase } from '@angular-eslint/test-utils';
2-
import rule, { messageId } from '../../rules/no-unsafe-switchmap';
2+
import rule, { messageId, RuleOptions } from '../../rules/no-unsafe-switchmap';
33
import { testCheckConfig } from './type-check';
44
import { RuleTester } from '@typescript-eslint/rule-tester';
55
const ruleTester = new RuleTester(testCheckConfig);
@@ -53,7 +53,7 @@ ruleTester.run('no-unsafe-switchmap', rule, {
5353
${setup}
5454
const fooEffect = actions.pipe(ofType("FOO"), tap(() => {}), switchMap(() => EMPTY));
5555
`,
56-
options: [
56+
options: <RuleOptions>[
5757
{
5858
allow: ['FOO'],
5959
},
@@ -66,7 +66,7 @@ ruleTester.run('no-unsafe-switchmap', rule, {
6666
const barEffect = actions.pipe(ofType("BAR"), tap(() => {}), switchMap(() => EMPTY));
6767
const bazEffect = actions.pipe(ofType("BAZ"), tap(() => {}), switchMap(() => EMPTY));
6868
`,
69-
options: [
69+
options: <RuleOptions>[
7070
{
7171
disallow: ['FOO'],
7272
},
@@ -146,7 +146,7 @@ ruleTester.run('no-unsafe-switchmap', rule, {
146146
const barEffect = actions.pipe(ofType("BAR"), tap(() => {}), switchMap(() => EMPTY));
147147
~~~~~~~~~
148148
`,
149-
options: [
149+
options: <RuleOptions>[
150150
{
151151
allow: ['FOO'],
152152
},
@@ -161,7 +161,7 @@ ruleTester.run('no-unsafe-switchmap', rule, {
161161
const bazEffect = actions.pipe(ofType("BAZ"), tap(() => {}), switchMap(() => EMPTY));
162162
~~~~~~~~~
163163
`,
164-
options: [
164+
options: <RuleOptions>[
165165
{
166166
allow: ['FOO'],
167167
},
@@ -177,7 +177,7 @@ ruleTester.run('no-unsafe-switchmap', rule, {
177177
const fooEffect = actions.pipe(ofType("FOO"), tap(() => {}), switchMap(() => EMPTY));
178178
~~~~~~~~~
179179
`,
180-
options: [
180+
options: <RuleOptions>[
181181
{
182182
disallow: ['FOO'],
183183
},

packages/eslint-plugin-rxjs/src/lib/tests/rules/no-unsafe-takeuntil.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { convertAnnotatedSourceToFailureCase } from '@angular-eslint/test-utils';
2-
import rule, { messageId } from '../../rules/no-unsafe-takeuntil';
2+
import rule, { messageId, RuleOptions } from '../../rules/no-unsafe-takeuntil';
33
import { testCheckConfig } from './type-check';
44
import { RuleTester } from '@typescript-eslint/rule-tester';
55
const ruleTester = new RuleTester(testCheckConfig);
@@ -114,7 +114,7 @@ ruleTester.run('no-unsafe-takeuntil', rule, {
114114
115115
const e = a.pipe(takeUntil(d), tap(value => console.log(value))).subscribe();
116116
`,
117-
options: [
117+
options: <RuleOptions>[
118118
{
119119
allow: ['tap'],
120120
},
@@ -134,7 +134,7 @@ ruleTester.run('no-unsafe-takeuntil', rule, {
134134
135135
const d = a.pipe(switchMap(_ => b), untilDestroyed()).subscribe();
136136
`,
137-
options: [
137+
options: <RuleOptions>[
138138
{
139139
alias: ['untilDestroyed'],
140140
},
@@ -158,7 +158,7 @@ ruleTester.run('no-unsafe-takeuntil', rule, {
158158
r = a.pipe(takeUntil(b), untilDestroyed()).subscribe();
159159
r = a.pipe(untilDestroyed(), takeUntil(c)).subscribe();
160160
`,
161-
options: [
161+
options: <RuleOptions>[
162162
{
163163
alias: ['untilDestroyed'],
164164
},
@@ -231,7 +231,7 @@ ruleTester.run('no-unsafe-takeuntil', rule, {
231231
const d = a.pipe(takeUntil(c), tap(value => console.log(value)), switchMap(_ => b)).subscribe();
232232
~~~~~~~~~
233233
`,
234-
options: [
234+
options: <RuleOptions>[
235235
{
236236
allow: ['tap'],
237237
},
@@ -284,7 +284,7 @@ ruleTester.run('no-unsafe-takeuntil', rule, {
284284
const d = a.pipe(untilDestroyed(), switchMap(_ => b)).subscribe();
285285
~~~~~~~~~~~~~~
286286
`,
287-
options: [
287+
options: <RuleOptions>[
288288
{
289289
alias: ['untilDestroyed'],
290290
},
@@ -307,7 +307,7 @@ ruleTester.run('no-unsafe-takeuntil', rule, {
307307
const d = a.pipe(obj.untilDestroyed(), switchMap(_ => b)).subscribe();
308308
~~~~~~~~~~~~~~~~~~
309309
`,
310-
options: [
310+
options: <RuleOptions>[
311311
{
312312
alias: ['untilDestroyed'],
313313
},

packages/eslint-plugin-rxjs/src/lib/tests/rules/prefer-observer.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ ruleTester.run('prefer-observer', rule, {
115115
complete: () => console.log("complete")
116116
})).subscribe();
117117
`,
118-
options: [{}],
119118
},
120119
{
121120
code: `
@@ -155,7 +154,6 @@ ruleTester.run('prefer-observer', rule, {
155154
source.subscribe(nextObserver);
156155
source.pipe(tap(nextObserver));
157156
`,
158-
options: [{}],
159157
},
160158
{
161159
code: `
@@ -173,7 +171,6 @@ ruleTester.run('prefer-observer', rule, {
173171
function (value) { console.log(value); }
174172
)).subscribe();
175173
`,
176-
options: [{}],
177174
},
178175
{
179176
code: `

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./tsconfig.base.json"
3+
}

0 commit comments

Comments
 (0)