Opened 5 years ago

Closed 4 years ago

#22463 closed Cleanup/optimization (fixed)

Inconsistent code style in HTML, JavaScript, and CSS files

Reported by: Trey Hunner Owned by: Trey Hunner
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


There are multiple inconsistent code styles used throughout the Django project.

It appears that the overall preferred style for HTML is 2 spaces, JavaScript is 2 or 4 spaces (and sometimes tabs) and CSS is 4 spaces.

It seems that all files should have newlines at the end and whitespace should be trimmed from the end of each line.

I am currently working on discovering the existing code style, fixing obvious unintended inconsistencies, and creating a .editorconfig file to document the expectations for future code changes.

Change History (7)

comment:1 Changed 5 years ago by Trey Hunner

I started a pull request for this ticket here:

comment:2 Changed 5 years ago by Trey Hunner

Owner: changed from nobody to Trey Hunner
Status: newassigned

comment:3 Changed 5 years ago by Trey Hunner

I added a (nearly empty) .jshintrc file to the pull request. The preferred code style should be decided (I prefer the default JSHint style) and the existing code should be modified to adhere to the style.

comment:4 Changed 5 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

Accepted on the principle that we Flake8 our Python code; linting our JavaScript would also seem prudent. The only decision is the choice of linter. See this django-dev thread for discussion.

comment:5 Changed 4 years ago by Tim Graham

Component: UncategorizedDocumentation
Has patch: set
Needs documentation: set

comment:6 Changed 4 years ago by Tomek Paczkowski

Looks like there is new PR for this:

comment:7 Changed 4 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In ec4f219:

Fixed #22463 -- Added code style guide and JavaScript linting (EditorConfig and ESLint)

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