Question: it works with Gatsby?
CuteShaun opened this issue · comments
In my case eslint-config-wesbos does not want works with Gatsby, but it works with CRA.
Hi @CuteShaun
How are you running eslint
? As a npm script or on file auto-save?
I just installed a Gatsby Starter and then installed and configured the eslint-config-wesbos
package. I can get eslint
to run as a npm script (npm run lint
) without any issues.
The only issue I ran into WAAS the auto-fix on save that wouldn't work and that is because the Gatsby Starter had a .prettierrc
and .prettierignore
file that was causing a conflict - I removed those two files and the auto-fix on save worked.
The eslint-config-wesbos
package already includes prettier
with a prettier config and the external prettier files that the Gatsby starter had was causing a conflict.
Hello @Asjas :)
Thank you for responding. I had the same setup, it's gatsby-starter-blog
. When I'm trying run eslint with npm run lint
it throw common error:
But if I running eslint with autosave, nothing happens :(
What I tried:
gatsby clean
,rm -rf node_modules
, delete .lock files;- delete prettier, prettier ignore files;
- remove global packages,
npm remove --global eslint-config-wesbos babel-eslint eslint eslint-config-prettier eslint-config-airbnb eslint-plugin-html eslint-plugin-prettier eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react prettier eslint-plugin-react-hooks
;
My .eslintrc:
{
"extends": ["wesbos"],
"rules": {
"no-console": 2,
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 8
}
]
}
}
Dev dep. from package.json:
"devDependencies": {
"babel-eslint": "^9.0.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^4.3.0",
"eslint-config-wesbos": "0.0.22",
"eslint-loader": "^4.0.2",
"eslint-plugin-html": "^6.0.3",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^1.7.0",
"prettier": "^1.19.1"
},
I would be grateful for any idea why this might be happening?
Reinstall ESLint plugin for VSCode was helpful for me,
now everything works, Hurray!
Glad you got it working