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.

Unexpected results from curly: multi

See original GitHub issue

What version of ESLint are you using?

3.3.1

What parser (default, Babel-ESLint, etc.) are you using?

Default

Please show your full configuration:

module.exports = {
    "env": {
        "node": true
    },
    "extends": "eslint:recommended",
    "rules": {
        "indent": [
            "error",
            2
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "always"
        ],
       "curly": [
          "error",
          "multi"
       ]
    }
};

What did you do? Please include the actual source code causing the issue.

/* global foo, cb */
if (foo) {
  try {
    foo();
  } catch (err) {
    cb(err);
  }
}

What did you expect to happen?

I would expect the above code to be valid.

What actually happened? Please include the actual, raw output from ESLint.

$ eslint index.js

/home/ryan/t-eslint/index.js
  2:1  error  Unnecessary { after 'if' condition  curly

✖ 1 problem (1 error, 0 warnings)

If this is the expected behavior, what is the correct way to format the code?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
RyanZimcommented, Aug 16, 2016

I don’t like:

if (foo)
    foo++;

Should be:

if (foo) foo++;
0reactions
RyanZimcommented, Aug 18, 2016

OK, I ended up wrapping my conditional inside the try block instead of putting the try statement in the conditional.

/* global foo, cb */

try {
  if (foo) foo();
} catch (err) {
  cb(err);
}

Closing for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Care for Multi-Textured Curly Hair | NaturallyCurly.com
If you have multiple textures, it is normal and you're not alone. Vitamin deficiencies or medication can cause a change in hair texture,...
Read more >
Unexpected result when initializing variable in C++ using curly ...
When I build and run the previous code in codelite I receive no errors. However, if I compile my atom file dailyPractice10.cpp using...
Read more >
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 >
Wait… IS MY HAIR ACTUALLY CURLY?! - Kayley Melissa
How to test if you actually have curly hair! Today AnnaLaura is trying out some curly girl method to see if her hair...
Read more >
Curly Girl Method Before and After [ROUTINE + PICTURES]
Want some mind-blowing transformation curly girl method before and after pictures? Literally had no idea my hair had any natural texture whatsoever.
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