Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indent rule - Reports incorrectly for lines following computed object props #8989

Closed
jonvuri opened this issue Jul 22, 2017 · 1 comment
Closed
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly indent Relates to the `indent` rule rule Relates to ESLint's core rules

Comments

@jonvuri
Copy link
Contributor

jonvuri commented Jul 22, 2017

Tell us about your environment

  • ESLint Version: 4.3.0
  • Node Version: 8.2.1
  • npm Version: 5.3.0

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

babel-eslint

Please show your full configuration:

Configuration
---

parser: babel-eslint

parserOptions:
  ecmaVersion: 6
  impliedStrict: true
  ecmaFeatures:
    arrowFunctions: true
    blockBindings: true
    classes: true
    defaultParams: true
    destructuring: true
    forOf: true
    generators: false
    modules: true
    objectLiteralComputedProperties: true
    objectLiteralDuplicateProperties: false
    objectLiteralShorthandMethods: true
    objectLiteralShorthandProperties: true
    spread: true
    superInFunctions: true
    templateStrings: true
    jsx: true

env:
  browser: true
  mocha: true
  es6: true

globals:
  expect: false

plugins:
  - react
  - flowtype
  - fp

settings:
  flowtype:
    onlyFilesWithFlowAnnotation: true


extends:
  - eslint:recommended
  - plugin:react/recommended

rules:

  # Babel inserts 'use strict' for us already
  strict:
    - error
    - never


  # Best Practices

  array-callback-return: error
  complexity:
    - error
    - 8
  curly: error
  default-case: error
  dot-notation: error
  eqeqeq: error
  no-alert: error
  no-div-regex: error
  no-empty-function: error
  no-eval: error
  no-extend-native: error
  no-extra-bind: error
  no-implicit-coercion: error
  no-implicit-globals: error
  no-implied-eval: error
  no-invalid-this: error
  no-labels: error
  no-lone-blocks: error
  no-loop-func: error
  no-multi-spaces: error
  no-multi-str: error
  no-native-reassign: error
  no-new: error
  no-new-func: error
  no-new-wrappers: error
  no-param-reassign:
    - error
    - props: true
  no-return-assign: error
  no-script-url: error
  no-self-compare: error
  no-sequences: error
  no-throw-literal: error
  no-unmodified-loop-condition: error
  no-unused-expressions: error
  no-useless-call: error
  no-useless-concat: error
  no-useless-escape: error
  no-void: error
  no-warning-comments: warn
  no-with: error
  wrap-iife: error
  yoda: error


  # Variables

  init-declarations: error
  no-shadow:
    - error
    - hoist: all
  no-shadow-restricted-names: error
  no-use-before-define: error


  # Stylistic

  array-bracket-spacing:
    - error
    - always
  brace-style: error
  camelcase: error
  comma-dangle:
    - error
    - never
  comma-spacing: error
  comma-style: error
  computed-property-spacing:
    - error
    - always
  consistent-this: error
  eol-last: error
  indent:
    - error
    - 2
    - SwitchCase: 1
  key-spacing: error
  keyword-spacing: error
  linebreak-style: error
  max-depth:
    - error
    - 5
  max-len:
    - error
    - 110
  max-nested-callbacks:
    - error
    - 4
  max-params:
    - error
    - 4
  max-statements:
    - error
    - 20
    - ignoreTopLevelFunctions: true
  max-statements-per-line: error
  new-parens: error
  newline-after-var: error
  newline-before-return: error
  newline-per-chained-call: error
  no-array-constructor: error
  no-bitwise: error
  no-continue: error
  no-extra-parens: error
  no-inline-comments: error
  no-lonely-if: error
  no-mixed-spaces-and-tabs: error
  no-multiple-empty-lines:
    - error
    - max: 2
      maxEOF: 1
      maxBOF: 0
  no-negated-condition: error
  no-new-object: error
  no-plusplus: error
  no-restricted-syntax:
    - error
    - TryStatement
    - FunctionDeclaration
  no-spaced-func: error
  no-trailing-spaces:
    - error
    - skipBlankLines: true
  no-unneeded-ternary: error
  no-whitespace-before-property: error
  object-curly-spacing:
    - error
    - always
  object-property-newline:
    - error
    - allowMultiplePropertiesPerLine: true
  one-var:
    - error
    - never
  operator-assignment: error
  quote-props:
    - error
    - as-needed
  quotes:
    - error
    - single
  semi:
    - error
    - never
  space-before-blocks: error
  space-in-parens:
    - error
    - always
  space-infix-ops:
    - error
  space-unary-ops: error
  spaced-comment: error
  unicode-bom: error


  # ES2015

  arrow-body-style: error
  arrow-parens: error
  arrow-spacing: error
  no-useless-computed-key: error
  no-var: error
  object-shorthand: error
  prefer-const: error
  prefer-spread: error
  prefer-template: error
  template-curly-spacing:
    - error
    - always


  # React

  react/display-name: off
  react/jsx-boolean-value: error
  react/jsx-closing-bracket-location: error
  react/jsx-closing-tag-location: error
  react/jsx-curly-spacing:
    - error
    - always
  react/jsx-equals-spacing: error
  react/jsx-filename-extension: error
  react/jsx-first-prop-new-line:
    - error
    - multiline
  react/jsx-handler-names: error
  react/jsx-indent:
    - error
    - 2
  react/jsx-indent-props:
    - error
    - 2
  react/jsx-key: error
  react/jsx-max-props-per-line:
    - error
    - maximum: 4
  react/jsx-no-bind: error
  react/jsx-no-comment-textnodes: error
  react/jsx-no-target-blank: error
  react/jsx-pascal-case: error
  react/jsx-tag-spacing: error
  react/jsx-wrap-multilines:
    - error
    - declaration: false
      assignment: false
      arrow: false
      return: true
  react/prefer-stateless-function: error
  react/prop-types: off
  #react/require-optimization: error
  react/require-extension: off
  react/self-closing-comp: error
  react/sort-comp: error


  # Flowtype

  flowtype/require-parameter-type: error
  flowtype/require-return-type: error
  flowtype/space-after-type-colon:
    - error
    - always
  flowtype/space-before-type-colon:
    - error
    - never

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

const o = {
  prop:
    () => 'return'
}

const o = {
  [ prop ]:
    () => 'return'
}

What did you expect to happen?
Neither of the above patterns to return any errors.

What actually happened? Please include the actual, raw output from ESLint.
The second pattern returned an error (for the line containing () => 'return'):
error Expected indentation of 2 spaces but found 4 indent

Note: This works correctly in indent-legacy

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jul 22, 2017
@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly indent Relates to the `indent` rule rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Jul 23, 2017
@not-an-aardvark
Copy link
Member

Hi, thanks for reporting. This looks like a bug to me.

@not-an-aardvark not-an-aardvark self-assigned this Jul 25, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly indent Relates to the `indent` rule rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants