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

Property Initializers of Class #675

Closed
Rokt33r opened this issue Nov 8, 2016 · 3 comments

Comments

@Rokt33r
Copy link

commented Nov 8, 2016

class KeyBinding {
  static currentIndex = 1 // <-- This

  constructor(source, command, keystrokes, selector, priority) {
    this.source = source;
    this.command = command;
    this.keystrokes = keystrokes;
    this.priority = priority;
    this.keystrokeArray = this.keystrokes.split(" ");
    this.keystrokeCount = this.keystrokeArray.length;
    this.selector = selector.replace(/!important/g, "");
    this.specificity = calculateSpecificity(selector);
    this.index = this.constructor.currentIndex++;
  }
...
}

Will this feature be available on Standard?

@dcousens

This comment has been minimized.

Copy link
Member

commented Nov 8, 2016

@Rokt33r what do you mean?

If ESLint can parse it, then it is "supported".
But I don't think we have any specific rules related to it yet...

edit: just realised you might have meant the static initialiser specifically... in which case, there was an issue for that around here somewhere...

@dcousens dcousens added the question label Nov 8, 2016

@Rokt33r

This comment has been minimized.

Copy link
Author

commented Nov 8, 2016

@dcousens Thanks for your comment.
Yes, I always got an error, Parsing error: Unexpected token =, when I using the static initializer.
Btw,I found the answer. It seems to need babel-eslint as a parser to using this syntax.

@Rokt33r Rokt33r closed this Nov 8, 2016

@feross

This comment has been minimized.

Copy link
Member

commented Dec 30, 2016

If you're using experimental JavaScript features (which I personally don't advise doing), then you'll need babel-eslint. Once a feature reaches stage-4, ESLint and standard will support it, but not before then!

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.