Skip to content

Commit

Permalink
Make sure isStandardSyntaxDeclaration doesn't ignore CSS-in-JS when n…
Browse files Browse the repository at this point in the history
…ot necessary
  • Loading branch information
hudochenkov committed Jan 5, 2023
1 parent 6f14af5 commit 0f98378
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
29 changes: 4 additions & 25 deletions lib/rules/property-no-unknown/__tests__/index.js
Expand Up @@ -285,31 +285,21 @@ testRule({
});

testRule({
skip: true,
ruleName,
config: [true],
customSyntax: 'postcss-css-in-js',
customSyntax: 'postcss-styled-syntax',

accept: [
{
code: "import styled from 'styled-components';\nexport default styled.div` ${/* sc-prop */ something}: papayawhip; `;",
code: "import styled from 'styled-components';\nexport default styled.div`${something}: papayawhip; `;",
},
{
code: "import styled from 'styled-components';\nexport default styled.div` margin-${/* sc-custom 'left' */ rtlSwitch}: 12.5px; `;",
only: true,
code: "import styled from 'styled-components';\nexport default styled.div`margin-${rtlSwitch}: 12px;`;",
},
{
code: 'const Component = styled.a`\n\t${rule}: 1;\n`',
},
{
code: `
import glm from 'glamorous';
const Component = glm.a({
overflowX: 'auto',
overflowWrap: 'auto',
flexDirection: 'row',
});
`,
},
],

reject: [
Expand All @@ -331,17 +321,6 @@ testRule({
line: 2,
column: 2,
},
{
code: `
import glm from 'glamorous';
const Component = glm.a({
overflwX: 'auto',
});
`,
message: messages.rejected('overflw-x'),
line: 4,
column: 12,
},
],
});

Expand Down
4 changes: 4 additions & 0 deletions lib/utils/isStandardSyntaxDeclaration.js
Expand Up @@ -7,6 +7,10 @@ const { isRoot, isRule } = require('./typeGuards');
* @param {string} [lang]
*/
function isStandardSyntaxLang(lang) {
if (!lang) {
return true;
}

return lang && (lang === 'css' || lang === 'custom-template' || lang === 'template-literal');
}

Expand Down

0 comments on commit 0f98378

Please sign in to comment.