Back to all reviewers

Organize by functionality

django/django
Based on 2 comments
JavaScript

Place code in files that match its functionality. When functionality applies to multiple components, use a general-purpose file rather than component-specific ones. This improves maintainability and makes the codebase easier to navigate.

Code Style JavaScript

Reviewer Prompt

Place code in files that match its functionality. When functionality applies to multiple components, use a general-purpose file rather than component-specific ones. This improves maintainability and makes the codebase easier to navigate.

For example, instead of:

// In inlines.js
$('.js-inline-admin-formset fieldset.module.collapse:not(.open) details[open]').each(function() {
    this.removeAttribute('open');
});

Prefer:

// In a more general file like change_form.js
document.querySelectorAll('fieldset.module.collapse:not(.open) details[open]').forEach(details => {
    details.removeAttribute('open');
});

Additionally, use modern JavaScript patterns where appropriate to improve code consistency and readability.

2
Comments Analyzed
JavaScript
Primary Language
Code Style
Category

Source Discussions