Opened 10 years ago

Closed 9 years ago

Last modified 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: dev
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 (9)

comment:1 by Trey Hunner, 10 years ago

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

comment:2 by Trey Hunner, 10 years ago

Owner: changed from nobody to Trey Hunner
Status: newassigned

comment:3 by Trey Hunner, 10 years ago

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 by Russell Keith-Magee, 10 years ago

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 by Tim Graham, 10 years ago

Component: UncategorizedDocumentation
Has patch: set
Needs documentation: set

comment:6 by Tomek Paczkowski, 9 years ago

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

comment:7 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In ec4f219:

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

comment:8 by GitHub <noreply@…>, 4 years ago

In 7b4bd2a8:

Refs #22463 -- Replaced JSHint with ESLint in contributing docs.

comment:9 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In abe33c16:

[3.0.x] Refs #22463 -- Replaced JSHint with ESLint in contributing docs.

Backport of 7b4bd2a82c4709a9078fed5c33fa94f208a8c41e from master

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