nathanboktae / esformatter-asi

Esformatter plugin to automatically remove semicolons that would be inserted by ASI rules.
Other
1 stars 0 forks source link

Remove ; from es2015 features #2

Open arminrosu opened 8 years ago

arminrosu commented 8 years ago

Hi,

Thanks for a great plugin :).

I found in some cases, semicolons aren't removed, although it is legal (or at least I think it is) to do so:

.esformatter

{
    "preset": "default",
    "root": true,
    "plugins": [
        "esformatter-asi"
    ]
}

sample.js

import 'some/other/class';

@Decorator
export default class Example {
  @Inline property = '';

  @OtherLine
  variable = '';
}

Formatting sample.js doesn't change the file one bit :(.

nathanboktae commented 8 years ago

Glad you like it! Yup there are some new tokens I'm not looking for here that are being missed.

e-cloud commented 8 years ago

@nathanboktae , when will you update its behavior?

nathanboktae commented 8 years ago

Never because attribute based programming is a huge antipattern everyone should avoid. Even the rare cases when I want a class, es6 classes are limited vs es5 (want to make a getter enumerable? SOL with es6. Have truly private state? Declare your "methods" in the constructor and access closure variables).

JavaScript is a beautiful functional language, please move on from the dark ages of OOP.

I'll take PRs on this if you want to tackle it.

e-cloud commented 8 years ago

Is it related to coding pattern?

DRY is what's needed. Add more rules for removing semicolon would be great.

BTW, I just hoped that this plugin can remove semicolon at the end of importDeclaration.