-
Notifications
You must be signed in to change notification settings - Fork 237
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
[RFC] Lint codebase using standard #224
Conversation
@@ -6,188 +6,185 @@ | |||
|
|||
// http://www.sitepoint.com/fixing-the-details-element/ | |||
|
|||
(function () { | |||
'use strict'; | |||
;(function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't need to do this. twbs/bootstrap#3057
4f17e50
to
661776a
Compare
I saw this tweet recently: https://twitter.com/brendaneich/status/741277499376603138 - Tim Berners-lee & Brendan Eich use standard. |
thanks for this, sorry I dont have much experience on this - can you explain a bit more about how it works? |
@joelanman certainly! 1edbe61 is where I've added Since Also worth mentioning some other "batteries-included" linters that fork standard or are in a similar vein:
I've hooked it up to 661776a is the monster commit where I run standard-format on every file, and complete it with a few manual modifications that it's not smart enough to do by itself. Stuff I've had to do is:
Hope I didn't waffle too much, I can update the commit/PR messages with more info if any of this is useful to have for posterity. |
thanks! When does the linter run? Or do you have to run it manually? |
@joelanman my hope is to update this so that it runs as part of CI, and combined with text editor plugins that's usually enough for projects I've used it in with other developers. Additionally we could also run the test suite on a |
TODO:
|
06a75d8
to
252b8b4
Compare
@joelanman I've written some documentation here: 123082a |
@tvararu like the addition in the docs, do you think we could briefly add why we're now linting and why standard being so opinionated is a good thing? |
@NickColley I've updated the latest commit, added two more blurbs on "Why lint?" and "Why standard?" 👌 |
Spoke about this in #frontend. The specific problem this solves is standardising the JS that goes into govuk_prototype_kit, it’s not necessarily being suggested for actual prototypes (although of course people using the kit are free to adopt for their own code if they wish). |
Hugely pro some kind of standardised linting across our projects. 👍 As discussed in the FE meeting, |
Thanks for the support @dsingleton! I recall @edwardhorsford mentioning that he'd prefer not to link to the Linting doc from the main page of the README, because it's too technical. There are also a few other things I recall:
Anybody subscribed to this thread feel free to edit this comment with things I've forgotten. |
If you'd like another project to try this out on, you are more than welcome to do the same for GOV.UK elements! Aside from the JS from the govuk_frontend_toolkit, some of the govuk_prototype_kit JS has been directly copied from govuk_elements. If we have JS that can be of benefit to more than one project, it makes sense to move it to govuk_frontend_toolkit. An example of this is the show/hide js, which will replace what is exists in application.js. (This is just a FYI, it won't affect this PR - but will mean we can simplify application.js in the future!) |
My train of thought around this was: Linting rules can be a contentious subject, and a personal preference. We should document why we chose a particular set of rules over others - why Hopefully that helps? |
Happy to merge this if others are? |
@joelanman yes please! ✨ |
@tvararu can you rebase against master and I'll merge |
This enables linting on CI.
thanks everyone! 💃 |
Breaking changes: - #244 Migrate documentation into a seperate application All changes: - Bump all GOV.UK assets to their latest versions - Remove duplicate GOV.UK assets copied to the app - #241 Warn against using the prototype kit to build production services - #268 Automatically keep the latest release branch up to date. This can be used to update the kit - #270 Add a new stylesheet for the unbranded layout to fix font issues - #257 Make CSS output easier to debug (with sourcemaps) - #237 Make links with role="button" behave like buttons - #224 Lint the prototype kit’s codebase using Standard. This only applies to the kit’s codebase - there’s no requirement for your app to meet this
Breaking changes: - #244 Migrate documentation into a separate application All changes: - Bump all GOV.UK assets to their latest versions - Remove duplicate GOV.UK assets copied to the app - #241 Warn against using the prototype kit to build production services - #268 Automatically keep the latest release branch up to date. This can be used to update the kit - #270 Add a new stylesheet for the unbranded layout to fix font issues - #257 Make CSS output easier to debug (with sourcemaps) - #237 Make links with role="button" behave like buttons - #224 Lint the prototype kit’s codebase using Standard. This only applies to the kit’s codebase - there’s no requirement for your app to meet this
Depends on:
This PR is an open discussion on the topic of using a JavaScript linting tool across our codebases.
I throw my hat in the ring by suggesting standard and demonstrating with this PR how an implementation would work for a node project.
Code was automatically converted using https://github.com/maxogden/standard-format.
We already have govuk-lint whose responsibility it is to handle linting concerns, and I'd love to hear what our thoughts are on relying on that instead.