0

I'm not sure the exact name of this syntax but this is what I use as needed:

  handleChange = (event) => {

JSHint is giving me an error as it does not recognize it:

I'm not sure but I think I can set the ES version as follows:

{
  "esversion": (put version number here)
}

Will this work and how high can I set it?

Is there another way to do it.

The marked duplicated is over 3 years old and hopefully the jshint team has addressed / worked on this over the last 4+ years (similar issue reported on github).

howard
  • 234
  • 1
  • 11
  • [Class fields](//developer.mozilla.org/docs/Web/JavaScript/Reference/Classes/Public_class_fields) will be [officially introduced](//github.com/tc39/proposals/blob/master/finished-proposals.md) in ECMAScript 2022. See the documentation on MDN about [expressions and operators](//developer.mozilla.org/docs/Web/JavaScript/Reference/Operators) and [statements](//developer.mozilla.org/docs/Web/JavaScript/Reference/Statements). ESLint is more likely to support it sooner. See [GitHub](//github.com/eslint/eslint/issues/14857). JSHint issue is also on [GitHub](//github.com/jshint/jshint/issues/3139). – Sebastian Simon Sep 10 '21 at 02:26
  • [Duplicate](//google.com/search?q=site%3Astackoverflow.com+jshint+class+fields) of [Class properties must be methods. Expected '(' but instead saw '='](/q/51349648/4642212). – Sebastian Simon Sep 10 '21 at 02:35
  • Yes, it is a duplicate because there’s nothing you can currently do to use class fields with linters; this has not changed since the linked question. I don’t see how the age of the GitHub discussions or the question is relevant. Supporting these features takes a long time; so did the feature itself. The proposal only got recently finished in April of this year. JSHint is known to be very slow to add support for new proposals. The linked question does have to do with JSHint: _“Expected '(' but instead saw '='”_ is a JSHint warning. No, JSHint doesn’t support the syntax _at all_, currently. – Sebastian Simon Sep 10 '21 at 02:49
  • This is not a duplicate. That link to github is over 4 years old. Also, the marked duplicate has **very little** to do with jshint and is over 3 years old. I imagine / hope this syntax can be checked for if jshint is configured properly. – howard Sep 10 '21 at 02:51
  • _“The marked duplicated is over 3 years old and hopefully the jshint team has addressed / worked on this over the last 4+ years (similar issue reported on github).”_ — evidently not. The same GitHub issue is still open and still relevant, but support is not there yet. – Sebastian Simon Sep 10 '21 at 02:53

0 Answers0