-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Description
💻
- Would you like to work on a fix? (not sure if I can help on it but I can try 😛)
How are you using Babel?
@babel/eslint-parser
Input code
Here is the repository: https://github.com/devfservant/babel-eslint-parser-error/
Configuration file name
babel.config.js
Configuration
const getBaseConfig = () => ({
presets: [
[
'@babel/preset-env',
{
debug: false,
targets: {
node: 'current',
browsers: ['ie 11', '>0.15%', 'not dead', 'not op_mini all'],
},
},
],
'@babel/preset-react',
],
plugins: [
['babel-plugin-styled-components', { fileName: false }],
['@babel/plugin-transform-runtime', { corejs: 3 }],
'@babel/plugin-syntax-dynamic-import',
],
})
module.exports = (api) => {
api.cache(true)
const baseConfig = getBaseConfig()
if (process.env.NODE_ENV !== 'test') {
baseConfig.ignore = [
'**/__snapshots__/**',
'**/*.test.js',
'**/*.test.jsx',
'**/*.test.ts',
'**/*.test.tsx',
]
// If not in tests, add the babel assets import plugin
baseConfig.plugins.push([
'transform-assets-import-to-string',
{ baseDir: '/assets' },
])
}
return baseConfig
}Current and expected behavior
Current behaviour
The command npx eslint "packages/**" --debug is crashing with the error:
eslint:linter Parsing error: Cannot read property 'push' of undefined
eslint:linter TypeError: Cannot read property 'push' of undefined
at maybeParse (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\@babel\eslint-parser\lib\worker\maybeParse.cjs:24:19)
at handleMessage (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\@babel\eslint-parser\lib\worker\index.cjs:31:16)
at exports.maybeParse (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\@babel\eslint-parser\lib\client.cjs:9:41)
at baseParse (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\@babel\eslint-parser\lib\index.cjs:47:7)
at Object.exports.parseForESLint (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\@babel\eslint-parser\lib\index.cjs:63:15)
at parse (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\eslint\lib\linter\linter.js:655:22)
at Linter._verifyWithoutProcessors (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\eslint\lib\linter\linter.js:1129:33)
at Linter._verifyWithoutProcessors (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\eslint-plugin-eslint-comments\lib\utils\patch.js:166:36)
at Linter._verifyWithConfigArray (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\eslint\lib\linter\linter.js:1273:21)
at Linter.verify (C:\Users\me\Workspace\babel-eslint-parser-error\node_modules\eslint\lib\linter\linter.js:1228:25) +5ms
(see babel-eslint-parser-error#debug-logs for more details)
Expected behaviour
No error
Environment
System:
OS: Windows 10 10.0.19042
Binaries:
Node: 12.20.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.10 - C:\Program Files\nodejs\npm.CMD
Monorepos:
Yarn Workspaces: 1.22.10
Lerna: 4.0.0
npmPackages:
@babel/cli: ^7.13.16 => 7.14.3
@babel/core: ^7.14.2 => 7.14.3
@babel/eslint-parser: ^7.14.2 => 7.14.3
@babel/eslint-plugin: ^7.13.16 => 7.13.16
@babel/plugin-syntax-dynamic-import: ^7.8.3 => 7.8.3
@babel/plugin-transform-runtime: ^7.14.2 => 7.14.3
@babel/preset-env: ^7.14.2 => 7.14.2
@babel/preset-react: ^7.13.13 => 7.13.13
@babel/runtime-corejs3: ^7.14.0 => 7.14.0
babel-plugin-styled-components: ^1.12.0 => 1.12.0
babel-plugin-transform-assets-import-to-string: ^1.2.0 => 1.2.0
eslint: ^7.26.0 => 7.26.0
jest: ^26.6.3 => 26.6.3
lerna: ^4.0.0 => 4.0.0
Possible solution
No response
Additional context
I faced this issue using a monorepo project (managed with lerna).
I got this error when switching from babel-eslint / babel-eslint-plugin
to @babel/eslint-parser / @babel/eslint-plugin (following https://babeljs.io/blog/2020/07/13/the-state-of-babel-eslint#the-future and https://stackoverflow.com/a/63489530/12292636)
Thanks a lot for your help,
if I can contribute just tell me and I'll try to do my best 🙏