Comments (3)
I am hesitant to add something like this as, I think:
- this would get very complex rather quickly
- 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.
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.
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)
- Bug: unexpected token ??= HOT 2
- Bug: no-unsupported-features/es-builtins: fetch reported unsupported despite Node.js >=18.16.0 HOT 7
- ✨ Update to node v22.0.0 HOT 1
- Bug: no-unsupported-features/es-builtins false positives HOT 1
- Bug: The 'Buffer' is still an experimental feature The configured version range is '>=18.6'. HOT 1
- New option: Support `"fetch"` in `"ignore"` option of `n/no-unsupported-features/node-builtins` HOT 3
- Bug: [`n/no-unsupported-features/node-builtins`] false-positive when writing to the variable HOT 1
- Change Request: Add option to allow `NODE_ENV` in `n/no-process-env` HOT 4
- Support for "import attributes" and "import assertions" HOT 2
- Bug: package.json import results in no-missing-import HOT 5
- Bug: import type fails with no-missing-import if node fails to resolve the import HOT 4
- Rule ideas
- Change Request: Missing issue template for "rule change"?
- New Rule: `n/no-path-concat` for `import.meta.*`
- Bug: Make disabling the no-unpublished-x rules in private packages opt-in HOT 7
- Bug: Error "Can't resolve './DIR' in 'PATH'. Rule: `eslint: n/no-missing-import`" HOT 5
- Bug: n/hashbang doesn't consider source file of a bin path as a binary HOT 3
- ✨ Update to node v22.4.0
- ✨ Update to node v22.5.0
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 eslint-plugin-n.