Comments (14)
@gnuletik I have opened a PR to find-babel-config. This should fix the issue.
Until it gets reviewed/merged I am going to do work on config-support branch for this package and reference my fork.
When you have time please let me know if that branch works with your project using the babel.config.js
from eslint-plugin-module-resolver.
@gnuletik Thanks for the feedback. I am going to look at making a PR to that repo. Do you have an example project using babel.config.js
from eslint-plugin-module-resolver.
Thanks for your time :)
Here is an example babel.config.js
file
module.exports = function () {
return {
presets: ['babel-preset-expo'],
plugins: [
['module-resolver', {
alias: {
'~components': './src/components',
'~utils': './src/utils',
},
cwd: 'packagejson',
}],
],
};
};
from eslint-plugin-module-resolver.
Thanks !
How can I test locally ?
If I install the package from your branch
yarn add --dev 'HeroProtagonist/eslint-plugin-module-resolver#config-support
eslint does not find the plugin
ESLint: 5.9.0.
ESLint couldn't find the plugin "eslint-plugin-module-resolver". This can happen for a couple different reasons:
...
This also occurs when using the master branch
from eslint-plugin-module-resolver.
Okay, I succeed to install the plugin from the github branch with
cd node_modules/eslint-plugin-module-resolver/
yarn install
yarn run babel lib --out-dir dist
I tested the plugin, however, find-babel-config
throws an error because the api
parameter is missing when calling the babel.config.js function.
Sorry, I didn't include the api
parameter from babel.config.js
in my previous comment.
If I disable the cache, babel throws an error and eslint-plugin-import
does not work anymore.
babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
['module-resolver', {
alias: {
'~components': './src/components',
'~utils': './src/utils',
},
cwd: 'packagejson',
}],
],
};
};
.eslintrc.json
{
"env": {
"node": true,
"browser": true,
"es6": true
},
"parser": "babel-eslint",
"extends": "airbnb",
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js"] }],
"module-resolver/use-alias": 2
},
"settings": {
"import/resolver": {
"babel-module": {}
}
},
"plugins": [
"module-resolver"
]
}
from eslint-plugin-module-resolver.
I'm still getting this error with these versions:
eslint-plugin-module-resolver@^0.10.0:
version "0.10.0"
find-babel-config@^1.1.0, find-babel-config@^1.2.0:
version "1.2.0"
from eslint-plugin-module-resolver.
@DEfusion Hi! Could you share the repository (if public) or config files that represent the problem. Will make it easier to debug. Thanks
from eslint-plugin-module-resolver.
for still looking the solution. setting the preset only in production env fix my issue
{
...
env: {
production: {
presets: ['react-app'],
},
},
}
from eslint-plugin-module-resolver.
@gnuletik - I am wondering if the latest version has fixed this and this issue can be closed
from eslint-plugin-module-resolver.
@HeroProtagonist Thanks for the feedback ! I'm not using this lib anymore so I cannot test it right now.
from eslint-plugin-module-resolver.
I am trying version 1.2.0
, but I can't seem to get the linter to warn when using any relative paths. My project is using a babel.config.js
file, but it also wouldn't work with a .babelrc.json
for what it's worth.
from eslint-plugin-module-resolver.
@HeroProtagonist I am trying version 1.3.0 not worked with babel.config.js
from eslint-plugin-module-resolver.
Was it working in 1.2.0 for you?
from eslint-plugin-module-resolver.
@HeroProtagonist No, v1.2.0 not worked
from eslint-plugin-module-resolver.
Related Issues (19)
- Support different roots
- Add possibility to not throw error for one level depth HOT 6
- Move to circle ci
- Cannot read property 'loc' of undefined (v1.1.0) HOT 9
- Error while loading rule 'module-resolver/use-alias': Cannot read property 'plugins' of null HOT 9
- Does not work with Typescript files (.ts, .tsx) HOT 6
- Make the rule fixable HOT 4
- Rule doesn't flag subdirectories of aliases after v1.2.0 HOT 3
- Add windows and macos to CI tests
- Add a better file path resolution HOT 3
- Add example directory
- Upgrade to eslint 6 HOT 1
- Use babel's loadPartialConfig function HOT 3
- Support default aliases & crash when no aliases provided HOT 3
- Replace extensions option with `ext` field from babel plugin config
- Node 10? HOT 2
- TypeError: Error while loading rule 'module-resolver/use-alias': Cannot convert undefined or null to object
- TypeError: Error while loading rule 'module-resolver/use-alias': Cannot convert undefined or null to object
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-module-resolver.