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

write a config for components with similar rules #51

Open
aubreyquinn opened this issue Mar 5, 2024 · 5 comments
Open

write a config for components with similar rules #51

aubreyquinn opened this issue Mar 5, 2024 · 5 comments
Assignees

Comments

@aubreyquinn
Copy link
Collaborator

aubreyquinn commented Mar 5, 2024

Many components share the same accessibility rules such as TextArea and Input. It would be great to make a config like an array and to have the rules generic and could be applied to the list of component names in the config file. e.g. https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/rules/alt-text.js ```
const DEFAULT_ELEMENTS = [
'img',
'object',
'area',
'input[type="image"]',
];

Would be better if this config was user-configurable because of component name changes. E.g. in their eslintrc file:     ```
"@microsoft/fluentui-jsx-a11y/image-button-missing-aria-v9": ["error", coverComponents:             : [
              'button',
              'checkbox',
              'link',
              'searchbox',
              'spinbutton',
              'switch',
              'textbox',
            ],] 
@aubreyquinn aubreyquinn changed the title write a config for component with similar rules write a config for components with similar rules Mar 5, 2024
@UniqueClone UniqueClone self-assigned this Sep 16, 2024
@UniqueClone
Copy link
Collaborator

To clarify, this allows a user to say, I want rule X to also apply to A, B, and C components. Is this correct @aubreyquinn ?

@aubreyquinn
Copy link
Collaborator Author

Yep :)

@aubreyquinn
Copy link
Collaborator Author

I also wonder if this will cover aliasing. e.g.

import { Button as ImageButton } from "@fluent"

We will want the user to be able to specify alternatives for component names.

@UniqueClone
Copy link
Collaborator

I also wonder if this will cover aliasing. e.g.

import { Button as ImageButton } from "@fluent"

We will want the user to be able to specify alternatives for component names.

I think this will be complicated but definitely worth a try. I'll see if I can get in-file aliasing working but if they alias in one place and import the alias in a second place I don't think we'll be able to catch that.

e.g.

import { Button as ImageButton } from "fluent"

export Button;

and then another file imports Button from that file

@aubreyquinn
Copy link
Collaborator Author

aubreyquinn commented Sep 16, 2024 via email

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

No branches or pull requests

2 participants