Closed rhyek closed 6 years ago
Any progress?
Not really, I was quite busy in this beginning of the year. I'm gonna try to find some time over the weekend to address some of the issues we have here and in the babel plugin since it seems there's also an issue with babel 7 (https://github.com/tleunen/babel-plugin-module-resolver/issues/274)
The solution that I've found to be able to use Babel 7 while having the benefits of the linter is to duplicate the babel options in the eslint options as :
"settings": {
"import/resolver": {
"babel-module": {}
"babel-module": {
"alias": {
...
}
}
}
}
I'm using nextjs@6.0.0-canary.6 which uses "@babel/core": "7.0.0-beta.42",
and I get lot of:
[eslint-import-resolver-babel-module] TypeError: Cannot read property 'find' of undefined type of errors in console.
To fix eslint errors though I had to do as suggested by @Neophy7e :
.babelrc
{
"presets": [
"next/babel"
],
"plugins": [
["babel-plugin-styled-components", { "ssr": true, "displayName": true, "preprocess": false } ],
["module-resolver", {
"alias": {
"common": "./common",
"services": "./services",
"static": "./static"
}
}],
"transform-flow-strip-types"
]
}
.eslintrc
{
"extends": [
"eslint:recommended",
...
],
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"settings": {
"import/resolver": {
"babel-module": {
"alias":{
"common": "./common",
"services": "./services",
"static": "./static"
}
}
}
},
"plugins": [
...
]
}
This seems to work now, but still I get these errors in console.
throws error:
Cannot find module 'babel-core'
Error: Cannot find module 'babel-core'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
at Function.Module._load (internal/modules/cjs/loader.js:475:25)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object.<anonymous> (/usr/src/app/node_modules/eslint-import-resolver-babel-module/lib/index.js:8:19)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
npm ERR! Linux 4.14.34
npm ERR! argv "/usr/local/bin/node" "/usr/src/app/node_modules/.bin/npm" "run" "lint:fix"
npm ERR! node v9.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! my-create-react-app@0.0.1 lint:fix: `eslint --ignore-path .eslintignore --fix .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-create-react-app@0.0.1 lint:fix script 'eslint --ignore-path .eslintignore --fix .'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the my-create-react-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint --ignore-path .eslintignore --fix .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs my-create-react-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-create-react-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/app/npm-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-create-react-app@0.0.1 format-fix: `npm run format && npm run lint:fix`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-create-react-app@0.0.1 format-fix script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/node/.npm/_logs/2018-04-29T14_12_22_580Z-debug.log
fixed with "eslint-import-resolver-babel-module": "5.0.0-beta.0",
Please upgrade to v5 beta 0 as @srghma said and report any errors with it. But it's normal v4 doesn't work with babel7
Hi, love both this and babel-plugin-module-resolver. Great work. I want to move to Babel 7 and, currently, this package is the only blocker for me to be able to do that. Again, awesome work. Keep it up!