Why is eslint throwing this error? The Javascript runs without issue inside of React Native. The code was taken from the react-navigation example at : https://reactnavigation.org/docs/intro/
Javascript:
JavaScript
x
2
1
static navigationOptions = { header: null };
2
eslint error:
JavaScript
1
2
1
error Parsing error: Unexpected token =
2
.eslintrc.js file:
JavaScript
1
8
1
module.exports = {
2
"extends": "standard",
3
"plugins": [
4
"react",
5
"react-native"
6
]
7
};
8
Advertisement
Answer
The syntax is not yet standardised, but a stage-2 proposal for inclusion in Javascript (see “Class Fields” on https://github.com/tc39/proposals).
Try adding the following option above “extends” in your .eslintrc.js:
JavaScript
1
2
1
"parser": "babel-eslint",
2