@babel/eslint-parser @babel/eslint-plugin does not play nice with eslint-plugin-import
See original GitHub issueBug Report
- I would like to work on a fix!
Current behavior @babel/eslint-parser throws error on parsing 3rd party libraries
Input Code
import moment from "moment";
export default moment();
throws error
ESLint: Parse errors in imported module 'moment': No Babel config file detected for ~/node_modules/moment/src/moment.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files. (undefined:undefined)(import/namespace)
Expected behavior A clear and concise description of what you expected to happen (or code).
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
{
"extends": ["standard", "eslint:recommended", "plugin:import/errors", "plugin:import/warnings"],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module"
},
"plugins": ["standard", "@babel/eslint-plugin", "import"],
"rules": {
"new-cap": "off",
"@babel/new-cap": "error",
"no-invalid-this": "off",
"@babel/no-invalid-this": "error",
"no-unused-expressions": "off",
"@babel/no-unused-expressions": "error",
"object-curly-spacing": "off",
"@babel/object-curly-spacing": "error",
"semi": "off",
"@babel/semi": ["error", "always"]
}
}
{
"presets": [
[
"@babel/env"
]
]
}
Environment
System:
OS: macOS 10.15.5
Binaries:
Node: 14.8.0 - /opt/local/bin/node
npm: 6.14.7 - /opt/local/bin/npm
"@babel/cli": "7.10.5",
"@babel/core": "7.11.1",
"@babel/eslint-parser": "7.11.3",
"@babel/eslint-plugin": "7.11.3",
"@babel/preset-env": "7.11.0",
"eslint": "7.7.0",
"eslint-config-prettier": "6.11.0",
"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-jest": "23.20.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "3.1.4",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.1",
Possible Solution
Additional context Add any other context about the problem here. Or a screenshot if applicable
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
ESLint with Babel: plugin-proposal-class-properties not found ...
I installed @babel/plugin-proposal-class-properties but ESLint server tries to load it from path: '@babel/eslint-plugin-plugin-proposal-class- ...
Read more >eslint-config-neono - npm Package Health Analysis - Snyk
The default config uses @babel/eslint-parser to support stage features that ESLint doesn't support and it opts to use the @babel/eslint-plugin ...
Read more >parsing error: cannot find module 'babel-eslint' - You.com
I have attempted to install @babel/eslint-parser globally however it did not resolve the issue. Edit: our . babelrc file inside the react project....
Read more >The State of babel-eslint - Babel.js
babel-eslint` is moved to `@babel/eslint-parser`! ... core rules (which are released every two weeks) work with experimental syntax is a ...
Read more >babel-eslint | Yarn - Package Manager
babel-eslint is now @babel/eslint-parser. ... Otherwise try the default parser (you don't have to use it just because you are using Babel).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am having this same issue with errors being thrown in relation to the
moment
package. Addingdoes not seem to do anything as well as adding the
espree
settings as stated above. Any ideas on what I can try?For anyone else who lands here and gets an unexpected top-level property error, babelOptions goes in parserOptions, not at the root