GithubHelp home page GithubHelp logo

Comments (3)

scagood avatar scagood commented on July 21, 2024 1

I am hesitant to add something like this as, I think:

  1. this would get very complex rather quickly
  2. it's better to let people pass whatever they want to console (do we also error on variables going in too, just because they could be a constructed string)?

The first example could be converted like this, but count looks like it should be %i or %d, not %s:

console.log('count: %s', count);
// or
console.log('count:', count);

The second example could be converted like this:

console.error('error #%s', code);

Another example could be:

console.error(`Good morning ${name}\n Welcome back`);
console.error('Good morning %s\n Welcome back', name);

from eslint-plugin-n.

ericbn avatar ericbn commented on July 21, 2024 1

Thank you for the comments.

I see there's no added benefit between

console.log('count: ' + count);
console.log(`count: ${count}`);
console.log('count: %d', count);
console.log('count:', count);

as in all cases the parameters will be evaluated and the message will be logged.

Closing this.

from eslint-plugin-n.

aladdin-add avatar aladdin-add commented on July 21, 2024

This rule seems quite specific and might reflect personal preferences more than general best practices. It is suggested that you implement this rule yourself if it aligns closely with your project's style guide or team preferences.

@eslint-community/eslint-plugin-node thoughts?

from eslint-plugin-n.

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.