[Bug]: JS Mode incorrectly flags static class properties as syntax error
- Dominant language
- JavaScript
- Stars
- 27.1k
- Forks
- 5.3k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
In the JavaScript (JS) mode of Ace Editor, declaring static class properties (fields) causes a syntax highlighting and error detection issue. The editor incorrectly flags the static property declaration as a syntax error, even though it is valid JavaScript syntax (part of ECMAScript 2022 / ES13).
### Expected Behavior
The static class property declaration (static myStaticField = 'initial value';) should be recognized as valid syntax and should not be highlighted as an error.
### Current Behavior
The line containing the static class property declaration is highlighted with an error marker, indicating a syntax error.
### Reproduction Steps
1. Open Ace Editor.
2. Set the mode to `ace/mode/javascript`.
3. Enter the following code snippet:
```javascript
class Example {
static myStaticField = 'initial value'; // --> Warning: Class properties must be methods. Expected '(' but instead saw '='.
constructor() {
console.log(Example.myStaticField);
}
}
const instance = new Example();
```
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### Ace Version / Browser / OS / Keyboard layout
1.39.1 / any / any
Contributor guide
Assessment
This issue has not been assessed yet.