Giter VIP home page Giter VIP logo

Comments (5)

jasonkarns avatar jasonkarns commented on May 5, 2024 3

Personal opinion, but I feel it harms readability because at first glance, it appears that the required file in question is one additional level away.

Using the distance test: from a distance ./ and ../ are indistinguishable, which approximates "at a glance" visual parsing. One should be able to count the /s to know how many directory levels away a file is.

from nodebestpractices.

goldbergyoni avatar goldbergyoni commented on May 5, 2024 2

@kbariotis I personally adore those aesthetic improvements. I'm not sure whether we should focus on 'widely agreed best practices' vs 'suggestions for better programming'. I tend to believe that the first fits our DNA better.

Anyway, would love to discuss other ideas :)

from nodebestpractices.

goldbergyoni avatar goldbergyoni commented on May 5, 2024

@kbariotis thanks for joining the battle :)

can you kindly clarify why is this an issue? you also wrote 'always put ./' but in the //DO section the example doesn't contain ./:
module.exports.ModuleInAnotherFolder = require('../ModuleInAnotherFolder');

from nodebestpractices.

kbariotis avatar kbariotis commented on May 5, 2024

I am sorry @i0natan. They were upside down :/. So the issue is just a visual preference. IMO it enhances readability when you know that every require will start with ./.

from nodebestpractices.

kbariotis avatar kbariotis commented on May 5, 2024

@jasonkarns I really don't want to argue about that cause it's really a matter of preference and opinion and it's only a suggestion. I like the paths to be similar, much like others aligning their = signs. :)

But, I would argue that ./ and ../ should be distinguishable especially to people coming from a *nix background. You don't count the /'s but rather the ..'s to find how many folders you have to go up.

Either way, nice talking to you :). Great repo!

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.