- lang and html-has-lang appear to be identical. i thus removed lang. make sure rule isn't somehow different. also, checking if lang valid is not working (i.e.,t lang="foo")
- aria props error fires twice
- autocomplete-valid (can't get this to fire.add rule/file when ready)
- label-has-associated-control (fires when it shouldn't):
function Foo(props) {
const {
htmlFor,
...otherProps
} = props;
return <label htmlFor={htmlFor} {...otherProps} />
}
<label>
<input type="text" />
Surname
</label>
-
in label-has associated control, this fails but shouldn't const Func = () => ( <> </> );
-
attrs and props with using children directly like in anchor-has-content, e.g. attrs: {children: () => }
-
media-has-caption with attrs (child element is track)
-
non styled Component inputs to Styled (like, Link. currently just disregard but maybe there is a way to figure out tag)
- JSXAttribute for attr:
- location is set to entire component. would be better at the attrs obj
- the value for template literals is definitely bullshit. need to evaluate the tree to figure out how to handle
- need a way to make sure plugin doesnt crash eslint regardless of parsing difficulties
- need to set tests to handle more varietes of keys/values, specifically should have at least handle everything surrounded by all types of string quotes
- add optional params to change the name from styled
- alt-text
- alt-text has a bunch of false positives commented out as well as the below which does not cause an error
// TODO this one does not work because of the template string evaluation
// <img {...props} alt={
${undefined}
} /> // Has no value const imgPropsSpreadUndefinedAltTemplate = makeStyledTestCases({ attrs: '{ ...props, alt:${undefined}
}', props: ' {...props} alt={${undefined}
} ', tag: 'img', errors: [altValueError('img')], });
- alt-text has a bunch of false positives commented out as well as the below which does not cause an error
// TODO this one does not work because of the template string evaluation
// <img {...props} alt={
- click-events-have-jey-events
- scope
- tabindex-no-positive
I've been working on an eslint plugin to solve this issue in my spare time.You can use it now if you clone the repo, but I want to make it more robust/add more tests before releasing it on npm to make sure it's solid enough for production use. If anyone is interested in helping out to expedite the process, here is the repo: https://github.com/brendanmorrell/eslint-plugin-jsx-a11y-styled-components
It handles all 4 methods styled components uses to create components. All of these would show the error Visible, non-interactive elements with click handlers must have at least one keyboard listener.
- const Div = styled.div``; <Div onClick={() => null}/>.
- const Div = styled.div.attrs({ onClick: () => null})``; <Div />
- const StyledDiv = styled(Div)``; <StyledDiv onClick{() => null} />
- const ButtonAsDiv = styled.button``; <ButtonAsDiv as="div" onClick={() => null} />