Comments (4)
I think the root of the problem is this check where npmignore.match
is being called with an argument that is possibly an empty string, resulting in the empty string being passed to ignore
that produces the TypeError
.
That's because toRelative
returns an empty string when called with an argument that is the same as the package directory. And require('.')
resolves to the package directory when called by a file in that location.
This could be probably fixed by making sure that npmignore.match
is never called with an empty string. I will try to come up with a test case, and I'll create a PR if my fix works.
from eslint-plugin-n.
sounds it should report an eslint errror in this case - it will throw an 'module not found' error if you run your code.
from eslint-plugin-n.
Yes, my code doesn't work of course. But the rule should report the linting problem instead of throwing an error.
from eslint-plugin-n.
agreed. just ignoring the case in this rule. we could consider adding a new rule to report requires/imports non-exsistent files.
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.