-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Require let or const instead of var (no-var) #633
Comments
Would probably break wayyy to much. Although, I agree with the rule fundamentally. |
Maybe.... Will standard never release a breaking version, where developers need to fix their code? 😏 I mean, there must be room to add rules that break some codebases to make standard stricter (and thus better)? |
#382 might be what you're after, but in the end, I write code for environments where |
Cool! |
Isn't |
@dcousens I believe that npm will still print a warning in that case. Anyway, I don't think that magical behavior like changing rules based on Once |
Agreed @feross, I'm just saying I don't think that time is now. Hopefully soon though :) |
Cool -- I'll close this issue for now since it's not actionable. |
currently at 83% |
Up to 91.4% now |
@feross is it time? 😎 |
Yep, I think it's time 👍 |
May I inquire about the status of this one? |
This is something that we want to get in, if you want to work on this I would start with compiling a list of all the repos that would break if we change this. If it's not too many, we can open a PR against eslint-config-standard and start sending PRs to upstream projects (e.g. as in this one) You can get the list by cloning this repo, adding the rule to |
Anyone want to help start the process of opening PRs against repos that would break? I want to get this into standard v14 |
I’d like to help with this 👍 I’ve opened standard/eslint-config-standard#152 to add |
@sonicdoe Thanks for taking on this task! 💪 |
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This applies standard for linting JavaScript as per the GDS Way [1]. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [2]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [3], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [4] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: standard/standard#633 [3]: alphagov/govuk_publishing_components#1611 (comment) [4]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. As this project has very little JS and Sass I did um and ah about whether to add this but it felt best to be consistent. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This applies standard for linting JavaScript as per the GDS Way [1]. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [2]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [3], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [4] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: standard/standard#633 [3]: alphagov/govuk_publishing_components#1611 (comment) [4]: https://github.com/standard/standardx
This applies standard for linting JavaScript as per the GDS Way [1]. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [2]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [3], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [4] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: standard/standard#633 [3]: alphagov/govuk_publishing_components#1611 (comment) [4]: https://github.com/standard/standardx
This applies standard for linting JavaScript as per the GDS Way [1]. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [2]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [3], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [4] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: standard/standard#633 [3]: alphagov/govuk_publishing_components#1611 (comment) [4]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx ---
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
This is added to this project as part of roll-out across GOV.UK of stylelint to replace scss_lint-govuk as the default linter. This project previously didn't have any JS linting installed so Standard is installed as per the GDS Way [1]. For SCSS linting stylelint-config-gds [2] is used which is a GDS standard based upon stylelint [3]. Both of these projects are then added to dependabot to have their versions maintained with the same approach we use for rubocop-govuk. Standardx is used instead of standard because Standard 16 introduced a rule that disallowed the use of `var`, instead preferring `let` or `const` [4]. This conflicts with the GOV.UK approach where we tend to not embrace features that we know will break old browsers even if they're not necessarily supported [5], disallowing var will mean that < IE 11 will be unable to run any of the JS. In order to customise standard rules this project has switched to using standardx [6] which allows us to disallow rules. I've used this so we can disallow the 'no-var' rule. [1]: https://gds-way.cloudapps.digital/manuals/programming-languages/js.html#linting [2]: https://github.com/alphagov/stylelint-config-gds [3]: https://stylelint.io/ [4]: standard/standard#633 [5]: alphagov/govuk_publishing_components#1611 (comment) [6]: https://github.com/standard/standardx
Referring to this rule.
Standard should read node version from the
engines
(more information) property in package.json, if the version supportsconst
,no-var
should be added to the list of rules.Any thoughts?
Is there any reason to use
var
in node versions that supportconst
andlet
?The text was updated successfully, but these errors were encountered: