-
-
Notifications
You must be signed in to change notification settings - Fork 928
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
POC for #7784 #7786
base: main
Are you sure you want to change the base?
POC for #7784 #7786
Conversation
|
types/stylelint/index.d.ts
Outdated
range?: Range; | ||
fixed: boolean; | ||
}; | ||
type FixerData = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ybiquitous @romainmenke
Once you have read OP, can you tell me if this type and Fix
correspond to everything we laid out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we spend a bit more time in design phase before creating a POC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The POC is there to help the design phase going forward.
We have a concrete example that we can use to iterate further.
Apart from the name and where editInfo
should be set/passed, every demand you laid out should be fulfilled.
Can you at least review the index.d.ts and give me your feedback?
This PR is not meant to be merged as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally do not feel that code review is the most efficient way to design architectural changes like these. This is too taxing for me. Maybe someone else has an easier time to do design work as code review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ill just copy paste the types in the issue then.
For me, at least, it would seem way easier to comprehend with the help of a concrete example.
Ill leave the PR open so that @ybiquitous can give his feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alpha.value = fixed; | ||
setDeclarationValue(decl, parsedValue.toString()); | ||
|
||
/** @type {Problem['fix']} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you pass fix
directly to report
, with the proposal 3, you will have to add the type for every const fix
declarations. That's a big CON but not a blocker.
/** @type {Problem['fix']} */ | ||
const fix = (apply) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questions
minor
@romainmenke @ybiquitous
I find it annoying that you have to add the type for every single const fix
declaration.
Can it be avoided?
Maybe having to set the @param
to {boolean}
for all fixable rules is not such a big deal?
Are we sure we want the default to be apply
?
i.e. it could also be doNotApply
Is this really superior/preferable to returning a function?
e.g.
{
range?: Range;
text: string;
mutate: () => void | never;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it annoying that you have to add the type for every single
const fix
declaration.
Can it be avoided?
Inlining the fix
variable is a way. Otherwise, I think some type annotations are necessary.
For other questions about the function signature, we're discussing it on #7784. Let's continue there.
#7192, #7784
text
range
editInfo
property is optional)fix
to be called (store the data even for the warn path)declaration-block-no-redundant-longhand-properties
)To bikeshed the name.
I chose
editInfo
but I am sure there's something better.ref: https://eslint.org/docs/latest/integrate/nodejs-api#-editinfo-type
To be on the same page before I remove the
range
that are currently returned by the fixers of the rules that have been already refactored.i.e. confirm the type of the
fix
functionto discuss if
editInfo
should be set onfix
or passed directly toreport
or returned byfix
alpha-value-notation