vscode-standard: Extension doesn't load babel config files with babel-eslint
What version of this package are you using?
1.2.3
What operating system, Node.js, and npm version?
W10, 12.7.0, 6.10.0
What happened?
Doesn’t load babel config when using babel-eslint
Parsing error: No Babel config file detected for filename

What did you expect to happen?
Parsing works in terminal using standard and it should in vscode as well.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 21 (3 by maintainers)
Commits related to this issue
- Fix finding babel config files with @babel/eslint-parser Fixes: https://github.com/standard/vscode-standard/issues/100 — committed to standard/vscode-standard by feross 3 years ago
- fix: finding babel config files with @babel/eslint-parser (#207) Fixes: https://github.com/standard/vscode-standard/issues/100 — committed to standard/vscode-standard by feross 3 years ago
@marcinczenko The solution for me (I’m using a monorepo) was to specify the path to the root
babel.config.json:.eslintrc.jsFor me what did the trick was to add the path of the project I want to lint to
eslint.workingDirectoriesin.vscode/settings.jsonof the root of the workspace. EDIT: This fix was for vscode-eslint, not vscode-standard (wrong repo)For others looking for the same problem: When working with mono-repos and different babelrc files in your packages, this also happens with the newer
@babel/eslint-parser, and is by design:https://babeljs.io/docs/en/config-files#root-babelconfigjson-file
Your project now needs a root-level
babel.config.jsfile or similar, with an addedbabelrcRootsproperty.On
10.0.3, this step wasn’t required…I got this same parsing error because I mistakenly opened a parent directory, with directories inside, each using its own Babel configuration. The solution was just to create a new workspace and then add the folders to the workspace. VSCode then knows to keep the configurations separate. An obvious oversight on my part, but just thought I’d share in case anyone else tried doing the same thing 😅
Okay, the fix is released in version 1.5.1 of the extension. Please make sure you’re using the new extension (https://marketplace.visualstudio.com/items?itemName=standard.vscode-standard) and not the old one. (We changed the owner organization to
standard, so you’ll need to reinstall.I believe I’ve fixed this issue with this PR: https://github.com/standard/vscode-standard/pull/207
If you’re using
standardorstandardx, etc. with@babel/eslint-parseryou’rebabel.config.jsorbabelrc.jsfile should be automatically detected with that PR.If you’re using
standardwith@babel/eslint-parserbut don’t have a custom babel config, you’ll still need to add a dummybabel.config.jsfile since that’s now required by@babel/eslint-parser.@Divlo can you review and release this as soon as you get the chance?
I am sorry, I do not understand what you want to say. It is (kind of) obvious that standard uses eslint under the hood. So, do you want to say that using
.eslintrc.jswithstandardis something you would recommend? How does it match the No Configuration principle from https://standardjs.com/#why-should-i-use-javascript-standard-style? Or, did I get everything wrong.Anyway, as indicated, everything works just fine (and I believe as intended) without
.eslintrc.jswhen used outside of the vscode. It also works good (even with vscode) when usingbabel-eslintas the parser. Thus, it looks like there is something happening on the interface between@babel/eslint-parserandvscode-standard.It would be nice to know what makes it hard to fix the problem. Is it difficult to replicate? Is it a low priority issue? The solution is blocked by
@babel/eslint-parser?adding the below snippet in the workspace settings worked for me
“eslint.workingDirectories”: [ “put your .eslintrc relative path here” ]
Whoops, my bad. I got the same error but apparently I’m in the wrong github project here because I’m not using vscode-standard
That does not seem to work for me. I checked it in a monorepo and in a “simple” flat project with one
package.jsonand onebabel.config.jsin the root. Works from command line, but fails in VSCode.I don’t know if it is related but you should not use
babel-eslint, instead you should use@babel/eslint-parser. See: https://github.com/standard/standard/issues/1601One way i got it working is by using a lower version of babel-eslint package. I was on the below version which was causing this issue :-
"babel-eslint": "^11.0.0-beta.2"But once i installed ver 10.0.3, this issue got resolved.