Opened 2 years ago

Closed 14 months ago

#22463 closed Cleanup/optimization (fixed)

Inconsistent code style in HTML, JavaScript, and CSS files

Reported by: treyhunner Owned by: treyhunner
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 2 years ago by treyhunner

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I started a pull request for this ticket here:

comment:2 Changed 2 years ago by treyhunner

  • Owner changed from nobody to treyhunner
  • Status changed from new to assigned

comment:3 Changed 2 years ago by treyhunner

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 2 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

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 2 years ago by timgraham

  • Component changed from Uncategorized to Documentation
  • Has patch set
  • Needs documentation set

comment:6 Changed 15 months ago by oinopion

Looks like there is new PR for this:

comment:7 Changed 14 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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