Proposal: document and enforce style of all files (including JS, CSS, HTML)

102 views
Skip to first unread message

Trey Hunner

unread,
Apr 16, 2014, 5:37:20 PM4/16/14
to django-d...@googlegroups.com
The JavaScript files use 4 spaces, 2 spaces, or tabs (depending on the file).  The CSS files use mostly 4 spaces, and the HTML files use mostly 2 spaces and sometimes 4 spaces.

The JavaScript code is unlinted and the general code style is neither documented nor enforced.  I think jshint should be used for JavaScript linting and to help clean up the JavaScript code.  It should also be built into the test process (via running "jshint .").  Optionally, it could also be run automatically through tox or a fabric/invoke/grunt configuration.

I opened a ticket and pull request related to this issue: https://code.djangoproject.com/ticket/22463#comment:2

Based on the errors I've seen in the JavaScript code so far, I think a code review may be sufficient for ensuring that the changed files continue to work as expected.

--
Trey Hunner

Russell Keith-Magee

unread,
Apr 16, 2014, 9:08:50 PM4/16/14
to Django Developers
Hi Trey,

Sounds like a reasonable proposal to me. Our JavaScript code has… evolved, shall we say… over the years. We've recently started enforcing Flake8 compliance on our Python codebase; adopting similar rigour for our JavaScript code would seem appropriate.

The only open question I can see is the choice of linter -- I don't have any firm opinions; I'd be interested if others agree with jshint as a good choice.

Yours,
Russ Magee %-)



--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CACuWcAwrCq_q4%2BFkKOVU5nqokSSgM7wqzXPbo%2BKJh0U%3DY1ecVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Carl Meyer

unread,
Apr 17, 2014, 1:10:57 PM4/17/14
to django-d...@googlegroups.com
On 04/16/2014 07:08 PM, Russell Keith-Magee wrote:

> Sounds like a reasonable proposal to me. Our JavaScript code has…
> evolved, shall we say… over the years. We've recently started enforcing
> Flake8 compliance on our Python codebase; adopting similar rigour for
> our JavaScript code would seem appropriate.
>
> The only open question I can see is the choice of linter -- I don't have
> any firm opinions; I'd be interested if others agree with jshint as a
> good choice.

Yes, jshint is the right choice I think.

Thanks Trey for working on this!

Carl
Reply all
Reply to author
Forward
0 new messages