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.

function-paren-newline error vs. max-len error

See original GitHub issue

The snippet:

export default connect(mapStateToProps, mapDispatchToProps)(
  generateDndContextWithBackend(SiteEditorContainer));

gives me the error Unexpected newline after "("

But when I remove the newline:

export default connect(mapStateToProps, mapDispatchToProps)(generateDndContextWithBackend(SiteEditorContainer));

I get the max-len error, because the line is longer than 100 characters.

What’s the way to fix this to avoid all errors? function-paren-newline isn’t currently smart enough to take account of line length, which seems like a shortcoming, especially now that we have highly evolved line-length tools like Prettier. I understand that there are tradeoffs, and best practices may conflict, but in principle there should be an error-free way to write this code that isn’t highly contorted. Solution?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:19
  • Comments:14

github_iconTop GitHub Comments

21reactions
ljharbcommented, Oct 11, 2017

This seems like it’s actually a bug in the function-paren-newline rule (or an unavoidable conflict with max-len).

For now, you may want to disable that rule entirely; I’ll leave this open to investigate disabling it in the config itself.

11reactions
ljharbcommented, Nov 2, 2017

@yutin1987 fwiw, this is how we handle your example:

shallow((
  <Tabbar active={0}>
    <Tabbar.Tab>Teb 1</Tabbar.Tab><Tabbar.Tab>Teb 2</Tabbar.Tab>
  </Tabbar>
));

or

shallow(
  <Tabbar active={0}>
    <Tabbar.Tab>Teb 1</Tabbar.Tab><Tabbar.Tab>Teb 2</Tabbar.Tab>
  </Tabbar>,
);
Read more comments on GitHub >

github_iconTop Results From Across the Web

function-paren-newline - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
How to disable eslint rule max line length for paragraph in ...
AFAIK, there is no way to apply eslint rules to the template, and ... to get around it, I've added this rule 'max-len':...
Read more >
set max length and show the error message - MSDN - Microsoft
this texbox allow the user input the URL into db, right now I want to set if the size is over 70, display...
Read more >
HTML attribute: maxlength - MDN Web Docs
The maxlength attribute defines the maximum number of characters (as UTF-16 code units) the user can enter into an or .
Read more >
Error while increasing Max Length - ServiceNow Community
Syntax Error or Access Rule Violation detected by database (BLOB/TEXT column 'a_str_16' used in key specification without a key length).
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