43081j / 43081j/eslint-plugin-lit
Extend invalid escape sequences rule to other tagged template literals
- Dominant language
- TypeScript
- Stars
- 138
- Forks
- 26
- Avg merge
- 23h 29m
- Merged PRs (30d)
- 4
Description
Template literals used as values for the `css` and `svg` tag functions are vulnerable to the same issues with invalid escape sequences as the `html` tag function.
For example the following code leads to an empty CSS result with no error or warning to indicate what's gone wrong:
```typescript
const styles = css`
p::before {
content: "\2716";
}
`;
```
I'd be in favour of expanding the `no-invalid-escape-sequences` rule to cover these other kinds of template literals.
Happy to do a PR for this with docs changes if that's helpful.
Contributor guide
No contributing guide indexed for this repository
Research direction
Look at the existing `no-invalid-escape-sequences` rule implementation for the `html` tag. Extend it to also detect `css` and `svg` tagged template literals. Check the rule's test files to understand the expected behavior and add new test cases for the new tags. Run the existing tests to ensure the changes don't break anything.
Written by the indexing model from the issue text.
Assessment
- Domain
- devtools, testing-qa
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100