-
-
Notifications
You must be signed in to change notification settings - Fork 24
Configure svelte as an optional peer dependency #279
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
Comments
I think it makes sense. |
Thanks for your reply. What I mean is, does it make sense to add Because, unless I'm mistaken, that is where the warning stems from. There seems to be nothing more I can do within my package to suppress this warning. Specifically, it appears that the warning propagates from Though both The other option is to simply remove But I don't know if removing the peer dependency on If there's no other recourse, I'll have no choice but to ignore the warning but it was worth a shot to try to resolve this issue at its root (if indeed this is the root of the issue). |
The parser depends on the svelte package. The parser will not work if svelte is not present. |
Of course. I did not suggest otherwise. I expect the parser not to work when To clarify my use case:
This approach is in contrast to the popular eslint-config-alloy which asks the user to...
... and then requires them to install and configure, for example: npm install --save-dev @babel/core @babel/eslint-parser @typescript-eslint/eslint-plugin @typescript-eslint/parser @vue/eslint-config-typescript eslint eslint-config-alloy eslint-plugin-vue vue-eslint-parser In addition to linting multiple frameworks, Don't get me wrong, I'm not here to advocate for my personal eslint configuration preference. I'm just trying to describe a scenario where one may want to install, but not necessarily use, a tool (
Strictly speaking, it does not. It has a peer dependency of the svelte package which is a deferral to the user to satisfy the dependency. But of course, it is assumed to be the case that if a user is installing Nevertheless, listing And that is why my request was to first add
Is this a necessary statement? I admire and appreciate your work. I realize you may consider this a trivial matter. If my argument to make this non-functional change has not convinced you and you disagree, that is fine, just say so. I'm not sure what GitHub issues are for if not to deliberate on collaborative source code and to collectively reap the benefit of doing so. |
I'm not sure what you mean by this issue. (It may be because I don't understand English very well 😓) |
Forgive me if I was not clear. There is a difference in the way that npm and pnpm emit warnings in regards to missing peer dependencies. A demonstrationnpmAs you can see, no warnings are emitted. pnpmAnd here we have warnings despite the fact that all packages installed are identical to those installed with npm. Why I consider this a problemThe contextAs I described in my previous comment, The benefit of doing this is that with a single shareable eslint config (only one package to maintain, only one package to install), I can lint any combination of JavaScript tooling. I discovered this architecture here: privatenumber/eslint-config and of all the ways I have seen to create a shareable eslint config, this, in my opinion, is the best. The problemI intend to use And I certainly don't want to install How I've attempted to address this issueInitially, I opened this issue with pnpm. Despite what the maintainer of pnpm proposed as a solution, I was not able to suppress warnings emitted by dependencies of "peerDependencies": {
"eslint": "*",
"svelte": "*"
},
"peerDependenciesMeta": {
"svelte": {
"optional": true
} My next logical assumption was that with pnpm, missing dependency warnings must be suppressed at their root: i.e. Considering that the maintainer of pnpm dismissed my issue, my next option was to see if you, the maintainer of this project, would be willing to include the above code in your package.json. I did not know at the time whether this would work; I was partially asking if you knew, and partially asking if you would consider testing it. Where we are nowAfter additional tests, I am now convinced that even if you did include Therefore the only option left to suppress such warnings is to include the following in the package.json of every project that depends on "pnpm": {
"peerDependencyRules": {
"ignoreMissing": ["svelte", "..."]
}
} This is not something I can include in This was the least desirable option to fix this issue in my opinion and I wanted to exhaust all other options before resorting to it. That is all. So, thank you again for your open source contributions. Thank you for your time and consideration. Hopefully our exchange was not entirely futile for you. And judging by the documentation you have written, your English is very good. 🙏 |
Thank you for explaining it all over again!
|
Description
Does it make sense to mark svelte as an optional peer dependency as it is for
eslint-plugin-svelte
?I have an eslint config that conditionally depends on svelte and its plugins, so in some cases it's not installed. However, I can't seem to suppress pnpm's missing peer deps warning with any configuration on my end.
I assume that pnpm's output indicates that the warning is propagating upwards from
svelte-eslint-parser
:In my package:
@theurgi/eslint-config
, I have svelte set as optional:But this does not silence the warning when using pnpm. Any package that depends on my shareable config inherits this warning.
Interestingly, I get no warning when installing with npm. I haven't tried yarn.
Thank you 🙏
The text was updated successfully, but these errors were encountered: