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 `indent` complaint after multiline destructure

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.0.0
  • Node Version: 6.9.1
  • npm Version: 3.10.8

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

deafault

Please show your full configuration:

var path = require('path')

// Warnings are errors in production.
var OFF = 'off';
var ERROR = 'error';
var WARNING = isTruthy(process.env.CI) ? ERROR : 'warn';

function isTruthy(value) {
  if (!value) return false;
  return ['1', 'true'].indexOf(value.toLowerCase()) >= 0;
}

module.exports = {
  "settings": {
    "import/extensions": [
      ".js",
    ],
    "import/ignore": [
      "node_modules",
    ],
    "import/resolver": {
      "webpack": {
        "config": path.join(__dirname, 'config', 'webpack.config.js')
      }
    }
  },
  "parserOptions": {
    "ecmaVersion": 8,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "experimentalObjectRestSpread": true
    }
  },
  "extends": [
    "eslint:recommended",
    "plugin:import/warnings",
    "plugin:import/errors",
    "plugin:react/recommended"
  ],
  "plugins": ["import", "react"],
  "rules": {
    "comma-dangle": OFF,
    "eqeqeq": [WARNING, "allow-null"],
    "import/imports-first": OFF,
    "jindent": [WARNING, 2, {"SwitchCase": 1}],
    "max-len": [WARNING, 100, 2],
    "no-console": [WARNING, {"allow": ["warn", "error"]}],
    "no-debugger": WARNING,
    "no-fallthrough": WARNING,
    "no-unreachable": WARNING,
    "no-unused-vars": [WARNING, {"vars": "all", "args": "none"}],
    "no-var": ERROR,
    "prefer-const": WARNING,
    "react/prop-types": [WARNING, {"ignore": ["className"]}],
    "semi": [WARNING, "never"],
    "no-warning-comments": [WARNING, {"location": "anywhere"}],
    "react/no-deprecated": OFF,
    "react/no-unescaped-entities": OFF,
  },
  "env": {
    "commonjs": true
  },
  "globals": {
    "alert": false,
    "ArrayBuffer": false,
    "Audio": false,
    "clearInterval": false,
    "clearTimeout": false,
    "confirm": false,
    "console": false,
    "document": false,
    "File": false,
    "FileReader": false,
    "FormData": false,
    "Image": false,
    "process": false,
    "Promise": false,
    "setInterval": false,
    "setTimeout": false,
    "Uint8Array": false,
    "window": false
  }
}

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

  const {
    a
  } = {
    a: 1
  }

  const [
    b
  ] = [
    2
  ]

What did you expect to happen?

No complaint from ESLint, equivalent to:

const c = [
  3
]

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

 ESLintError:
 /Users/rhys/[some path]
   53:5  warning  'a' is assigned a value but never used        no-unused-vars
   55:1  warning  Expected indentation of 6 spaces but found 4  indent
   56:1  warning  Expected indentation of 4 spaces but found 2  indent
   59:5  warning  'b' is assigned a value but never used        no-unused-vars
   61:1  warning  Expected indentation of 6 spaces but found 4  indent
   62:1  warning  Expected indentation of 4 spaces but found 2  indent

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
platinumazurecommented, Jun 14, 2017

@VictorHom Yes, issue is accepted so please go ahead. Just post back if you’re no longer able to work on the issue so someone else can pick it up (if something comes up). Stop by our Gitter chat if you need help or want to chat. Thanks for volunteering!

0reactions
not-an-aardvarkcommented, Jul 13, 2017

@idris can you please create a new issue? I’m not sure your problem is the same as the one from this issue.

Also, keep in mind that we don’t officially support flow, so it’s not guaranteed that all the core rules will work well with it. (That said, we are trying to make the indent rule work reasonably well in most cases when it encounters syntax it’s unfamiliar with)

Read more comments on GitHub >

github_iconTop Results From Across the Web

What should I do with "Unexpected indent" in Python?
If you got an unexpected indent and you see that all the code is perfectly indented, try opening it with another editor and...
Read more >
Ruby Style Guide
Indent when to case​​ Indent when as deep as case . This is the style established in both "The Ruby Programming Language" and...
Read more >
How do i resolve the unexpected indent error in python
As the error message indicates, you have an unexpected indent error. This error occurs when a statement is unnecessarily indented or its ...
Read more >
Airbnb JavaScript Style Guide()
7.15 Functions with multiline signatures, or invocations, should be indented just like every other multiline list in this guide: with each item on...
Read more >
cpplint.py - Washington
We do a small hack, which is to ignore //'s with "'s after them on the ... (Category names are printed with the...
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