Comments (6)
No problem :) For usage questions around ESLint there is also a Discord chat, they are usually quick to respond. Good luck!
from eslint.
Thanks for the issue @JeremyLoy. I don't think that ESLint can support this feature in a core rule because it's about a Node.js-specific API. Also note that the no-restricted-imports
rule is designed to work without knowledge of the file system. It even works in a browser because it expects a list of import specifiers to be provided by the user, without checking if those imports correspond to existing or accessible modules.
That said, eslint-plugin-n has a rule called n/no-missing-import
that should report a problem in this case (I tried it with your repro and it does, although there's another plugin in your config that doesn't recognize the subpath export and reports a problem).
from eslint.
Thanks for the response @fasttime, I appreciate it. I'll close this since it makes sense to not have Node only concepts in ESLint proper.
Also, thank you for pointing me towards eslint-plugin-n, I hadn't seen it before.
Is that the de-facto plugin for all things NodeJS specific nowadays? I see it referenced a few times in this repo next to deprecated rules
from eslint.
hey @fasttime - I updated my repo with eslint-plugin-n
, but I'm still not seeing the lint error like you said.
Do you mind taking a look and seeing what I have misconfigured?
from eslint.
Hm, your npm "lint"
script in the package.json file looks incomplete if you are running npm run lint
. It should be along the lines of "eslint --ext .mjs ."
.
In the eslintrc config system, no files are linted by default, and only .js files are linted if a directory is specified. To lint a directory of .mjs files, one would pass both a directory name (.
for the current directory) and the file extension with --ext .mjs
on the command line. When using the flat config system, which will become the default in ESLint 9, neither is required.
from eslint.
@fasttime thanks 🤦 Can't believe I forgot to do that. Its been a while since I set up a project from scratch.
My PoC is working now, correctly failing the impossible import. But now its also failing to find the local workspace module. Unless you think thats an issue with eslint
specifically, I'll start a conversation over at eslint-plugin-n.
Thanks again for your help!
from eslint.
Related Issues (20)
- Support `name` field in flat config and recommend as an convention HOT 5
- Bug: (`ignores` not respected when using flat config). Expands and scans ignored files! HOT 2
- Bug: (apparently) not ignoring dotted directories by default HOT 2
- Bug: ignorePatterns is ignored
- Change Request: Creating variants of a rule to apply to separate files HOT 2
- Change Request: (Consider moving .eslintcache to node_modules/.cache) HOT 7
- Bug: plugins field in eslintrc not working as expected HOT 1
- Bug: unhandled error in `lintFiles` with glob patterns when config is invalid HOT 6
- Docs: no-restricted-imports doesn't explain paths vs. patterns HOT 2
- Change Request: `--inspect-config` CLI option HOT 2
- Change Request: explicitly handle `undefined` being passed as a config value HOT 4
- Bug: `--no-ignore` applies to non-global ignores HOT 7
- Bug: Misleading message for non-configured files HOT 1
- Change Request: Support applying suggestions HOT 1
- Change Request: Processor may provide parser options HOT 1
- Inline comments to push/pop state instead of replacing it HOT 1
- Bug: "TypeError: context.getScope is not a function" in no-floating-promise HOT 3
- Bug: `--ext` CLI arg stopped working after 9.0.0 update HOT 1
- Bug: "Error: Could not find config file." HOT 1
- error [email protected]: "node" 20.8.0 is incompatible with this module HOT 1
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.