Closed roman-petrov closed 2 years ago
@roman-petrov can you please use existing template for new rules proposal (with code examples)?
@incendial , it is hard to describe this new rule in terms of "bad" / "good" code since the most complex part for it is its configuration. However, I tried to update rule proposal using "new rule" template, please take a look.
In 2-3 weeks I plan to provide a PR for it so some feedback from you and maybe other community people would be great.
it is hard to describe this new rule in terms of "bad" / "good" code since the most complex part for it is its configuration. However, I tried to update rule proposal using "new rule" template, please take a look.
I think you did great, thank you! As for feedback, the rule looks solid and definitely useful
Actually, one thing bothers me: what do you think about changing the name a bit? From avoid-restricted
to avoid-banned
?
I just borrowed the word "restricted" from ESLint rule :) So "banned" might be better, not sure, I am not an expert in English. So, in short, I don't mind:)
I'm not an expert either 😄 , but we already have ban-name
, which should be renamed to avoid-banned-names
in the next major and it'd be consistent to have avoid-banned-imports
and avoid-banned-names`, wdyt?
I like consistency, so - yes, in terms of consistency the word "banned" sounds better.
Any plans to implement this? If not I may work on it :)
@roman-petrov @incendial
Ready for review now #868
Any plans to implement this? If not I may work on it :)
@roman-petrov @incendial
Definitely not plan now, you PR seems doing exactly what we need, thank you! 😉 Today I will try to participate in review if you don't mind.
Oh, sorry for the delay, looking into the PR 👀
Available in 4.16.0! 🚀
Please describe what the rule should do:
I propose a rule similar to ESLint no-restricted-imports. There might be many use cases for it. In our project (a design system component library) we need to restrict import from Flutter
material.dart
because we do not use Material Design and must not depend on it anywhere.Without configuration this rule should simply do nothing. I think we need to have a flexible configuration here, the most important for me is to configure rule per file glob pattern.
In nearest future I would like to discuss this rule and also I plan to provide a PR.
If your rule is inspired by other please provide link to it:
no-restricted-imports.
What category of rule is this? (place an "X" next to just one item)
[ ] Warns about a potential error (problem) [x] Suggests an alternate way of doing something (suggestion) [ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about (it will be better if you can provide both good and bad examples):
Just possible rule configuration:
BAD
GOOD
Are you willing to submit a pull request to implement this rule? Yes, in a few weeks.