[Opinion] Component's package.json?
See original GitHub issueWhy a package.json
under components?
I’m coming new to this after seeing a ton of React projects, this is the first time I encounter this approach, and IMHO it’s counterintuitive. I took a look at the file thinking this was some weird black magic to make components exportable (maybe Lerna/monorepo related or something) until I read what was about.
I’d prefer a rename of the actual component to index.js to achieve the same effect. Granted, this breaks the naming convention for that particular file, but it’s less counter-intuitive and more common.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
The Basics of Package.json - NodeSource
This file is used as a manifest, storing information about applications, modules, packages, and more. Because understanding it is essential to ...
Read more >How do I add comments to package.json for npm install?
In my opinion, this is the best option, as it allows users to get info on the commands without needing to actually open...
Read more >package.json - npm Docs
This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just a...
Read more >react-components/package.json at main - GitHub
A set of components based on Vanilla Framework. Contribute to canonical/react-components development by creating an account on GitHub.
Read more >How To Use Node.js Modules with npm and package.json
json file keeps track of all changes in package.json or node_modules and tells us the exact version of the package installed. You usually...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dolbyzerr You can easily hack scaffold too 😉
@blackxored Sounds good in theory but in practice would be horrible. Think about all of your component files open in your IDE, all the files at the top of your screen would say index.js… which one do you click on? Which one is the one you want?
Other reasons aside, would be a terrible developer experience.