miherlosev / eslint-plugin-testcafe

MIT License
15 stars 7 forks source link

Parsing error: Unexpected token t #3

Closed dragGH102 closed 7 years ago

dragGH102 commented 7 years ago

Error:

6:63 error Parsing error: Unexpected token t

How to reproduce

yarn add eslint eslint-plugin-testcafe --dev # or use npm, doesn't change anything
node_modules/eslint/bin/eslint.js tests/

Code being tested

import { Selector } from 'testcafe';

fixture `Getting Started`
  .page `some_url`;

test('some test', async t => {
  await t.expect(Selector('h1').innerText).contains('test');
});

.eslintrc

{   "parserOptions": {
      "ecmaVersion": 7,
      "sourceType": "module",
      "ecmaFeatures": {
          "jsx": true,
      }
  },
  "plugins": [
    "testcafe"
  ],
  "globals": {
    "t": true // this seems to have no effect
  },
  "extends": "plugin:testcafe/recommended"
}
dragGH102 commented 7 years ago

looks like the problem is that eslint can't parse the code as it finds an unexpected "t" property. so it would come to somehow override parseOptions. any clue?

dragGH102 commented 7 years ago

solved by:

yarn add babel-eslint --dev

and

"parser": "babel-eslint",

in .eslintrc