Skip to content

bug: ReferenceError: require is not defined in ES module scope, you can use import instead #141

@neslinesli93

Description

@neslinesli93

Prerequisites

Stencil ESLint Version

1.0.0

Current Behavior

Hey, I've been trying to run eslint with this plugin and I've been unable to do because of the line containing the require in the bundle:

const jsdom = require("jsdom");

This happens both on an old project and on a new project that i just scaffolded with the latest version of stencil and of this plugin. The project can be seen here: https://github.com/neslinesli93/test-stencil-eslint

Just run the following commands to reproduce the issue:

yarn
yarn lint

The error is:

yarn run v1.22.22
$ eslint src

Oops! Something went wrong! :(

ESLint: 9.22.0

ReferenceError: require is not defined in ES module scope, you can use import instead
    at file:///home/neslinesli93/STUFF/test-stencil-eslint/node_modules/@stencil/eslint-plugin/dist/index.js:1047:15
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected Behavior

The linter runs just fine

Steps to Reproduce

Code Reproduction URL

https://github.com/neslinesli93/test-stencil-eslint

Additional Information

No response

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

    Issue actions