Skip to content

Plugin requires "parserOptions.sourceType" being configured to "script" #244

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

Closed
tristanHessell opened this issue Mar 27, 2022 · 7 comments · Fixed by #245
Closed

Plugin requires "parserOptions.sourceType" being configured to "script" #244

tristanHessell opened this issue Mar 27, 2022 · 7 comments · Fixed by #245

Comments

@tristanHessell
Copy link

Rules in this repo have a dependency on eslint being configured with:

...
parserOptions: {
  sourceType: 'script',
}

This is makes sense, but I ran into unexpectedly as I created a plugin from scratch rather than using the yeoman generator (https://github.com/eslint/generator-eslint).
For context, using the generator eslint-plugin-node/recommended gets extended and this config sets the parserOption).

Can we update the documentation somewhere to make it clear that this is a configuration requirement?

I'm happy to create a PR to update README.md with this.

@aladdin-add
Copy link
Contributor

not sure I got your point.

is it related to eslint-plugin-eslint-plugin? or eslint-plugin-node?

@tristanHessell
Copy link
Author

eslint-plugin-eslint-plugin.

The short answer is that the plugin requires parserOptions.sourceType to be script to work and that isn't documented (unless im mistaken).

I'm more than happy to contribute a PR to add to the documentation if we see fit.

@aladdin-add
Copy link
Contributor

sure, PRs are always welcome! 👍

@bmish
Copy link
Member

bmish commented Mar 28, 2022

One important note here: as mentioned at the top of our README, eslint-plugin-eslint-plugin can work on all CJS/ESM/TypeScript repos, so either script or module can be used with us.

There were some general improvements I wanted to make to the usage example in the README, so I opened a PR #245, and also mentioned parserOptions.sourceType in it. Please comment on the PR and let me know if that addresses your concern.

@aladdin-add
Copy link
Contributor

I had searched in the repo, it does not check sourceType==="script", so I didn't see why it requires the setting. can you provide an example?

@bmish
Copy link
Member

bmish commented Mar 28, 2022

Our plug-in doesn't specifically care what sourceType is. I think what he's running into is just general eslint syntax parsing issues.

@tristanHessell
Copy link
Author

@bmish I think you hit the nail on the head.

I'll add a comment to the PR as you asked 👍

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

Successfully merging a pull request may close this issue.

3 participants