Comments (9)
If you have other files required by your index.js, or whichever other entry file, that's fine to go into lib/ or other top-level files, if it doesn't belong in another module.
In that case (several js files), index.js should be in the lib/ folder too to have all the code in only one place.
The same could be specified for other folders/files (test, bin, src, doc...): when having only one file of a kind have in the root of the project, when having several put all of them inside their folder.
from kwalitee.
I believe everything should live under lib and there should be no *.js files in the root folder of the package.
from kwalitee.
I believe everything should live under lib and there should be no *.js files in the root folder of the package.
I think too, but I find acceptable to have an index.js
file in the root folder of the package (that's already the package.json main
entry default value) if it's the only one Javascript file in the project, except maybe a cli.js
too for the command line executable since it's of a different kind (bin, not lib).
from kwalitee.
I still think it's better to have them in a folder... this also helps with things like doing lint testing, etc. The hope is to encourage good/best practices, but to do that, somewhere someone has to pick what's the best option for the community, going forward.
from kwalitee.
I believe everything should live under lib and there should be no *.js files in the root folder of the package.
Why?
this also helps with things like doing lint testing, etc.
How so?
from kwalitee.
Well, the first is a choice. The second is because it makes it easier to apply a lint to a directory rather than a directory and a random group of files. And you probably want to treat tests with a different lint profile.
from kwalitee.
I wouldn't read files but instead follow the require()s tree.
from kwalitee.
Well, based on some input, it seems like requiring that everything is in either "lib" or the code directory is configured in package.json is the best option.
from kwalitee.
👍
from kwalitee.
Related Issues (19)
- Some metrics of package quality HOT 9
- Add publish checker
- Add linter checker
- Add addon checker HOT 2
- Add library checker
- npm config
- Ensure that README is up to date
- Name folder containing tests 'tests' or 'test', not just 't' HOT 4
- Make 'npm test' actually do something (that returns 0 error code) HOT 4
- Improve .gitignore HOT 3
- Checker: Test files should not just end in .js
- index.js file in all importable folder
- Twitter msg: semver compliance HOT 3
- Requiring tests to be in a folder named 'test' is a terrible quality metric HOT 37
- Dependencies in both dev and main dependencies HOT 2
- User server.js for single executables
- Package.json don't have empty or default values
- require()s at top of file 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 kwalitee.