Comments (6)
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.
@i0natan Fair enough. I agree with you. I'll think about starting a topic on reddit (or hackernews maybe?) about this.
from nodebestpractices.
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.
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.
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.
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)
- Easy to translate advice HOT 1
- Translations status HOT 1
- Bonnes pratiques nodejs
- Arabic Translation
- Node practice 1
- Should include Corepack in our recommendation? HOT 5
- Bootstraping nodejs container may be misleading
- Node
- Node js fullstack HOT 4
- Wrong example HOT 2
- Broken link to env-var
- Nextjs as main framework? HOT 2
- Another comment regarding "1.1 Structure your solutions by business components" HOT 1
- Italian Translation
- The backend-testing-checklist.png file is missing. HOT 3
- Hinglish Translation HOT 1
- Кнас
- Dead link for safe-regex
- Mi006
- Is using cache for npm install in docker safe?
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 nodebestpractices.