Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@compiled/eslint-plugin

Package Overview
Dependencies
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@compiled/eslint-plugin - npm Package Compare versions

Comparing version 0.13.3 to 0.13.4

8

dist/rules/no-empty-styled-expression/index.js

@@ -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;

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc