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

ESlint naming-convention X tss-react #142

Open
zbouslikhin opened this issue Feb 4, 2023 · 1 comment
Open

ESlint naming-convention X tss-react #142

zbouslikhin opened this issue Feb 4, 2023 · 1 comment

Comments

@zbouslikhin
Copy link

zbouslikhin commented Feb 4, 2023

Hello,

When running ESlint, nested selectors are flagged as problematic. Is there any way to get around that?

image

@garronej
Copy link
Owner

garronej commented Feb 4, 2023

Hi @zbouslikhin,

  1. You can ignore this rule.
    In the package.json if you are in a create-react-app
    image
    Or in .eslintconfig.
  2. I sugest avoiding to target inner MUI components like this. It's not type safe.
    You can use the classes prop instead:
export function SwitchLabels() {

    const { classes, css } = useStyles();

    return (

        <FormGroup>
            <FormControlLabel
                control={
                <Switch 
                    classes={{
                        switchBase: css({ border: "1px solid black" }),
                        thumb: classes.muiSwitchThumb
                    }}
                />
            }
                label="My Switch"
            />
        </FormGroup>
    );
}

PS: Unrelated but it's usefull, you can checkout the eslint plugin for TSS that detects unused classes: https://docs.tss-react.dev/detecting-unused-classes

Hopes it helps.

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