question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unicorn/no-array-push-push - breaks stream.push

See original GitHub issue

unicorn/no-array-push-push combines .push, but it can’t do this if the .push is for something that is not an array, like stream.

Before

const stream = new Readable();
stream.push('attachment content');
stream.push(null); // end of file

After

const stream = new Readable();
stream.push('attachment content', null); // end of file
//                                ^^^^ null is not a valid encoding

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sindresorhuscommented, Jan 24, 2021

But you have to end the stream with null. Alternatively, we could just ignore if the instance is called stream.

0reactions
fiskercommented, Jan 24, 2021

I understand that, my point is doing this is not really very useful,

const stream = new Readable();
stream.push('one string');
stream.push('another string');  // <- this will be reported too
Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-plugin-unicorn/no-array-push-push.md at main - GitHub
Enforce combining multiple Array#push() into one call. This rule is enabled in the ✓ recommended config. This rule is automatically fixable by the ......
Read more >
eslint-plugin-unicorn - npm
Name Description ✓ 🔧 💡 consistent‑destructuring Use destructured variables over properties. ✓ 🔧 💡 custom‑error‑definition Enforce correct Error subclassing. 🔧 empty‑brace‑spaces Enforce no spaces between braces....
Read more >
eslint-plugin-unicorn/readme.md - UNPKG
54, "unicorn/no-array-for-each": "error",. 55, "unicorn/no-array-method-this-argument": "error",. 56, "unicorn/no-array-push-push": "error",.
Read more >
eslint-plugin-unicorn - npm Package Health Analysis - Snyk
Disallow using the this argument in array methods. ✓,,. no-array-push-push, Enforce combining multiple Array#push() into one call.
Read more >
Hydraulic Disk brake piston not fully retracting
Use a brake block to push both pistons evenly back into the caliper. Pull the lever with the block in to align. Refit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found