Opened 12 years ago

Closed 10 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 Javi Manzano, 12 years ago

Cc: javi.manzano.oller@… added
Owner: changed from nobody to Javi Manzano
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 by Javi Manzano, 12 years ago

Cc: javi.manzano.oller@… removed
Owner: Javi Manzano removed
Status: assignednew
Triage Stage: AcceptedUnreviewed

comment:3 by Jef Geskens, 12 years ago

Cc: Jef Geskens added
Triage Stage: UnreviewedAccepted

That would be a great idea. Let's do it!

comment:4 by Kamil Gałuszka, 12 years ago

Owner: set to Kamil Gałuszka
Status: newassigned

comment:5 by Amizya, 11 years ago

Cc: Amizya added

comment:6 by Tim Graham, 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 anonymous, 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:8 by Kamil Gałuszka, 11 years ago

This post above is mine. Soory I forgot to log in.

Cheers,
Kamil

comment:9 by Aymeric Augustin, 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 Julien Phalip, 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 Tim Graham, 11 years ago

Easy pickings: unset

comment:12 by Tomek Paczkowski, 10 years ago

Resolution: duplicate
Status: assignedclosed

Closing as duplicate of #22463.

Note: See TracTickets for help on using tickets.
Back to Top