jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

does not support async methods #2270

Closed graingert closed 8 years ago

graingert commented 8 years ago

Using the airbnb preset with:

import ham from 'ham';

class Foo {
  async blah() {}
}

I get:

Expected token type "Punctuator" but "Identifier" found at test/webdriver.js :
     1 |import ham from 'ham';
--------^
     2 |
     3 |class Foo {

It works fine with:

import ham from 'ham';

async function blah() {};

class Foo {
  blah() { return this::blah(); }
}
markelog commented 8 years ago

Fixed in cst repo

graingert commented 8 years ago

How do I use the cst repo? On 13 Jun 2016 23:16, "Oleg Gaidarenko" notifications@github.com wrote:

Fixed in cst repo

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jscs-dev/node-jscs/issues/2270#issuecomment-225725274, or mute the thread https://github.com/notifications/unsubscribe/AAZQTB2yE_LB63hP-qff-qMgq0nJFNLhks5qLdaqgaJpZM4I0arw .

markelog commented 8 years ago

Wait until cst is updated in jscs, hence this ticket is still open

purplecones commented 8 years ago

I still get this issue. See related issue filed with AtomLinter https://github.com/AtomLinter/linter-jscs/issues/282 for more info.

Sample Code:

import shortid from 'shortid';

const rootResolvers = () => {
  return {
    Query: {
      async test(root, args, context) {
        return test;
      },
    },
  };
};

export default rootResolvers;

JSCS CLI Export:

jscs resolvers.js -c airbnb.json
Expected token type "Punctuator" but "Identifier" found at resolvers.js :
     1 |import shortid from 'shortid';
--------^
     2 |
     3 |const rootResolvers = () => {

1 code style error found.
jscs --version
3.0.7
markelog commented 8 years ago

Those are different issues - you are talking about object method whereas original issue is about class method, created - https://github.com/cst/cst/issues/133