-
Notifications
You must be signed in to change notification settings - Fork 104
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
Lint codebase using standard #334
Conversation
69f9d14
to
b6ec37a
Compare
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.
Great work! 👍
I didn't review the --fix
commit as it's massive and I trust the AST-parsing robots better than I trust myself.
"grunt-contrib-jasmine": "^1.0.0", | ||
"grunt-contrib-sass": "0.7.4", | ||
"jquery": "~1.11.3" | ||
"jquery": "~1.11.3", | ||
"standard": "^8.2.0" |
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.
NB: Standard 8 was launched this month but govuk_prototype_kit
for ex is still on Standard 7.
Updating is not really a priority IMO. (the only important changes are for JSX I think which we don't use)
Can you add semicolons at the start of IIFE's as part of this? Will solve #338. |
This indicates an issue with our module pattern wherein we don't need to be using a class pattern for some of our code since there's no returned instance that is being used. If this is the case that there are public methods exposed on an instance we should test those...
b6ec37a
to
b32fa4c
Compare
- Removed phase-banner scss file as no longer needed Full list of changes: SelectionButtons will add a class to the label with the type of the child input alphagov/govuk_frontend_toolkit#317 Add GOVUK.ShowHideContent JavaScript to support showing and hiding content, toggled by radio buttons and checkboxes alphagov/govuk_frontend_toolkit#315 Fix error in IE - remove trailing comma from shimLinksWithButtonRole JavaScript alphagov/govuk_frontend_toolkit#323 Remove unnecessary print font fallback that causes regression downstream alphagov/govuk_frontend_toolkit#328 Update tooling to use npm script rather than grunt-shell alphagov/govuk_frontend_toolkit#327 For smaller screens (<768px) ensure that the GOVUK.StickAtTopWhenScrolling JS "unsticks" the element which was previously "stuck" (by removing both the class which sets fixed positioning and the shim). alphagov/govuk_frontend_toolkit#329 Lint codebase using standard alphagov/govuk_frontend_toolkit#334 Add semicolons at the start of IIFE's alphagov/govuk_frontend_toolkit#339 Removal of external link styles and icons, if you are using the external-link-* mixins you will need to remove them from your codebase alphagov/govuk_frontend_toolkit#293 Correct spelling of the 'accordion' icon, you will need to check for the incorrect spelling 'accordian' and update if you are using this icon alphagov/govuk_frontend_toolkit#345 Amend GOVUK.StickAtTopWhenScrolling to resize the sticky element and shim when the .js-sticky-resize class is set alphagov/govuk_frontend_toolkit#343 Allow custom options in GOVUK.analytics.trackPageview alphagov/govuk_frontend_toolkit#332 Fix role="button" click shim alphagov/govuk_frontend_toolkit#347 Make font variables lowercase alphagov/govuk_frontend_toolkit#348 Update selection button documentation alphagov/govuk_frontend_toolkit#350 Change colour used in phase tags to govuk-blue alphagov/govuk_frontend_toolkit#353
- Removed phase-banner scss file as no longer needed Full list of changes: SelectionButtons will add a class to the label with the type of the child input alphagov/govuk_frontend_toolkit#317 Add GOVUK.ShowHideContent JavaScript to support showing and hiding content, toggled by radio buttons and checkboxes alphagov/govuk_frontend_toolkit#315 Fix error in IE - remove trailing comma from shimLinksWithButtonRole JavaScript alphagov/govuk_frontend_toolkit#323 Remove unnecessary print font fallback that causes regression downstream alphagov/govuk_frontend_toolkit#328 Update tooling to use npm script rather than grunt-shell alphagov/govuk_frontend_toolkit#327 For smaller screens (<768px) ensure that the GOVUK.StickAtTopWhenScrolling JS "unsticks" the element which was previously "stuck" (by removing both the class which sets fixed positioning and the shim). alphagov/govuk_frontend_toolkit#329 Lint codebase using standard alphagov/govuk_frontend_toolkit#334 Add semicolons at the start of IIFE's alphagov/govuk_frontend_toolkit#339 Removal of external link styles and icons, if you are using the external-link-* mixins you will need to remove them from your codebase alphagov/govuk_frontend_toolkit#293 Correct spelling of the 'accordion' icon, you will need to check for the incorrect spelling 'accordian' and update if you are using this icon alphagov/govuk_frontend_toolkit#345 Amend GOVUK.StickAtTopWhenScrolling to resize the sticky element and shim when the .js-sticky-resize class is set alphagov/govuk_frontend_toolkit#343 Allow custom options in GOVUK.analytics.trackPageview alphagov/govuk_frontend_toolkit#332 Fix role="button" click shim alphagov/govuk_frontend_toolkit#347 Make font variables lowercase alphagov/govuk_frontend_toolkit#348 Update selection button documentation alphagov/govuk_frontend_toolkit#350 Change colour used in phase tags to govuk-blue alphagov/govuk_frontend_toolkit#353
* Test track-share-button-clicks module * Lint using JS Standard (as per alphagov/govuk_frontend_toolkit#334) * Include jQuery as a spec helper
The toolkit JS was refactored to pass StandardJS linting rules: alphagov/govuk_frontend_toolkit#334 We haven't moved to them yet and still lint according to JSHint + our own config (see .jshintrc). This refactors the toolkit JS to pass our rules. Note: we will move to StandardJS rules in the future but doing so requires changing all our JS and tests so cannot be included in this story.
The toolkit JS was refactored to pass StandardJS linting rules: alphagov/govuk_frontend_toolkit#334 We haven't moved to them yet and still lint according to JSHint + our own config (see .jshintrc). This refactors the toolkit JS to pass our rules. Note: we will move to StandardJS rules in the future but doing so requires changing all our JS and tests so cannot be included in this story.
The toolkit JS was refactored to pass StandardJS linting rules: alphagov/govuk_frontend_toolkit#334 We haven't moved to them yet and still lint according to JSHint + our own config (see .jshintrc). This refactors the toolkit JS to pass our rules. Note: we will move to StandardJS rules in the future but doing so requires changing all our JS and tests so cannot be included in this story.
I recognise this is a big diff, so just raising this to see what people think..
Best viewed commit by commit, any changes that could potentially change logic or were manually I've done in different commits - separate from the automated fixing.
Linting the codebase has removed unused variables, made us explicit about declaring globals and improved patterns like the following
Finally I've silenced an error surrounding our use of 'new', this indicates an issue with our module pattern wherein we don't need to be using a class pattern for some of our code since there's no returned instance that is being used.
If this is the case that there are public methods exposed on an instance we should test those...