[Django] #36619: Vendor eslint configuration dependencies to permit pre-commit usage without npm install

3 views
Skip to first unread message

Django

unread,
Sep 23, 2025, 10:41:10 PM (8 days ago) Sep 23
to django-...@googlegroups.com
#36619: Vendor eslint configuration dependencies to permit pre-commit usage without
npm install
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Jacob Walls
Walls |
Type: | Status: assigned
Cleanup/optimization |
Component: Core | Version: dev
(Other) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The pre-commit hook for eslint has been broken for over a year. Noticed
contributors at the DCUS 2025 sprints stumbling on this.

Eventually, [https://forum.djangoproject.com/t/adding-a-formatter-for-css-
js we may be looking at another JS formatter], like Biome. Today, I'm
interesting in just fixing the hook.

More context is [https://github.com/django/django/pull/18162 here], but in
essence, the v9 eslint flat config format assumes you're a javascript
project in the habit of running `npm install`. We're not; we only run `npm
install` to run the `js_tests`.

We can either document that `npm install` is necessary to run `pre-commit`
(and consider that objectors might prefer to remove the hook altogether
instead of tolerating that), or we can write a
[https://github.com/django/django/pull/18162#issuecomment-2146012490 local
hook] that fiddles with symlinks, or as I'm suggesting, just vendor the
rule configuration and global definitions.

Sarah also suggested vendoring them
[https://github.com/django/django/pull/18162#discussion_r1598527382 here].
----
On vendoring:
eslint exports `@js/recommended` and `@js/all` specifically so that
`@js/all` can iterate faster with every minor release; so vendoring
`@js/recommended` doesn't seem horrible -- it's supposed to be stable.

Vendoring the globals creates a larger file, but there is various tweaking
we can do there, like weighing whether it's better or mysterious to just
vendor the constants we need (`"browser"` and `"commonjs"`).

Vendoring isn't ideal, but I think it makes sense for us given that most
contributors rarely need to run the `js_tests`.

From [https://eslint.org/blog/2022/08/new-config-system-part-2/#goodbye-
environments%2C-hello-globals eslint blog]:
> all that was left was for environments to manage global variables ... so
we are handing this responsibility back to you.
--
Ticket URL: <https://code.djangoproject.com/ticket/36619>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 23, 2025, 10:48:18 PM (8 days ago) Sep 23
to django-...@googlegroups.com
#36619: Vendor eslint configuration dependencies to permit pre-commit usage without
npm install
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 0 => 1


Old description:

> The pre-commit hook for eslint has been broken for over a year. Noticed
> contributors at the DCUS 2025 sprints stumbling on this.
>
> Eventually, [https://forum.djangoproject.com/t/adding-a-formatter-for-
> css-js we may be looking at another JS formatter], like Biome. Today, I'm
New description:

The pre-commit hook for eslint has been broken for over a year. Noticed
contributors at the DCUS 2025 sprints stumbling on this.

Eventually, [https://forum.djangoproject.com/t/adding-a-formatter-for-css-
js we may be looking at another JS formatter], like Biome. Today, I'm
interested in just fixing the hook.
Comment:

[https://github.com/django/django/pull/19899 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36619#comment:1>

Django

unread,
Sep 24, 2025, 5:10:40 AM (7 days ago) Sep 24
to django-...@googlegroups.com
#36619: Vendor eslint configuration dependencies to permit pre-commit usage without
npm install
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/36619#comment:2>

Django

unread,
Sep 24, 2025, 5:27:55 AM (7 days ago) Sep 24
to django-...@googlegroups.com
#36619: Vendor eslint configuration dependencies to permit pre-commit usage without
npm install
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36619#comment:3>

Django

unread,
Sep 24, 2025, 2:39:15 PM (7 days ago) Sep 24
to django-...@googlegroups.com
#36619: Vendor eslint configuration dependencies to permit pre-commit usage without
npm install
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36619#comment:4>

Django

unread,
Sep 26, 2025, 3:46:04 AM (5 days ago) Sep 26
to django-...@googlegroups.com
#36619: Vendor eslint configuration dependencies to permit pre-commit usage without
npm install
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36619#comment:5>

Django

unread,
Sep 30, 2025, 2:45:51 AM (yesterday) Sep 30
to django-...@googlegroups.com
#36619: Vendor eslint configuration dependencies to permit pre-commit usage without
npm install
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: closed
Component: Core (Other) | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"d29852ae725f673843c46085bb51cbc740d374d7" d29852ae]:
{{{#!CommitTicketReference repository=""
revision="d29852ae725f673843c46085bb51cbc740d374d7"
Fixed #36619 -- Vendored eslint configuration dependencies.

This allows the eslint pre-commit hook to run without depending
on a prior installation of node modules.

Follow-up to 6345a6ff63a8b8af86ee9a025e29984a410c9764.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36619#comment:6>
Reply all
Reply to author
Forward
0 new messages