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.

Add `maxNesting` option to `object-curly-newline`.

See original GitHub issue

Configuration:

{
  "rules": {
    "object-curly-newline": [2, { 
      "multiline": true 
    }]
  }
}

Following code consider error:

// test.js

const defaultConfig = {
  endpoints: {
    http: null
  }
};

Result:

❯ eslint test.js 

test.js
  4:14  error  Unexpected a line break after this open brace    object-curly-newline
  6:3   error  Unexpected a line break before this close brace  object-curly-newline

✖ 2 problems (2 errors, 0 warnings)

I suggest add maxNesting option, which allows using linebreaks if object riches maxNesting.

  • { foo: { bar: {} } } - nesting = 2
  • { foo: { bar: { baz: {} } } } - nesting = 3

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nktcommented, Jul 25, 2016

Sorry for so long delay. I’ve updated first message @platinumazure @vitorbal

1reaction
platinumazurecommented, Jul 13, 2016

Ping @nkt, we need more information before we can determine what sort of issue this is. Can you please answer @vitorbal’s question as well as @eslintbot’s questions? Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

object-curly-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 >
Object Curly Spacing - Unibeautify
Config Key: object_curly_spacing ; Description: Inserts a space before/after brackets for object literals, destructuring assignments, and import/export ...
Read more >
node_modules/eslint-plugin-react/CHANGELOG.md · master ...
jsx-key : added checkKeyMustBeforeSpread option for new jsx transform (#2835 @morlay) ... Add jsx-curly-newline rule (#1493 @golopot); Add support for nested ...
Read more >
Rationale - Prettier
See object lists, nested configs, stylesheets and keyed methods, for example. ... And if you'd like to go multiline again, add in a...
Read more >
ESLint v2.13.0 released - ESLint中文文档
This release adds some new features and fixes several bugs found in the previous ... 4f73240 Fix: object-curly-newline multiline with comments (fixes #6381) ......
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