This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 208
Unexpected token = on first function in a class #704
Comments
Is this a regression to #312? |
Same error here. I am using standard together with eslint and vscode plugins.
But i've tried eslint 2.9, 2.10.1 with no changes. My eslintrc.yml:
|
Ok, after 2 days stuggling and a few minutes after posting my message here, I discovered that the problem was caused by standardjs plugin on vscode, nothing to do with eslint. |
Thank you for the issue. Now that |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This code works well, is just annoying to see this error all the time.
The problem is, when you create a class in ReactJs, and then create two functions inside this class, the first one will be coloured as an error saying:
The second function has no error, is always the first. Note that this are arrow functions.
This code will do in Sublime Text 3 with babel-sublime, babel-linter and ESLint packages installed:
import React, { Component } from 'react'; class MyComponent extends Component { firstFunction = () => { return false; } secondFunction = () => { return false; } thirdFunction = () => { return false; } render() { return( <div> Component </div> ); } } export default MyComponent;
No matter what theme or color scheme are you using, this error will be present. I put a screenshot here so you can see the different color from the first function and the second and so on (no error present in the screenshot because I deactivated it on the linter rules).
I am putting my .eslintrc contents for you to see if something is making this error show up.
{ "parser": "babel-eslint", "ecmaFeatures": { "modules": true, "arrowFunctions": true, "classes": true }, "env": { "node": true, "browser": true, "es6": true, }, "rules": { "no-console": 0, "no-mixed-spaces-and-tabs": 0, "react/prop-types": 0, "react/no-unescaped-entities": 0, "react/no-string-refs": 0, "no-useless-escape": 0, "no-irregular-whitespace": 0, "strict": 0 }, "extends": [ "eslint:recommended", "plugin:react/recommended", ], "parserOptions": { ecmaVersion: 6, ecmaFeatures: { jsx: true, }, sourceType: "module" }, }
The text was updated successfully, but these errors were encountered: