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

Destructuring single-line assignments #13

Open
pdl opened this issue Feb 3, 2021 · 1 comment
Open

Destructuring single-line assignments #13

pdl opened this issue Feb 3, 2021 · 1 comment

Comments

@pdl
Copy link

pdl commented Feb 3, 2021

First, very many thanks for writing this package. I have been looking for a way to enforce aligned assignment in eslint for over a year.

I am finding that supplying defaults for destructuring single-line assignments confuses this plugin, for example:

const { foo = [] } = bar;

reports 'This group of assignments is not aligned'. The 'fix' produces:

const { foo            = [] } = bar;

which is not only worse but also does not stop the rule from complaining.

@pdl
Copy link
Author

pdl commented Feb 3, 2021

The behaviour additionally seems to depend on the default. true , 'xyz' and 1 seem unaffected, as is ([]), but '' and {} are affected.

Also interesting:

const { 
   foo = [],
   foooo = [],
} = bar;

doesn't get fixed as

const { 
   foo   = [],
   foooo = [],
} = bar;

pdl pushed a commit to pdl/eslint-plugin-align-assignments that referenced this issue Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant