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
Validator fails ES2019 public field declaration #3062
Comments
This is not a "variable outside the constructor". It is a (public) field declaration, supported in Firefox as of version 75 (and Chrome 74+), with the relevant bug being https://bugzilla.mozilla.org/show_bug.cgi?id=1499448 . The documentation is at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Class_fields#Public_fields (scroll a bit below to "Public instance fields" for your specific case). |
Thank you Rob. Title updated. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Class_fields#Public_fields states support from Firefox 69 !! |
I stand corrected; Public instance fields (what you're using here) have already been supported since 69 (https://bugzilla.mozilla.org/show_bug.cgi?id=1555464). I had public static fields in mind (syntax is |
Arrived here for the same reason. Right now I'm just stopping to use Ideally addons-linter would be able to identify an eslint already installed in the user's package.json and use that one instead? Or maybe a even better idea is instead of having a customer linter here, you would create an eslint plugin/preset for WebExtensions instead? Anyway, thanks! |
Another great workaround would be if we could just say: |
see also: #2758 |
Ran into this issue today. Unable to publish my extension because it makes use of static fields. |
Unfortunately this issue is still blocked on an upstream change: eslint officially supporting the class fields tc39 proposal. It looks that the class fields tc39 proposal is still at stage 3 (see https://github.com/tc39/proposal-class-fields) and I'm pretty sure that eslint does not usually introduce support for new javascript syntaxes until their tc39 proposal does reach stage 4. |
You can use {
parser: "@babel/eslint-parser",
parserOptions: {
requireConfigFile: false,
babelOptions: {
plugins: [
"@babel/plugin-proposal-class-properties"
]
}
}
} |
public class field declaration를 지원하지 않더라. mozilla/addons-linter#3062
Please fix this issue. Currently "Class Fields" feature is on stage 4, and Webpack 5 already supports it a few days ago webpack/webpack#10216 |
Depends on eslint/eslint#14343 |
ESLint v8.0.0-beta.0 (and ESLint v8.0.0-beta.1) have been released – with support for class fields – so if anyone would like to begin work on this, I guess it’s possible now! |
@willdurand This was before: |
ref: 75.0a1 (2020-02-27) (64-bit)
Validator fails ES2019 public field declaration even though Firefox works fine with.
Example:
PS. If support was added to Firefox, which version is it from?
The text was updated successfully, but these errors were encountered: