Comments (7)
shouldn't it just check if it starts with a .
first and formost? so that it only operates on local files and not on some nodejs or npm module
from eslint-plugin-n.
The regex for package is not working, see https://regex101.com/r/Dch2Gv/1
Specifically, there is a basic regex test for a valid package to get out early packageNamePattern.test(name)
where the name
is either @apollo/client/core
or yargs/helpers
.
This may have to get smarter by examining the exports
in the package.json
or some other way, this could be very painful if there is not another utility that provides resolution.
I'll look at the import
plugin and see what they are doing.
from eslint-plugin-n.
So this is a confirmed bug, and I have looked at eslint-plugin-import
for ideas. I attempted to bring some code over, but it started spidering into a ton of code. It doesn't help that this repo is still authored in CJS and that one is more modern ECMA. They are building up more contextual information about the package, which is ultimately going to be necessary for proper resolution of modules.
eslint-plugin-import
's import/extensions
rule has 1. no fixer, 2. no typescript support.
Ultimately, I think one of the following needs to happen:
- the differential functionality needs to get PR'd there (fixer plus typescript support)
- big effort to duplicate code (or get
eslint-plugin-import
to extract more to a reusable module - they already have some ineslint-module-utils
) then fix here. - Play dumb and incorporate something like an
ignorePaths
for a simple opt-out on extension replacement.
The problem with PR'ing to the eslint-plugin-import
repo, is that it looks to be falling behind due to the scope (78 PRs, 432 issues). I'm not confident that PR'ing will get accepted in any timeframe. On the flip side, the eslint-plugin-import
does seem well written.
Any of the above are possible, but I'm afraid I've got almost a full day into this so I have to pull the ripcord and move on.
Thoughts?
from eslint-plugin-n.
if it's a local module (./xxx
) or import maps, the ext is always required. In other cases, does it help to just use lib/converted-esm/import-meta-resolve.js
( added in d24be36) to resolve the module?
from eslint-plugin-n.
That may be of some help, but on cursory look I cannot tell if it's going to be enough. I'm sorry to abandon this issue at this point, but I have to move on to other priorities. I hope my research has documented the issue and someone else will chip in some effort.
from eslint-plugin-n.
I've similar issue with firebase packages. Asking me to put extensions:
from eslint-plugin-n.
fixed by #132
from eslint-plugin-n.
Related Issues (20)
- [file-extension-in-import] Does not work properly in TypeScript projects with allowImportingTsExtensions HOT 3
- [file-extension-in-import] Dir imports resolve to `package/dir.js` instead of `package/dir/index.js` HOT 4
- [file-extension-in-import] Does not work with node version 16.0.0 - 16.16.0 HOT 2
- :broom: Remove deprecated rules HOT 6
- ๐งน ESLint v9 deprecations HOT 1
- ๐ Basic TypeScript types HOT 4
- Bug: Update context methods to source code methods HOT 2
- Bug: no-extraneous-import doesn't support import maps HOT 4
- Dependency Dashboard
- Bug: `n/no-restricted-require` does not work for relative imports (as opposed to `no-restricted-modules` from ESLint)
- Bug: The readme says this supports ESLint >=7.0.0, but ruleContext.physicalFilename doesn't exist in version 7.15.0 on my machine HOT 2
- v17 planned changes HOT 9
- Change Request: remove Nullish Coalescing Assignment Operator HOT 1
- Bug: `no-callback-literal` HOT 2
- New Rule: restricted use globals var `__dirname` `__filename` in esm mode HOT 4
- add docs migrating from eslint-plugin-node HOT 1
- Bug: `import-target` mutes resolution errors
- Bug: n/no-missing-imports doesn't work correctly for workspace modules HOT 2
- Change Request: Migrate to release please manifest releaser
- Old releases support HOT 3
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-n.