-
Notifications
You must be signed in to change notification settings - Fork 0
Usage with baseUrl #14
Comments
Sorry to delay, I didn't notice about this issue.
Sorry I haven't used |
Hi @JounQin, thanks for the reply. It's not about CRA specifically - but with CRA, we can't use {
"compilerOptions": {
"baseUrl": "src",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["src"]
} Given the above config, I want that any folder imported absolutely from |
@mrmckeb Sorry I have no idea about how to mark a module as |
That's OK, let's see if @benmosher has any ideas. I'd love to help out - but my open source time is fully booked out for the next few weeks. If this issue is still unresolved then, I could have a look ;) |
This is (currently) how modules are marked but it won't help with unresolved imports. |
@benmosher Thanks for clarifying, but I'm a bit confused at https://github.com/benmosher/eslint-plugin-import/blob/master/src/core/importType.js#L41. Why a |
Besides, shall we normalize |
IIRC the meaning of I have a branch somewhere where I started working on moving the |
@benmosher I personally prefer something like https://palantir.github.io/tslint/rules/ordered-imports which seems much more customize, that's why I'm still using tslint with eslint at same time. |
@benmosher I guess I would interpret internals as modules that are actually aliases for internal paths. Like What if you allowed a whitelist for internals? That could help for now? Note, this util doesn't actually exist in my project. |
import-js/eslint-plugin-import#1526 @mrmckeb Check this as example, it should be able to define this option on your own. |
This resolver is great, it's already solving a number of issues for us.
We're using it with a monorepo and
create-react-app
, which doesn't support paths - but does supportbaseUrl
set tosrc
. In that case, we can access a folder in./src/*
as an absolute import - i.e.import { Button } from 'components/Button'
.Perhaps I'm missing something, but I'm still getting errors about unresolved imports in this case, and the
import/order
rule thinks that my import isexternal
, notinternal
.Are you able to offer any advice or suggestions here?
The text was updated successfully, but these errors were encountered: