Skip to content

[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

Closed
wants to merge 1 commit into from
Closed

[Feature] Add ban rule converter #316

wants to merge 1 commit into from

Conversation

KingDarBoja
Copy link
Collaborator

PR Checklist

Overview

Add ban rule converter. Still need to fix the test suite but would like some feedback first.

@KingDarBoja KingDarBoja changed the title Add ban rule converter [Feature] Add ban rule converter Jan 24, 2020
@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for reviewer Waiting for a maintainer to review label Jan 24, 2020
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a 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 😄.

Comment on lines +15 to +17
bannedObjMethod.push({
property: rule,
});
Copy link
Member

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"
        ]
    }
}

Copy link
Collaborator Author

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

Copy link
Member

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?

Copy link
Collaborator Author

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.

@JoshuaKGoldberg JoshuaKGoldberg added status: waiting for author The PR author should address requested changes status: waiting for reviewer Waiting for a maintainer to review and removed status: waiting for reviewer Waiting for a maintainer to review status: waiting for author The PR author should address requested changes labels Jan 25, 2020
@JoshuaKGoldberg JoshuaKGoldberg added status: waiting for author The PR author should address requested changes and removed status: waiting for reviewer Waiting for a maintainer to review labels Feb 11, 2020
@KingDarBoja
Copy link
Collaborator Author

Link to the roadmap.md where this rule is listed.

@KingDarBoja
Copy link
Collaborator Author

Link to the roadmap.md where this rule is listed.

@JoshuaKGoldberg should be good if you take a look at this first.

@JoshuaKGoldberg JoshuaKGoldberg added status: waiting for reviewer Waiting for a maintainer to review and removed status: waiting for author The PR author should address requested changes labels Mar 26, 2020
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Mar 28, 2020

Asking around for the docs clarification: typescript-eslint/typescript-eslint#1816
typescript-eslint/typescript-eslint#1817

@JoshuaKGoldberg JoshuaKGoldberg added status: blocked We can't make progress on this issue until something else is resolved... and removed status: waiting for reviewer Waiting for a maintainer to review labels Mar 28, 2020
@KingDarBoja
Copy link
Collaborator Author

Asking around for the docs clarification: typescript-eslint/typescript-eslint#1816

Is that PR related? It seems like a fix at the readme for another rule rather than a question 🙈

@JoshuaKGoldberg
Copy link
Member

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 no-restricted-globals and/or no-restricted-properties.

@JoshuaKGoldberg JoshuaKGoldberg added status: waiting for author The PR author should address requested changes and removed status: blocked We can't make progress on this issue until something else is resolved... labels Mar 28, 2020
@KingDarBoja
Copy link
Collaborator Author

KingDarBoja commented Mar 28, 2020

@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

@JoshuaKGoldberg
Copy link
Member

Today is not my day 🤦‍♂ 😄

@JoshuaKGoldberg JoshuaKGoldberg added status: blocked We can't make progress on this issue until something else is resolved... and removed status: waiting for author The PR author should address requested changes labels Mar 28, 2020
@JoshuaKGoldberg JoshuaKGoldberg added status: waiting for author The PR author should address requested changes and removed status: blocked We can't make progress on this issue until something else is resolved... labels Apr 14, 2020
@JoshuaKGoldberg
Copy link
Member

Ok, yes, it was just an oversight. We're good to go!

@KingDarBoja
Copy link
Collaborator Author

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

@KingDarBoja
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for author The PR author should address requested changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants