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

Remove / refactor some variable declarations #223

Merged
merged 2 commits into from
Aug 10, 2016

Conversation

tvararu
Copy link
Contributor

@tvararu tvararu commented Jul 13, 2016

Various nits I've found while running a linter through the codebase.

@tvararu tvararu changed the title Remove unused variables in server.js [Do not merge] Remove unused variables in server.js Jul 13, 2016
@tvararu
Copy link
Contributor Author

tvararu commented Jul 13, 2016

Added a do not merge label as I'm finding a few more of these.

@@ -6,8 +6,6 @@
if (typeof GOVUK === 'undefined') { root.GOVUK = {}; }

var SelectionButtons = function (elmsOrSelector, opts) {
var $elms;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case it isn't clear, this variable was getting written to, but nobody was reading from it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, its not clear but this code doesnt originate in the kit - I think it comes from the Frontend toolkit? Or Elements? @gemmaleigh ?

Copy link
Contributor Author

@tvararu tvararu Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if that's the case, I'm of the opinion that if it's in source control we should either:

  • treat it as our responsibility and fix/maintain it
  • remove and declare it as an external dependency (using package.json in this situation)

Let me know what you think. 👌

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeh you're right - looks like we ought to be able to refer to it in the toolkit that gets downloaded, either with this line or something similar: https://github.com/alphagov/govuk_prototype_kit/blob/master/server.js#L58

Copy link
Contributor Author

@tvararu tvararu Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joelanman: I've just tested and it seems like this behaviour is already implemented, exactly as you describe it. So we can just remove the app/assets/govuk/javascripts/selection-buttons.js dupe from this codebase without any issues.

@tvararu tvararu changed the title [Do not merge] Remove unused variables in server.js Remove / refactor some variable declarations Jul 13, 2016
@tvararu tvararu mentioned this pull request Jul 13, 2016
2 tasks
@gemmaleigh
Copy link
Contributor

I think the best way to go ahead with this would be to update the original selection-buttons.js file in the front end toolkit, bump the version of the front end toolkit and then update the version of the front end toolkit we're using for the kit (in package.json) which will then pull in this change.

It also means that other repos which consume the JS from the frontend toolkit (for example, GOV.UK elements) can update to get this fix too.

There's also another piece of work which involves not committing library code (like this file) to this repo, ideally it should be added to .gitignore and copied over from the frontend_toolkit_npm module when the app is run.

@tvararu
Copy link
Contributor Author

tvararu commented Jul 15, 2016

Thanks for the feedback, @gemmaleigh!

TODO:

tvararu pushed a commit that referenced this pull request Aug 9, 2016
A copy of this file already gets imported and served through
https://github.com/alphagov/govuk_prototype_kit/blob/master/server.js#L58.
As such, we don't need this file.

Relevant discusson:
#223 (comment)
@tvararu
Copy link
Contributor Author

tvararu commented Aug 9, 2016

I've updated this PR and it should be good to merge even without #233, which can be dealt with separately.

@NickColley NickColley merged commit 7b24354 into master Aug 10, 2016
@NickColley NickColley deleted the remove-unused-variables branch August 10, 2016 10:10
@NickColley
Copy link
Contributor

Thanks @tvararu 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants