Opened 3 years ago

Closed 18 months 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

Description

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 3 years ago by Trey Hunner

I started a pull request for this ticket here: https://github.com/django/django/pull/2577

comment:2 Changed 3 years ago by Trey Hunner

Owner: changed from nobody to Trey Hunner
Status: newassigned

comment:3 Changed 3 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 3 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 2 years ago by Tim Graham

Component: UncategorizedDocumentation
Has patch: set
Needs documentation: set

comment:6 Changed 18 months ago by Tomek Paczkowski

Looks like there is new PR for this: https://github.com/django/django/pull/4577

comment:7 Changed 18 months 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