css-examples icon indicating copy to clipboard operation
css-examples copied to clipboard

Modern JS: don't use `var` in css-examples

Open teoli2003 opened this issue 2 years ago • 16 comments

Quite a few examples in this repo extensively use var.

This is a bad practice; we have eliminated them from mdn/content (and other repos). We should do the same here: most will be simply replaced by const and let, although there may be a few more complex cases (where var is used inside a scope for a variable at a higher scope)

teoli2003 avatar Dec 07 '23 08:12 teoli2003

@teoli2003 Sir If it possible to allow me to fix this issue ?

pragyamishra56 avatar Jan 05 '24 07:01 pragyamishra56

Just go ahead; it is yours. Don't create too big PRs, they take longer to review.

teoli2003 avatar Jan 05 '24 07:01 teoli2003

@teoli2003 Sir Thanks for pointing this out! I completely agree with eliminating the use of 'var'. It's considered a best practice to use 'const' and 'let' for better scope management. I'll work on addressing this across the repository, replacing 'var' with the appropriate declarations. Your input is highly appreciated!

pragyamishra56 avatar Jan 06 '24 01:01 pragyamishra56

@teoli2003 Sir, Replace extensive var usage with const/let, aligning with the best So, should I replace 'var' with 'const/let'?

pragyamishra56 avatar Jan 08 '24 12:01 pragyamishra56

Yes.

teoli2003 avatar Jan 08 '24 12:01 teoli2003

@teoli2003 Sir, Could you confirm that In every JS file, I will replace the var with const/let?

pragyamishra56 avatar Jan 08 '24 14:01 pragyamishra56

With the relevant one, yes. If you are not sure, start with one file.

teoli2003 avatar Jan 08 '24 14:01 teoli2003

@teoli2003 Sir, Issue #163 is resolved now could you please have a look at it if any issue is raised then let me know

pragyamishra56 avatar Jan 10 '24 05:01 pragyamishra56

You need to open a pull request.

teoli2003 avatar Jan 10 '24 06:01 teoli2003

@teoli2003 Sir I opened a pull request could you review it if any further issue is raised then let me know

pragyamishra56 avatar Jan 10 '24 17:01 pragyamishra56

@teoli2003 Sir, could you respond to my PR? If any further issues are raised then let me know

pragyamishra56 avatar Jan 23 '24 15:01 pragyamishra56

@teoli2003 Responded here: https://github.com/mdn/css-examples/pull/171#issuecomment-1907681148 - essentially you can't just search and replace across the examples to fix this. Because each case needs a separate check and review, it would be better if this was split across a number of PRs

hamishwillee avatar Jan 25 '24 22:01 hamishwillee

@hamishwillee Sir I appreciate the clarification. I agree that a more thorough approach is needed. I'll work on breaking down the changes into separate PRs for a more comprehensive review. Thanks for guiding me through this process.

pragyamishra56 avatar Jan 26 '24 08:01 pragyamishra56