|
| 1 | +function test() { |
| 2 | + { |
| 3 | + const stream = getStream(); |
| 4 | + stream.pipe(destination); // $Alert |
| 5 | + } |
| 6 | + { |
| 7 | + const stream = getStream(); |
| 8 | + stream.pipe(destination); |
| 9 | + stream.on('error', handleError); |
| 10 | + } |
| 11 | + { |
| 12 | + const stream = getStream(); |
| 13 | + stream.on('error', handleError); |
| 14 | + stream.pipe(destination); |
| 15 | + } |
| 16 | + { |
| 17 | + const stream = getStream(); |
| 18 | + const s2 = stream; |
| 19 | + s2.pipe(dest); // $Alert |
| 20 | + } |
| 21 | + { |
| 22 | + const stream = getStream(); |
| 23 | + stream.on('error', handleError); |
| 24 | + const s2 = stream; |
| 25 | + s2.pipe(dest); |
| 26 | + } |
| 27 | + { |
| 28 | + const stream = getStream(); |
| 29 | + const s2 = stream; |
| 30 | + s2.on('error', handleError); |
| 31 | + s2.pipe(dest); |
| 32 | + } |
| 33 | + { |
| 34 | + const s = getStream().on('error', handler); |
| 35 | + const d = getDest(); |
| 36 | + s.pipe(d); |
| 37 | + } |
| 38 | + { |
| 39 | + getStream().on('error', handler).pipe(dest); |
| 40 | + } |
| 41 | + { |
| 42 | + const stream = getStream(); |
| 43 | + stream.on('error', handleError); |
| 44 | + const stream2 = stream.pipe(destination); |
| 45 | + stream2.pipe(destination2); // $Alert |
| 46 | + } |
| 47 | + { |
| 48 | + const stream = getStream(); |
| 49 | + stream.on('error', handleError); |
| 50 | + const destination = getDest(); |
| 51 | + destination.on('error', handleError); |
| 52 | + const stream2 = stream.pipe(destination); |
| 53 | + const s3 = stream2; |
| 54 | + s = s3.pipe(destination2); |
| 55 | + } |
| 56 | + { |
| 57 | + const stream = getStream(); |
| 58 | + stream.on('error', handleError); |
| 59 | + const stream2 = stream.pipe(destination); |
| 60 | + stream2.pipe(destination2); // $Alert |
| 61 | + } |
| 62 | + { // Error handler on destination instead of source |
| 63 | + const stream = getStream(); |
| 64 | + const dest = getDest(); |
| 65 | + dest.on('error', handler); |
| 66 | + stream.pipe(dest); // $Alert |
| 67 | + } |
| 68 | + { // Multiple aliases, error handler on one |
| 69 | + const stream = getStream(); |
| 70 | + const alias1 = stream; |
| 71 | + const alias2 = alias1; |
| 72 | + alias2.on('error', handleError); |
| 73 | + alias1.pipe(dest); |
| 74 | + } |
| 75 | + { // Multiple pipes, handler after first pipe |
| 76 | + const stream = getStream(); |
| 77 | + const s2 = stream.pipe(destination1); |
| 78 | + stream.on('error', handleError); |
| 79 | + s2.pipe(destination2); // $Alert |
| 80 | + } |
| 81 | + { // Handler registered via .once |
| 82 | + const stream = getStream(); |
| 83 | + stream.once('error', handleError); |
| 84 | + stream.pipe(dest); |
| 85 | + } |
| 86 | + { // Handler registered with arrow function |
| 87 | + const stream = getStream(); |
| 88 | + stream.on('error', (err) => handleError(err)); |
| 89 | + stream.pipe(dest); |
| 90 | + } |
| 91 | + { // Handler registered for unrelated event |
| 92 | + const stream = getStream(); |
| 93 | + stream.on('close', handleClose); |
| 94 | + stream.pipe(dest); // $Alert |
| 95 | + } |
| 96 | + { // Error handler registered after pipe, but before error |
| 97 | + const stream = getStream(); |
| 98 | + stream.pipe(dest); |
| 99 | + setTimeout(() => stream.on('error', handleError), 8000); // $MISSING:Alert |
| 100 | + } |
| 101 | + { // Pipe in a function, error handler outside |
| 102 | + const stream = getStream(); |
| 103 | + function doPipe(s) { s.pipe(dest); } |
| 104 | + stream.on('error', handleError); |
| 105 | + doPipe(stream); |
| 106 | + } |
| 107 | + { // Pipe in a function, error handler not set |
| 108 | + const stream = getStream(); |
| 109 | + function doPipe(s) { s.pipe(dest); } // $Alert |
| 110 | + doPipe(stream); |
| 111 | + } |
| 112 | + { // Dynamic event assignment |
| 113 | + const stream = getStream(); |
| 114 | + const event = 'error'; |
| 115 | + stream.on(event, handleError); |
| 116 | + stream.pipe(dest); // $SPURIOUS:Alert |
| 117 | + } |
| 118 | + { // Handler assigned via variable property |
| 119 | + const stream = getStream(); |
| 120 | + const handler = handleError; |
| 121 | + stream.on('error', handler); |
| 122 | + stream.pipe(dest); |
| 123 | + } |
| 124 | + { // Pipe with no intermediate variable, no error handler |
| 125 | + getStream().pipe(dest); // $Alert |
| 126 | + } |
| 127 | + { // Handler set via .addListener synonym |
| 128 | + const stream = getStream(); |
| 129 | + stream.addListener('error', handleError); |
| 130 | + stream.pipe(dest); |
| 131 | + } |
| 132 | + { // Handler set via .once after .pipe |
| 133 | + const stream = getStream(); |
| 134 | + stream.pipe(dest); |
| 135 | + stream.once('error', handleError); |
| 136 | + } |
| 137 | +} |
0 commit comments