-
Notifications
You must be signed in to change notification settings - Fork 17
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
Feature/remove sheriff.config from lint programatically #168
base: main
Are you sure you want to change the base?
Feature/remove sheriff.config from lint programatically #168
Conversation
Quality Gate passedIssues Measures |
With hindsight, if you like this PR, I'd be happy to write more unit tests to cover all possible include/exclude configurations. |
Closing this one as alternative PR, #167 was accepted instead of this one. I'll now start looking into a solution for #165 Thanks @rainerhahnekamp |
@tomwhite007, would it be possible to reopen that one? While I see #167 as a quick fix, the most optimal solution would involve implementing a separate initialization process. I understand this might require a bit more planning, but with this PR, we’d already have a solid working draft to build on. What are your thoughts? |
Quality Gate passedIssues Measures |
Yes, happy to reopen. I'll come back with my thoughts soon. |
Great, maybe we can do some brainstorming here on top of your work. |
Hi Rainer OK, I'd like to understand your perspective a little more, but I'll start making some suggestions. My objective is to provide feedback on any bad configuration in However, I get the feeling you have a more far-reaching goal. Is it that the feedback for bad configuration in the At the moment, You mentioned a separate initialization process. Do either options above fit the bill? Or, how / where do you expect the separate initialization should take place? I’m not precious about the above suggestions. You know your codebase better so point me at a different file, and I’ll start digging if you want me to. |
So I see two issues that need addressing:
Proposed Approach
At the same time, config-related errors that already surface when Sheriff is run against TypeScript files should also show up when linting From a high-level perspective, I don’t think linting the config file needs to go through the same initialization process we use for TypeScript files. However, we’ll need to distinguish between:
At the moment, both are of type |
I had to re-read your comment a few times to absorb.
Regarding your two issues, or requirements:
1. Agreed - sounds like a good idea. We need a lint rule specifically
for sheriff.config.ts, and then we need part of that same process to run
and throw UserError when the other Sheriff rules run to block them when
there is misconfiguration... I propose two stages, a) I build and then
iterate from a new eslint rule for the sheriff.config.ts (including
Blocking and Non-Blocking checks) - with a view to - b) sharing the process
to throw the UserError for Blocking misconfiguration in existing rules.
2. The sheriff.config.ts is already filtered out using the eslint config
in my last PR. I propose that we keep it this way and my PR for point 1
above will clarify why that's easier, given your requirements. The new
eslint rule will have its own eslint config that only includes the
/sheriff.config.ts filepath.
How does that sound?
|
Sorry for that. Sometimes I express my thoughts a little bit too complicated.
Sounds great to me Tom! |
Per your comment, 2nd bullet point: #161 (comment)
This PR adds the ability for rules to have a filename inclusions or exclusions list set inside the
createRule
factory and filters the 'sheriff.config.ts' file from all the existing rules. This allows a future set of rules that can be filename/type-specific.Of my two PRs this is the most testable, but both are written with consideration to solving #165.