Opened 11 years ago
Closed 9 years ago
#20436 closed Cleanup/optimization (duplicate)
Cleanup/Optimization of javascript code with JSLint in admin
Reported by: | Kamil Gałuszka | Owned by: | Kamil Gałuszka |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Jef Geskens, Amizya | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Django admin is using javascript for many controls. It will be great to improve this code using javascript linter like JSLint.
Also this is nice start to have some little cleanups in JS.
Change History (12)
comment:1 by , 11 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 11 years ago
Cc: | removed |
---|---|
Owner: | removed |
Status: | assigned → new |
Triage Stage: | Accepted → Unreviewed |
comment:3 by , 11 years ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:4 by , 11 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:5 by , 11 years ago
Cc: | added |
---|
comment:6 by , 11 years ago
I'm not sure this should be accepted. Note the following from our contributing docs:
Note, however, that patches which only remove whitespace (or only make changes for nominal PEP 8 conformance) are likely to be rejected, since they only introduce noise rather than code improvement. Tidy up when you’re next changing code in the area."
comment:7 by , 11 years ago
@timo
To address your concerns. It's not only removing whitespaces. My changes are doing some cleanup refactorings regarding also good patterns in JavaScript. Also I want to migrate all code to use ECMA5 using "use strict". This involves backward compatibility test. In the end I'm working on making code more OOP and to think how to solve problem of lacking of JavaScript unit tests. We definitely should do something about that.
For know there is sometimes functional code and sometimes object oriented. (and we pollute global namespace which is very bad JS pattern.)
So this is not ticket about changing whitespaces. It's about improving code performance and introduce more best practices. It's challenging and I'm try to that in my free time. Hopefully do eomt pull request in near future.
Cheers,
Kamil
comment:9 by , 11 years ago
Tim, I'm quite sure the admin JS needs to migrate to modern coding standards. The design is too far from the best practices of 2013. Let's leave this ticket as "accepted".
comment:10 by , 11 years ago
I agree that some refactorings would be welcome. De-cluttering the global namespace in particular sounds very appealing.
For a patch to be accepted there would need to be regression tests added. We have a system in place for running integration tests with Selenium, but this could also be a good opportunity to start working on a solution for unit-testing.
My only concern is that the scope feels a little large for just one ticket. If possible I think it'd be easier to manage by breaking this down in chunks. See for example an existing ticket for the filtered widget: #15220.
comment:11 by , 11 years ago
Easy pickings: | unset |
---|
comment:12 by , 9 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
Closing as duplicate of #22463.
That would be a great idea. Let's do it!