Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint crash when upgrading to 1.4.1 #135

Closed
bloody-ux opened this issue Feb 16, 2023 · 13 comments · Fixed by #138
Closed

eslint crash when upgrading to 1.4.1 #135

bloody-ux opened this issue Feb 16, 2023 · 13 comments · Fixed by #138

Comments

@bloody-ux
Copy link

When we upgrade esquery to 1.4.1, eslint will crash, below is the log:

eslint ./src --ext .jsx,.js,.ts,.tsx

Oops! Something went wrong! :(

ESLint: 7.32.0

TypeError: Cannot read properties of undefined (reading 'type')
Occurred while linting /Users/bhtbed/workspace/特价版/merge-radish/src/app.ts:1
at /Users/bhtbed/workspace/特价版/merge-radish/node_modules/_esquery@1.4.1@esquery/dist/esquery.min.js:1:29531
at /Users/bhtbed/workspace/特价版/merge-radish/node_modules/_esquery@1.4.1@esquery/dist/esquery.min.js:1:30574
at Function.b.matches (/Users/bhtbed/workspace/特价版/merge-radish/node_modules/_esquery@1.4.1@esquery/dist/esquery.min.js:1:34910)
at NodeEventGenerator.applySelector (/Users/bhtbed/workspace/特价版/merge-radish/node_modules/_eslint@7.32.0@eslint/lib/linter/node-event-generator.js:292:21)
at NodeEventGenerator.applySelectors (/Users/bhtbed/workspace/特价版/merge-radish/node_modules/_eslint@7.32.0@eslint/lib/linter/node-event-generator.js:320:22)
at NodeEventGenerator.enterNode (/Users/bhtbed/workspace/特价版/merge-radish/node_modules/_eslint@7.32.0@eslint/lib/linter/node-event-generator.js:336:14)
at CodePathAnalyzer.enterNode (/Users/bhtbed/workspace/特价版/merge-radish/node_modules/_eslint@7.32.0@eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
at /Users/bhtbed/workspace/特价版/merge-radish/node_modules/_eslint@7.32.0@eslint/lib/linter/linter.js:960:32
at Array.forEach ()

@binsee
Copy link

binsee commented Feb 16, 2023

same problem

  • output
> file-box@1.7.0 lint:es
> eslint --ignore-pattern fixtures/ "src/**/*.ts" "tests/**/*.ts"

Oops! Something went wrong! :(

ESLint: 8.34.0

TypeError: Cannot read properties of undefined (reading 'type')
Occurred while linting /Users/binsee/code/file-box/src/config.ts:1
    at /Users/binsee/code/file-box/node_modules/esquery/dist/esquery.min.js:1:29496
    at /Users/binsee/code/file-box/node_modules/esquery/dist/esquery.min.js:1:30539
    at Function.b.matches (/Users/binsee/code/file-box/node_modules/esquery/dist/esquery.min.js:1:34875)
    at NodeEventGenerator.applySelector (/Users/binsee/code/file-box/node_modules/eslint/lib/linter/node-event-generator.js:296:21)
    at NodeEventGenerator.applySelectors (/Users/binsee/code/file-box/node_modules/eslint/lib/linter/node-event-generator.js:324:22)
    at NodeEventGenerator.enterNode (/Users/binsee/code/file-box/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (/Users/binsee/code/file-box/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23)
    at /Users/binsee/code/file-box/node_modules/eslint/lib/linter/linter.js:1153:32
    at Array.forEach (<anonymous>)
    at runRules (/Users/binsee/code/file-box/node_modules/eslint/lib/linter/linter.js:1148:15)
  • package-lock.json
    "node_modules/esquery": {
      "version": "1.4.1",
      "resolved": "https://registry.npmmirror.com/esquery/-/esquery-1.4.1.tgz",
      "integrity": "sha512-3ZggxvMv5EEY1ssUVyHSVt0oPreyBfbUi1XikJVfjFiBeBDLdrb0IWoDiEwqT/2sUQi0TGaWtFhOGDD8RTpXgQ==",
      "dev": true,
      "dependencies": {
        "estraverse": "^5.1.0"
      },
      "engines": {
        "node": ">=0.10"
      }
    },

aladdin-add added a commit to eslint/eslint that referenced this issue Feb 16, 2023
the new released v1.4.1 breaks eslint.

related: 
* #16896
* estools/esquery#135
@bmnidhin
Copy link

We are facing this too

@TapGhoul
Copy link

TapGhoul commented Feb 16, 2023

Got it affecting a number of modules, including the @typescript-eslint/require-await rule from https://github.com/typescript-eslint/typescript-eslint, as seen in typescript-eslint/typescript-eslint#6477

For anyone looking for a quick/temporary fix, run npm install --save-dev --save-exact esquery@1.4.0 to force the working 1.4.0 version to install. An npm upgrade will break it again, so just re-run it to re-download 1.4.0 until a fixed 1.4.2 is released.

@markchristianlacap
Copy link

same problem with my eslint config

@bradzacher
Copy link

bradzacher commented Feb 16, 2023

A mocha test case for the repo which should pass, but fails in the latest version

    it("child not", function () {
        const program = {
            type: "Program",
            body: [
                {
                    type: "VariableDeclaration",
                    declarations: [
                        {
                            type: "VariableDeclarator",
                            id: { type: "Identifier", name: "x" },
                            init: { type: "Literal", value: 1, raw: "1" },
                        },
                    ],
                    kind: "var",
                },
            ],
        };
        const matches = esquery(program, "VariableDeclarator[init] > *");

        assert.includeMembers(matches, [
            program.body[0].declarations[0].id,
            program.body[0].declarations[0].init,
        ]);
    });

Running this test against the v1.4.0 tag passes.
Bisecting I think this was introduced in 44e1ff5 (this PR - #134) cc @jviide

@jviide
Copy link
Contributor

jviide commented Feb 16, 2023

@michaelficarra Yes, can confirm this issue, and that @binsee's PR #136 is a good fix for it.

aladdin-add added a commit to eslint/eslint that referenced this issue Feb 16, 2023
the new released v1.4.1 breaks eslint.

related: 
* #16896
* estools/esquery#135
@stheine
Copy link

stheine commented Feb 16, 2023

Same issue here.
As workaround, on the top app level I install the older version:
npm install --save-dev esquery@1.4.0

AviVahl added a commit to wixplosives/engine that referenced this issue Feb 16, 2023
- and regenerate lock file
- remove unused file-services/resolve
- pinned esquery due to estools/esquery#135
@andreassjoberg
Copy link

andreassjoberg commented Feb 16, 2023

Same issue here. As workaround, on the top app level I install the older version: npm install --save-dev esquery@1.4.0

You can also add to your package.json:

  "overrides": {
    "esquery": "1.4.0"
  },

@sezanzeb
Copy link

sezanzeb commented Feb 16, 2023

In yarn, you can use resolutions in your package.json file

    "resolutions": {
        "eslint/esquery": "1.4.0"
    },

afterwards, run yarn. I think this is a better workaround than adding a fixed esquery version as a dependency of your project.

davorpa added a commit to davorpa/omdb-search-react-app that referenced this issue Feb 16, 2023
esquery package is a transitive dependency for us - and a broken version was released last night.

This commit fixes esquery to 1.4.0

See: estools/esquery#135
arvinxx added a commit to ant-design/antd-style that referenced this issue Feb 16, 2023
@tentone
Copy link

tentone commented Feb 16, 2023

Same problem can be fixed by reverting back to version 1.4.0.

bug

@michaelficarra
Copy link
Member

This should be fixed by 1.4.2. Please confirm.

@aarongerig
Copy link

@michaelficarra Upgrading to 1.4.2 solved the issue for me.

@davorpa
Copy link

davorpa commented Feb 16, 2023

This should be fixed by 1.4.2. Please confirm.

It works for me

davorpa added a commit to davorpa/omdb-search-react-app that referenced this issue Feb 16, 2023
esquery package is a transitive dependency for us - and a broken version was released last night.

This commit fixes esquery to 1.4.2 since 1.4.1 is buggy

See: estools/esquery#135
Patched by: estools/esquery#138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet