Skip to content
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

fix(eslint-plugin): [explicit-member-accessibility] refine report locations #8869

Conversation

kirkwaiblinger
Copy link
Member

@kirkwaiblinger kirkwaiblinger commented Apr 7, 2024

PR Checklist

cc @developer-bandi

Overview

This PR makes it so that for missing accessibility modifiers, we report just the symbol name preceeded by however many keywords (get, abstract, etc)

class A {
   // before
   @foo
   ^^^^
   get x(): string {
^^^^^^^^^^^^^^^^^^^^
   }
^^^^
   // after
   @foo
   get x(): string {
   ^^^^^
   }
}

and for public modifiers that should not be present, we only flag on the public keyword itself

class A {
    // before
    public abstract method(x: string): number;
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    // after
    public abstract method(x: string): number;
    ^^^^^^
}

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @kirkwaiblinger!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 602de2a
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/66346bc010dc4e0008d40e11
😎 Deploy Preview https://deploy-preview-8869--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@kirkwaiblinger kirkwaiblinger marked this pull request as ready for review April 7, 2024 01:57
suggestions: [
{
messageId: 'addExplicitAccessibility',
data: { type: 'public' },
output: `
class Test {
public constructor(public ...x: any[]) {}
public constructor(public x: any[]) {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed this since it's illegal syntax for a parameter property to be a rest element. Though the rule doesn't really care.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i audited every invalid test case and put in the exact report range, since it was very helpful for development to do so. I realize, however, that that may be overkill for testing (and can make modifications to the rule or test cases unnecessarily unwieldy). If requested, I can remove some of the added report locations. But IMO they might as well stay now that they're there

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually we'll have #6994 and we can kill all of the line/col assertions.

@Josh-Cena
Copy link
Member

@kirkwaiblinger If you don't want to auto-close that issue, you have to make sure your description doesn't contain the substring "fixes #xxx". You can say "fixes (partially) #xxx" (I usually do that)

@kirkwaiblinger
Copy link
Member Author

Confused by the CI failure, looking for advice on how to resolve it

@kirkwaiblinger kirkwaiblinger added the enhancement New feature or request label May 4, 2024
@bradzacher bradzacher added bug Something isn't working and removed enhancement New feature or request labels May 28, 2024
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bradzacher bradzacher merged commit c9a8386 into typescript-eslint:main May 28, 2024
59 of 60 checks passed
@kirkwaiblinger kirkwaiblinger deleted the explicit-member-accessibility-report-loc branch May 28, 2024 05:28
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants