Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

array-bracket-spacing and array destructuring in function parameters with flow types #35

Closed
zaygraveyard opened this issue Dec 20, 2015 · 0 comments

Comments

@zaygraveyard
Copy link
Contributor

test.js

/*eslint array-bracket-spacing: [2, "never"] */
function fnArray([a, b]: Array<any >): void {
  // nothing important
}

What versions I'm using

eslint@1.10.3
babel-eslint@4.1.6

What I did

$eslint --parser babel-eslint test.js

What I expected

No errors

What actually happened

/tmp/test.js
  2:36  error  There should be no space before '>'  array-bracket-spacing

✖ 1 problem (1 error, 0 warnings)

My Observations

The ArrayPattern node of the AST tree contains the type annotation.

function fnArray([a, b]: Array<any >): void {
//               ^-----------------^
//                ArrayPattern

The array-bracket-spacing rule checks the last and before last tokens of the AST node (ie. last is > an before last is any).

Since the between the before last token and last token their is a space and the expected is no space, an error is reported.

zaygraveyard added a commit to zaygraveyard/eslint-plugin-babel that referenced this issue Dec 20, 2015
zaygraveyard added a commit to zaygraveyard/eslint-plugin-babel that referenced this issue Dec 20, 2015
* issue35:
  Fix: array-bracket-spacing for destructuring typed parameter (fixes babel#35)
  Add the `array-bracket-spacing` rule with the necessary modifications from eslint/eslint
zaygraveyard added a commit to zaygraveyard/eslint-plugin-babel that referenced this issue Dec 20, 2015
* issue35:
  Fix: array-bracket-spacing for destructuring typed parameter (fixes babel#35)
  Add the `array-bracket-spacing` rule with the necessary modifications from eslint/eslint
jquense added a commit that referenced this issue Dec 21, 2015
Fix: array-bracket-spacing for destructuring typed parameter (fixes #35)
nicolo-ribaudo pushed a commit to babel/babel that referenced this issue Nov 14, 2019
…ue35

Fix: array-bracket-spacing for destructuring typed parameter (fixes babel/eslint-plugin-babel#35)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant