@compiled/eslint-plugin
Advanced tools
Comparing version
@@ -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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
399237
0.27%9599
0.31%