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

Require let or const instead of var (no-var) #633

Closed
albinekb opened this issue Sep 19, 2016 · 39 comments
Closed

Require let or const instead of var (no-var) #633

albinekb opened this issue Sep 19, 2016 · 39 comments

Comments

@albinekb
Copy link

albinekb commented Sep 19, 2016

Referring to this rule.

Standard should read node version from the engines (more information) property in package.json, if the version supports const, no-var should be added to the list of rules.

Any thoughts?
Is there any reason to use var in node versions that support const and let?

@dcousens
Copy link
Member

Would probably break wayyy to much. Although, I agree with the rule fundamentally.
Might be worth linking in #523

@albinekb
Copy link
Author

albinekb commented Sep 19, 2016

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)?

@dcousens
Copy link
Member

dcousens commented Sep 19, 2016

#382 might be what you're after, but in the end, I write code for environments where let isn't defined, so this would stop me from using standard since my local node version is >6.0.0.

@albinekb
Copy link
Author

albinekb commented Sep 19, 2016

Cool!
Yes but if your code supports environments where let isn't defined, you don't have engines in your package.json set to node 6? 💭

See https://docs.npmjs.com/files/package.json#engines

@dcousens
Copy link
Member

Isn't engines only enforced if the user specifies engines-strict? Which is default off...

@feross
Copy link
Member

feross commented Sep 20, 2016

@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 engines field is the way to go.

Once let works in more environments (like 90% of browsers on CanIUse I think we can consider enabling it. There's definitely an argument to be made that var serves no purpose once let is pervasive. Also, this rule is automatically fixable.

@dcousens
Copy link
Member

dcousens commented Sep 20, 2016

Agreed @feross, I'm just saying I don't think that time is now. Hopefully soon though :)

@feross
Copy link
Member

feross commented Sep 26, 2016

Cool -- I'll close this issue for now since it's not actionable.

@feross feross closed this as completed Sep 26, 2016
@ForsakenHarmony
Copy link

currently at 83%

@redbmk
Copy link

redbmk commented Apr 4, 2018

Up to 91.4% now

@LinusU
Copy link
Member

LinusU commented Apr 4, 2018

@feross is it time? 😎

@feross
Copy link
Member

feross commented May 15, 2018

Yep, I think it's time 👍

@feross feross reopened this May 15, 2018
@feross feross added this to the standard v12 milestone May 15, 2018
@feross feross modified the milestones: standard v12, standard v13 Aug 28, 2018
@harrysarson
Copy link

May I inquire about the status of this one?

@LinusU
Copy link
Member

LinusU commented Mar 11, 2019

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 eslintrc.json, and running the tests.

@feross
Copy link
Member

feross commented Jul 29, 2019

Anyone want to help start the process of opening PRs against repos that would break? I want to get this into standard v14

@sonicdoe
Copy link
Contributor

sonicdoe commented Aug 2, 2019

I’d like to help with this 👍 I’ve opened standard/eslint-config-standard#152 to add no-var to the ESLint config and included a list of all failing repositories in the description.

@feross
Copy link
Member

feross commented Aug 2, 2019

@sonicdoe Thanks for taking on this task! 💪

kevindew added a commit to alphagov/release that referenced this issue Dec 3, 2020
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
kevindew added a commit to alphagov/calculators that referenced this issue Dec 3, 2020
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
kevindew added a commit to alphagov/collections that referenced this issue Dec 8, 2020
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
kevindew added a commit to alphagov/specialist-publisher that referenced this issue Dec 11, 2020
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
kevindew added a commit to alphagov/calculators that referenced this issue Dec 11, 2020
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
kevindew added a commit to alphagov/calculators that referenced this issue Dec 11, 2020
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
kevindew added a commit to alphagov/calculators that referenced this issue Dec 11, 2020
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
kevindew added a commit to alphagov/calculators that referenced this issue Dec 15, 2020
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
kevindew added a commit to alphagov/email-alert-frontend that referenced this issue Jan 5, 2021
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
kevindew added a commit to alphagov/feedback that referenced this issue Jan 5, 2021
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
kevindew added a commit to alphagov/finder-frontend that referenced this issue Jan 5, 2021
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
kevindew added a commit to alphagov/finder-frontend that referenced this issue Jan 6, 2021
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
kevindew added a commit to alphagov/content-data-admin that referenced this issue Jan 6, 2021
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
kevindew added a commit to alphagov/frontend that referenced this issue Jan 8, 2021
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
kevindew added a commit to alphagov/government-frontend that referenced this issue Jan 8, 2021
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
kevindew added a commit to alphagov/manuals-frontend that referenced this issue Jan 11, 2021
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
kevindew added a commit to alphagov/smart-answers that referenced this issue Jan 11, 2021
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
kevindew added a commit to alphagov/service-manual-frontend that referenced this issue Jan 12, 2021
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
---
kevindew added a commit to alphagov/static that referenced this issue Jan 13, 2021
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
kevindew added a commit to alphagov/static that referenced this issue Jan 13, 2021
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
kevindew added a commit to alphagov/frontend that referenced this issue Jan 14, 2021
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
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.