-
Notifications
You must be signed in to change notification settings - Fork 17
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 Stylelint to lint Sass and Standardx to lint JS #1972
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This saves a dependency given sass-rails is just a wrapper around sassc-rails. I've added this to dependabot as most GOV.UK apps have sass-rails/sassc-rails managed there with this repo being an omission.
This option no longer has any effect.
This got missed when the assets changed location.
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
npx standardx --fix 'app/assets/javascripts/**/*.js' 'spec/javascripts/**/*.js'
This has been replaced by stylelint.
This also updates the Rakefile to be more consistent with the other ones on GOV.UK apps, by clearing a default task if it exists and re-defining default as all lint and test tasks.
kevindew
added a commit
to alphagov/govuk-docker
that referenced
this pull request
Jan 13, 2021
This was added to the project in: alphagov/government-frontend#1972
thomasleese
approved these changes
Jan 14, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trello: https://trello.com/c/MeG1zc2m/195-roll-out-stylelint-config-gds-across-govuk
This project previously had no JS linting and used the Ruby based scss-lint_govuk project for Sass linting. This adds in JS linting from Standardx and replaces the Ruby Sass linter with Stylelint.
More info in the commits...