Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading coding style practice #3746

Open
Mandeep56Singh opened this issue Aug 8, 2024 · 2 comments
Open

Misleading coding style practice #3746

Mandeep56Singh opened this issue Aug 8, 2024 · 2 comments

Comments

@Mandeep56Singh
Copy link

Thanks for making javascript.info, I am learning a lot from it.
I have encounter some issue regarding coding style guide and as I daily visitor of beloved javascript.info
I held responsibility for contributing toward this learning source, so that new developers will not misguided by some mistakes.

on this article
It says Linting tools are for styling while it's completely false
Linting tools like eslint are for setting rules for your code

For example, if you enabled the ESLint logical-assignment-operators rule on the snippet from Formatting, you’d receive a message and suggested fix like:

- friend = friend || "me";
+ friend ||= "me";
Assignment (=) can be replaced with operator assignment (||=).

while formatting tools like prettier are the one used for styling code.
Using Linting tools for styling is bad idea they are very slow because that's not Linting tools job to do.

Please visit these links to know the insights
Configuring ESLint, Prettier, and TypeScript Together
video link

I recommend Including the learning of above resources in javascript.info coding style section it would be a great help.
you can even make a separate section for it, these things help developers so much.

@joaquinelio
Copy link
Member

About using lint for styling, I don't see it as a bad idea,
lint is almost mandatory for quality, so no harm in using it to do styling too.

Maybe you're right
it's important to clarify the primary focus of linters is quality

As a minimum I would change
"... automatically check the style and QUALITY of your code..."
then adjust a little the paragraph that follows it.

@Mandeep56Singh
Copy link
Author

Mandeep56Singh commented Aug 8, 2024

@joaquinelio thanks for replying
have you visited the resources that I have listed ?
please watch this video link at 13:11 timestamps
This video is from one of best contributor of typsecript and eslint i.e. JoshuaKGoldberg
Linters and formatters aren't the same.
Linters and formatter works differently .
Most of developers uses prettier for formatting and Eslint rule checking.
Both uses different algorithm, we can use linters for styling but they are slow . The right tool is formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants