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

stylish cannot be imported in eslint 8 #4

Open
Sleavely opened this issue Feb 22, 2023 · 0 comments
Open

stylish cannot be imported in eslint 8 #4

Sleavely opened this issue Feb 22, 2023 · 0 comments

Comments

@Sleavely
Copy link

Sleavely commented Feb 22, 2023

Looks like the stylish formatter cant be correctly required. I receive this error in my pipeline:

There was a problem loading formatter: /opt/atlassian/pipelines/agent/build/node_modules/eslint-formatter-bitbucket-reports/index.js
Error: Package subpath './lib/cli-engine/formatters/stylish' is not defined by "exports" in /opt/atlassian/pipelines/agent/build/node_modules/eslint/package.json

Environment:

  • node 14.20.0
  • npm 6.14.17
  • eslint 8.14.0

I think the issue could be mitigated by, instead of requiring eslint/lib/cli-engine/formatters/stylish directly, you import eslint.ESLint and use the following snippet to render the results.

Change:

return stylish(results);

To:

// we dont have to bother passing any settings since we wont do any linting
const eslint = new ESLint();

const formatter = await eslint.loadFormatter("stylish");
return formatter.format(results);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant