Skip to content

pre-commit hook broken by recent eslint changes #1891

Open
@living180

Description

@living180

When developing against the main branch of DjDT, I can no longer commit changes to JS files due to a failure in pre-commit. If I force a pre-commit run on the tip of main without any changes, I get the following output:

% pre-commit run eslint --files debug_toolbar/static/debug_toolbar/js/toolbar.js
eslint...................................................................Failed
- hook id: eslint
- exit code: 2

Oops! Something went wrong! :(

ESLint: 9.0.0-beta.0

Error: Cannot find module '@eslint/js'
Require stack:
- /home/dharding/code/opensource/django-debug-toolbar/eslint.config.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/dharding/code/opensource/django-debug-toolbar/eslint.config.js:1:12)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)

If I revert the recent eslint changes from 38d2eea, pre-commit works without any problems.

Activity

tim-schilling

tim-schilling commented on Mar 10, 2024

@tim-schilling
Member

I can't seem to reproduce this unfortunately. What version of node and npm are you using?

living180

living180 commented on Mar 11, 2024

@living180
ContributorAuthor

I'm using the versions from the stable branch of Gentoo Linux:

% node --version
v20.11.0

% npm --version
10.2.4

Gentoo has multiple other versions of nodejs available that I could try if you think that would make a difference.

tim-schilling

tim-schilling commented on Mar 12, 2024

@tim-schilling
Member

Something interesting for me. When I restarted my pre-commit environment I see this in my logs:

[INFO] Initializing environment for https://github.com/pre-commit/mirrors-eslint:eslint@v9.0.0-beta.1,@eslint/js@v9.0.0-beta.1,globals.

Maybe 9.0.0-beta.0 was yanked?

tim-schilling

tim-schilling commented on Mar 12, 2024

@tim-schilling
Member

Nope, it's still there.

living180

living180 commented on Mar 17, 2024

@living180
ContributorAuthor

I downgraded to the oldest version of nodejs available in Gentoo:

% node --version
v18.17.1

% npm --version
9.6.7

then ran pre-commit clean and still had the same issue.

cclauss

cclauss commented on Mar 30, 2024

@cclauss
Contributor

Perhaps merge #1900 to see if the release candidate fixes things?

git commit --no-verify can be a workaround.

tim-schilling

tim-schilling commented on Aug 20, 2024

@tim-schilling
Member

@living180 any word on this? Otherwise I'm inclined to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @living180@tim-schilling@cclauss

        Issue actions

          pre-commit hook broken by recent eslint changes · Issue #1891 · django-commons/django-debug-toolbar