-
Notifications
You must be signed in to change notification settings - Fork 100
[Feature] Add ban rule converter #316
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] Add ban rule converter #316
Conversation
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.
It's impressive that you've started work on this rule; it looks pretty complex 😄.
bannedObjMethod.push({ | ||
property: rule, | ||
}); |
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 think this'll need some work. TSLint's ban
rule bans both globals and properties. ESLint splits those between no-restricted-globals
and no-restricted-properties
.
For example, this TSLint configuration:
{
"rules": {
"ban": [
true,
"eval",
]
}
}
...is, from my understanding, equivalent to this ESLint configuration:
{
"rules": {
"no-restricted-globals": [
"error",
"eval"
]
}
}
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 am confused as the roadmap states that it should be only the no-restricted-properties
rule. ESLint rule
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.
@KingDarBoja perhaps the roadmap is incorrect?
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.
Could be outdated but should be good if someone check that.
Link to the roadmap.md where this rule is listed. |
@JoshuaKGoldberg should be good if you take a look at this first. |
Asking around for the docs clarification: |
Is that PR related? It seems like a fix at the readme for another rule rather than a question 🙈 |
Oh sure, I thought you meant you'd like to wait for that clarification before continuing. Do you still want to work on this in the interim? If so, bumping the request in the review that output rules should correctly use |
@JoshuaKGoldberg I do rather wait for the clarification but once again, it seems you linked the wrong PR/issue 😆 It should be this one -> typescript-eslint/typescript-eslint#1817 |
Today is not my day 🤦♂ 😄 |
Ok, yes, it was just an oversight. We're good to go! |
If that's the case, then it is harder to know which one is a global or a property, unless we rely on something like checking if it's a function or if it's a property 🤔 @JoshuaKGoldberg |
I will close this one as I need to rethink how to tackle this rule to properly check when it is a function or a property. In the worst case, just put an notice to let user know that this rule must be set manually. |
PR Checklist
status: accepting prs
Overview
Add ban rule converter. Still need to fix the test suite but would like some feedback first.