Giter Site home page Giter Site logo

Comments (6)

goldbergyoni avatar goldbergyoni commented on May 5, 2024 2

I so much agree with the necessity for practice on this matter. At the same time, we must keep our reliability and suggest items that score high on at least two dimensions: (a) undoubtedly correct, (b) critical and (c) conventional.

I believe we should sadly drop this in the name of content curation and not technical correction.

Unless we can prove that most people think the same, maybe reddit/FB discussion? keep this issue open and tag 'help needed'? I'd be glad if you lead it, we need more evidence :)

from nodebestpractices.

0x80 avatar 0x80 commented on May 5, 2024 1

@i0natan Fair enough. I agree with you. I'll think about starting a topic on reddit (or hackernews maybe?) about this.

from nodebestpractices.

goldbergyoni avatar goldbergyoni commented on May 5, 2024

Important topic, thanks.

What do you mean by "standard in NPM module"? what about including the file role in its name, angular-style - e.g. user-service, user-api, user-dal, user-cold-testing, etc?

We try to avoid topics that are highly subjective/aesthetic, I'm not sure we can reach a definitive BP here but lets try!

from nodebestpractices.

0x80 avatar 0x80 commented on May 5, 2024

With "standard in NPM module" I meant the name of modules. So your imports of NPM modules and "local" modules would look similar.

If you have your files grouped wouldn't user-service and user-api then already live under /user ? I always leave the context out of the file name if it is apparent from the location. Same for class or function names. You then might have multiple files with the same filename living in different folders, but I am never too bothered by that. I find the redundancy in names more annoying than the possible confusion.

from nodebestpractices.

goldbergyoni avatar goldbergyoni commented on May 5, 2024

I always leave the context out of the file name

Agree. Pulling back my suggestion.

My concern about this topic is that there is simply no best practice. We strive to keep this guide 'opinionated just enough' and avoid being decisive where things are not that clear or critical. Do you suggest that kebab-case-naming pass through this filter? maybe separate/tag best practices that are more controversial?

from nodebestpractices.

0x80 avatar 0x80 commented on May 5, 2024

Yes it might be difficult to define a best practice for this, since a lot of people will label it as opinionated.

I started this topic because I am curious what others use, if they gave it much thought at all, and if there are convincing arguments against using an all kebab file naming scheme.

I alone have spent quite a bit of time thinking about this, and I can't find any good resources on the topic. I find it odd that there is so little info on the topic, and even a niche community like Node.js wouldn't have a recommended way of naming files.

I don't want to rethink or debate this every time I start a new project with other developers. It feels to me like there should be best-practice guidelines, just like we all agree on function and class names. We don't specify how to choose a good name. Just that the format must be camel- and pascal-cased.

Similarly you can't have a definite rule on file structure and naming. So user-registration-service.js, user/registration/service.js, user/registration-service.js and user/registration/registration-service.js could all be valid depending on what structure makes sense for your project.

But if you state that all file and folder names are best kept kebab-cased (for the reasons mentioned earlier), than that is an easy and clear rule to go by.

from nodebestpractices.

Related Issues (20)

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.