I have Eslint and JSCS setup to reformat some code base with airbnb js style guide in WebStorm. I have been using this setup effectively for the past 2 days, but all of a sudden, WebStorm started throwing this error...
Problem with ESLint reformatting:index.js: Initialization error (ESLint). Unexpected identifier
I thought maybe I had some error in my .eslintrc but then I had used the same config to successfully refactor about 150 files before this sudden error. Prior to this, the JSCS compiler was occasionally throwing "less than a minute timeout" exceptions, but then I would fix this with closing and reopening the file. The eslint though seems not to be falling for this trick.
This is my .eslintrc
config
{
"extends": "airbnb",
"env": {
"browser": true,
"node": true
},
"globals": {
"document": false
},
"rules": {
"validateIndentation": 4,
"func-names": [
"error",
"never"
],
"react/jsx-filename-extension": [
1,
{
"extensions": [
".js",
".jsx"
]
}
],
"jsx-a11y/label-has-for": [
2,
{
"components": [
"Label"
],
"required": {
"some": [
"nesting",
"id"
]
},
"allowChildren": false
}
],
"jsx-a11y/anchor-is-valid": [
"error",
{
"components": [
"Link"
],
"specialLink": [
"to",
"hrefLeft",
"hrefRight"
],
"aspects": [
"noHref",
"invalidHref",
"preferButton"
]
}
]
}
}
Some part of package.json
{
"eslint": "^4.14.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-flowtype": "^2.40.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.5.1",
"extract-text-webpack-plugin": "^3.0.2",
"prop-types": "^15.6.0",
"react": "^16.2.0",
"react-dev-utils": "^4.2.1",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
},
"babel": {
"presets": [
"react-app",
"flow"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
Can some one throw me some pointers on how I can go about fixing this. I suspect it might be more of a WebStorm error than Eslint.
PS: Forgive me if this question might be better suited at superuser. I just thought it's most likely someone here might have faced the same issue.
Problem with ESLint reformatting:index.js: Initialization error (ESLint). Unexpected identifier
is the same message that appears on clicking show ballon link. It just re formats the same message in a better looking ballon tooltip box. – Dugaidjs
files produced a much more detailed error pointing to eslinting in lodash.yarn upgrade
helped – Dugaid2022.3
) – Mcclintock