@compiled/eslint-plugin
Advanced tools
Comparing version 0.13.3 to 0.13.4
@@ -20,4 +20,10 @@ "use strict"; | ||
'CallExpression[callee.type="MemberExpression"]': (node) => { | ||
const membEx = node.callee; | ||
const { references } = context.getScope(); | ||
const isStyledImported = references.some((reference) => { var _a; return (_a = reference.resolved) === null || _a === void 0 ? void 0 : _a.defs.some(styled_import_1.isStyledImportSpecifier); }); | ||
const isStyledImported = membEx.object.type === 'Identifier' && | ||
references.some((reference) => { | ||
var _a; | ||
return reference.identifier === membEx.object && | ||
((_a = reference.resolved) === null || _a === void 0 ? void 0 : _a.defs.some(styled_import_1.isStyledImportSpecifier)); | ||
}); | ||
if (!isStyledImported || !isEmptyStyledExpression(node)) { | ||
@@ -24,0 +30,0 @@ return; |
{ | ||
"name": "@compiled/eslint-plugin", | ||
"version": "0.13.3", | ||
"version": "0.13.4", | ||
"description": "A familiar and performant compile time CSS-in-JS library for React.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://compiledcssinjs.com/docs/pkg-eslint-plugin", |
@@ -48,2 +48,25 @@ import type { RuleTester } from 'eslint'; | ||
`, | ||
` | ||
import { styled } from '@compiled/react'; | ||
const HeaderTitle = styled.h1<any>\` | ||
\${typography.h500()}\` | ||
`, | ||
` | ||
import { styled } from '@compiled/react'; | ||
const HeaderTitle = styled.h1<any>\` | ||
\${typography.h500()}; | ||
\${typography.h400()};\` | ||
`, | ||
` | ||
import { styled } from '@compiled/react'; | ||
foo.bar(); | ||
`, | ||
` | ||
import { styled } from '@compiled/react'; | ||
foo(); | ||
`, | ||
], | ||
@@ -50,0 +73,0 @@ invalid: createInvalidTestCases([ |
import type { Rule } from 'eslint'; | ||
import type { CallExpression } from 'estree'; | ||
import type { CallExpression, MemberExpression } from 'estree'; | ||
@@ -27,7 +27,13 @@ import { isStyledImportSpecifier } from '../../utils/styled-import'; | ||
'CallExpression[callee.type="MemberExpression"]': (node: CallExpression) => { | ||
const membEx: MemberExpression = node.callee as MemberExpression; | ||
const { references } = context.getScope(); | ||
const isStyledImported = references.some((reference) => | ||
reference.resolved?.defs.some(isStyledImportSpecifier) | ||
); | ||
const isStyledImported = | ||
membEx.object.type === 'Identifier' && | ||
references.some( | ||
(reference) => | ||
reference.identifier === membEx.object && | ||
reference.resolved?.defs.some(isStyledImportSpecifier) | ||
); | ||
if (!isStyledImported || !isEmptyStyledExpression(node)) { | ||
@@ -34,0 +40,0 @@ return; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
399237
9599