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.

indent rule's ignoredNodes not respected when multiline

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.16.0
  • Node Version: 8.9.4
  • npm Version: 5.6.0

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

Please show your full configuration:

Configuration
module.exports = {
    parser: 'babel-eslint',
    rules: {
        indent: ['error', 4, {
            ignoredNodes: [
                'JSXOpeningElement',
            ],
        }],
    },
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

function Test() {
    return (
        <div>
            {_.map(array, arrayValue => {
                return (condition &&
                    <Inner
                        one={arrayValue.one}
                    >
                        {arrayValue.two}
                    </Inner>
                );
            })}
        </div>
    );
}
./node_modules/.bin/eslint test.jsx

What did you expect to happen?

No error.

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

path/to/sandbox/2018-01-23/test.jsx
  8:1  error  Expected indentation of 24 spaces but found 20  indent

✖ 1 problem (1 error, 0 warnings)
  1 error, 0 warnings potentially fixable with the `--fix` option.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ljharbcommented, Feb 1, 2018

@Airbnb is having this same problem; when JSXOpeningElement is in ignored nodes, the > on a multiline opening element - which has no node type - is not ignored.

0reactions
ljharbcommented, Feb 2, 2018

That’s the only scenario I’ve seen it in, but i can’t really survey 10k+ files 😃

I’ll try it locally as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

indent - ESLint - Pluggable JavaScript Linter
This rule has an object option: "ignoredNodes" can be used to disable indentation checking for any AST node. This accepts an array of...
Read more >
Ignore the indentation in a template literal, with the ESLint ...
1. I got a warning from eslint using this config, specifically since it expects ignoredNodes to be an array. · I didn't get...
Read more >
indent-legacy - Rules - ESLint中文文档
Two spaces, not longer and no tabs: Google, npm, Node.js, Idiomatic, Felix; Tabs: jQuery; Four spaces: Crockford. Rule Details. This rule enforces a...
Read more >
How can you indent multiple lines all at once? - HTML FAQ
This is very late, but for anyone who comes across this: You can indent multiple things by selecting everything you want to indent,...
Read more >
[Review] SE-0168: Multi-Line String Literals - Swift Forums
On a separate note, I'd like to bring up the de-indentation behavior I described ... Why not simple rule that content of multi-line...
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