Skip to content

Commit

Permalink
Add html and svg
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Mar 10, 2020
1 parent ae4c5fa commit 6afe4fc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
4 changes: 3 additions & 1 deletion rules/string-content.js
Expand Up @@ -9,7 +9,9 @@ const defaultPatterns = {
};

const ignoredIdentifier = new Set([
'gql'
'gql',
'html',
'svg'
]);

const ignoredMemberExpressionObject = new Set([
Expand Down
23 changes: 20 additions & 3 deletions test/string-content.js
Expand Up @@ -43,8 +43,26 @@ ruleTester.run('string-content', rule, {
// Should not escape
'const foo = `\\`\\${1}`',
// Ignored
'const foo = gql`\'`',
'const foo = styled.div`\'`'
`
const foo = gql\`{
field(input: '...')
}\`;
`,
`
const foo = styled.div\`
background: url('...')
\`;
`,
`
const foo = html\`
<div class='test'>...</div>
\`;
`,
`
const foo = svg\`
<svg xmlns="http://www.w3.org/2000/svg"><path fill='#00CD9F'/></svg>
\`;
`
/* eslint-enable no-template-curly-in-string */
],
invalid: [
Expand Down Expand Up @@ -208,7 +226,6 @@ ruleTester.run('string-content', rule, {
output: 'const foo = notIgnoredTag`’`',
errors: createError('\'', '’')
}

/* eslint-enable no-template-curly-in-string */
]
});

0 comments on commit 6afe4fc

Please sign in to comment.