-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
16.6.2: can n/no-missing-require
allow resolvePaths ['./'] for relative imports?
#210
Comments
Where would it resolve the By the time the plugin gets the setting we dont really know where the config file was 🤔 |
Yes, I had the same question. In my naive mind, relative But maybe this is a bug, after all, and subject to codebase update? Maybe |
Can you provide a small example of where this applies? I have setup a small starting point for you here: https://eslint-online-playground.netlify.app/#eNpNkL1 Once you have the error there, can you paste the url here? |
|
I am not sure if that is a valid resolution? Are you using a special library that resolves these? I would expect that resolution to be written like: |
We have {
"compilerOptions": {
"baseUrl": "./src/",
"module": "nodenext",
"paths": {
"*": ["./*"],
"lib/*": ["../../../packages/lib/server/*"]
}
}
} That first wildcard may be the one doing the trick? 🤔 |
mmm, so this is a request to support |
Booyah, you are probably right. Is this a fairly light lift to try a test PR, considering tsconfig support already exists, and afaik they're fairly similar? |
just a reminder: you can use |
Interesting idea. Is this a 100% drop-in change, even with no other TS tooling installed yet? TS is on the roadmap in the coming month, so I wouldn't be opposed to making this rename move early, if it's without side-effects 🤔 |
It looks to be, but I am not completely sure 👀 |
Thanks for reminding me of the docs link, above paragraph definitely looks tasty enough to try right away. |
I don't see going to {
"compilerOptions": {
"allowJs": true,
"baseUrl": "./src/",
"module": "nodenext",
"paths": {
"*": ["./*"],
"lib/*": ["../../../packages/lib/server/*"]
}
}
} still gives me
|
And another roadblock: #139 for TS only appeared in v17, but we're still on Node 16, so stuck on v16 right now. PR seemed fairly large, is there even a chance of it applying for a backport? |
It's not possible as it's a breaking change. and we will release v17(latest) soon then the v16 is going to be EOL. |
@ikraav Is this still an issue? v17 has been released with the tsconfig support 😁 |
It remains an issue, because we can't easily upgrade our app from Node 16 -> 20, too many things break, so it becomes a project. Do I understand correctly there's no low-lift way to backport tsconfig compatibility? If not, it's a bit of a limbo situation. |
I am going to be closing this, if you have issues after you update please create another issue 👀 |
Environment
Node version: 16.20.2
npm version: 8
ESLint version: 8.57
eslint-plugin-n version: 16.6.2
Operating System: Linux
What rule do you want to report?
n/no-missing-require
Link to Minimal Reproducible Example
What did you expect to happen?
const config = require('config');
is getting flagged forn/no-missing-require
, even thoughconfig/
module directory is living next to the source file.(I'll try following up with a stackblitz example if this is unclear.)
Participation
Additional comments
Am I missing something obvious for why below doesn't help
I'm not against refactoring everything to explicit
require('./config')
, but would like to allow sibling requires until we get it done. Is this possible?PS not a "bug" I think, but Discussions isn't enabled on this repo.
The text was updated successfully, but these errors were encountered: