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: naming-convention for requiresQuotes #56

Closed
wants to merge 2 commits into from

Conversation

gutenye
Copy link

@gutenye gutenye commented May 7, 2022

As the documentation said, filter has a higher priority than modifiers

Before this PR, requiresQuotes rule never got matched

{
  selector: ['variable', 'function', 'classProperty', 'objectLiteralProperty', 'parameterProperty', 'classMethod', 'objectLiteralMethod', 'typeMethod', 'accessor'],
  ...
  filter: { regex: '[- ]', match: false}
}
// below rule never got matched.
{
  selector: ['classProperty', 'objectLiteralProperty'],
  format: null,
  modifiers: ['requiresQuotes'],
}

Or can remove filter: { regex: '[- ]', match: false }, it's used by lots of selectors, so I'm not sure.

Test Plain

const obj = {
  '.Button': {} // PASSED
  a_b: {}   // FAILED
}

@gutenye gutenye changed the title fix: naming-convention for quoted classProperty and objectLiteralPropetry fix: naming-convention for requiresQuotes May 7, 2022
@@ -60,6 +60,16 @@ const getNamingConventionRule = ({isTsx}) => ({
'StrictPascalCase'
]
},
{
selector: ['classProperty', 'objectLiteralProperty'],
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a quick code comment about why this is not together with the others on line 10?

@sindresorhus
Copy link
Member

sindresorhus commented May 9, 2022

I wonder how this will work if #54 is merged first.

@gutenye
Copy link
Author

gutenye commented May 9, 2022

#54 does what I need, closing this one.

@gutenye gutenye closed this May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants