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
Change Request: Implement RFC29 Processor Options #16806
Comments
Any progress on this? I could work on a new PR if nobody started already. |
@fasttime feel free to work on this. |
I have now restarted to implement this feature in eslint#rfc29 and eslintrc#rfc29. I was able to rebase part of the changes of #12068 into the new eslint branch, and apply the rest manually to match the current repo structure. Expecting many more changes to be done. |
I am unsure if it would be good to extend this feature to the flat config. With the flat config, a custom processor can be specified as an object rather than by package name. This already makes it easy to supply options to a processor using whatever API provided by the implementation. Today, a flat config that passes options to a custom processor could look like this: // eslint.config.js
import { FooBarProcessor } from 'eslint-plugin-foobar';
const processor = new FooBarProcessor({
option1: 42,
option2: true,
...moreOptions
});
export default [
{
files: ['src/**'],
processor,
rules: {
semi: 'error'
}
}
]; Basically, the same pattern can also be used to pass options to formatters and parser, making it trivial to parameterize plugin functionality. Adding support for |
Just to clarify, |
Thanks so much for the clarification @mdjermanovic. It wasn't obvious to me from the discussion so far that the changes would only apply to the flat config. After reading the transcript of the TSC meeting mentioned by @btmills this makes much more sense now (I should have done it from the start. Sorry...). Just for me to understand: is there a specific reason why we would like to pass processor options through ESLint first and then to a processor, instead of asking users to configure a processor by themselves (see the example config in my previous comment)? |
I need to understand how the processor options in the flat config will be used and why they are necessary - see #16806 (comment) - before I can continue working on this, so waiting for feedback. |
We are blocked by this feature in We need to determine whether or not to lint code blocks in Your proposed solution seems like a good workaround: import { FooBarProcessor } from 'eslint-plugin-foobar';
const processor = new FooBarProcessor({
option1: 42,
option2: true,
...moreOptions
}); I'd like to try it in |
Thanks for the info @JounQin. Please, don't hesitate to contact me if you encounter any problems, as I'd be really interested to understand how well this solution works in practice. It's been a while since the last update on this issue, but I'm still under the impression that the use cases that motivated RFC29 can be already handled without extending the config schema. That is to say, if you find an issue that is making it hard for you to work on your project without the proposed |
https://github.com/mdx-js/eslint-mdx#flat-config @fasttime I think |
Well, that looks good 👍🏻
Documentation for new flat config features in plugins is still a big todo, there is a tracking issue for that: #17242. Feel free to add a comment there if you want to suggest a topic to be included in the docs. |
ESLint version
v8.32.0
What problem do you want to solve?
We accepted RFC29 to make options available to processors. #12068 began the implementation, but it was never finished.
We discussed this in the 2023-01-12 TSC meeting as a solution to eslint/eslint-plugin-markdown#208 , and I'm opening this issue to track the implementation of the RFC.
What do you think is the correct solution?
RFC29 was written before flat config so only addressed how we'd do processor options in
.eslintrc
files. A new PR should adapt that approach for use with flat config.Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: