Git Product home page Git Product logo

Comments (9)

piranna avatar piranna commented on July 17, 2024

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.

konobi avatar konobi commented on July 17, 2024

I believe everything should live under lib and there should be no *.js files in the root folder of the package.

from kwalitee.

piranna avatar piranna commented on July 17, 2024

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.

konobi avatar konobi commented on July 17, 2024

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.

Fishrock123 avatar Fishrock123 commented on July 17, 2024

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.

konobi avatar konobi commented on July 17, 2024

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.

piranna avatar piranna commented on July 17, 2024

I wouldn't read files but instead follow the require()s tree.

from kwalitee.

konobi avatar konobi commented on July 17, 2024

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.

piranna avatar piranna commented on July 17, 2024

👍

from kwalitee.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.