question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Opinion] Component's package.json?

See original GitHub issue

Why 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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
langpavelcommented, Mar 30, 2017

@dolbyzerr You can easily hack scaffold too 😉

1reaction
buildbreakdocommented, Nov 18, 2016

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found