-
Notifications
You must be signed in to change notification settings - Fork 22.4k
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
Use const in place of var #11135
Use const in place of var #11135
Conversation
Preview URLsFlawsNone! 🎉 External URLsURL: No new external URLs |
Why are you suggesting to replace |
Am I incorrect in thinking the use of |
@Rob--W To me that outweighs some convenience in using the console for examples etc. I am slightly ambivalent in this particular case because the @wbamberg Perhaps you'd like to comment. |
The benefit of As briefly mentioned before, I think that for ease of trying out, If there's a desire to communicate an immutable value, Although I mildly prefer |
Our general guidelines say to avoid While it's true of course that it's easier to paste That said, I'm not a maintainer for the add-ons docs, and if the maintainers want to adopt different policies that's up to them. |
@Rob--W So up to you I guess, though this will keep on coming up since to casual contributors the MDN is a monolith. |
I'm supportive of replacing As mentioned before, I'd like consistency across this section of the documentation, which implies that all articles at https://github.com/mdn/content/tree/main/files/en-us/mozilla/add-ons/webextensions and all examples at https://github.com/mdn/webextensions-examples should be rewritten at once. This can be done automatically (e.g. with |
One thing to consider is that a straight up search and replace might change instances where the |
Happy to take a look. Given the discussion, I'm assuming it's not the greatest priority we have? |
Not the highest priority. I suggest to only do it when you have time to focus on this, so we can quickly go through the review process to minimize the amount of time wasted on resolving merge conflicts. As mentioned before, an automatic search-and-replace in the |
I have created Replace var with let in code snippets and examples #11343 and will look at actioning as other priorities permit. |
Summary
Replace the
var
keyword for theconst
keyword. The values are not mutated soconst
is the appropriate initialiser to use.Motivation
The
var
keyword is deprecated.This PR…
-->