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

@compiled/eslint-plugin

Package Overview
Dependencies
Maintainers
0
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@compiled/eslint-plugin

A familiar and performant compile time CSS-in-JS library for React.

  • 0.19.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
107
increased by62.12%
Maintainers
0
Weekly downloads
 
Created
Source

@compiled/eslint-plugin

This plugin contains rules that should be used when working with @compiled/react.

Installation

npm install @compiled/eslint-plugin --save-dev

Usage

Flat Config

Import the @compiled/eslint-plugin and add it to your plugins like so, then configure the rules you want to use under the "Supported rules" section.

import compiled from '@compiled/eslint-plugin';

export default [
  {
    plugins: {
      '@compiled': compiled,
    },
    rules: {
      '@compiled/no-js-xcss': 'error',
    },
  },
];

You can also enable the recommended rules for compiled by extending the flat/recommended config like so:

import compiled from '@compiled/eslint-plugin';

export default [compiled.configs['flat/recommended']];

Legacy Config (.eslintrc)

Add @compiled to the plugins section of your .eslintrc configuration file, then configure the rules you want to use under the rules section.

{
  "plugins": ["@compiled"],
  "rules": {
    "@compiled/no-js-xcss": "error"
  }
}

You can also enable the recommended rules for compiled by adding plugin:@compiled/recommended in extends:

{
+  "extends": ["plugin:@compiled/recommended"],
-  "plugins": ["@compiled"]
}

Supported rules

✅ Included in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.\

NameDescriptionRecommendedFixable
@compiled/jsx-pragmaEnforces a jsx pragma when using the css prop🔧
@compiled/local-cx-xcssEnsures the cx() function is only used within the xcss prop
@compiled/no-css-prop-without-css-functionDisallows css prop usages where it is either not wrapped in the css import from @compiled/react or where @compiled cannot determine whether the css import is included at build time.🔧
@compiled/no-css-tagged-template-expressionDisallows the css tagged template expression🔧
@compiled/no-emotion-cssDisallows @emotion usages🔧
@compiled/no-empty-styled-expressionDisallows any styled expression to be used when passing empty arguments in @compiled/react
@compiled/no-exported-cssDisallows css usages from being exported
@compiled/no-exported-keyframesDisallows keyframes usages from being exported
@compiled/no-invalid-css-mapChecks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking.
@compiled/no-js-xcssThe xcss prop is predicated on adhering to the type contract. Using it without TypeScript breaks this contract and thus is not allowed.
@compiled/no-keyframes-tagged-template-expressionDisallows the keyframes tagged template expression🔧
@compiled/no-styled-tagged-template-expressionDisallows the styled tagged template expression🔧
@compiled/no-suppress-xcssThe xcss prop is predicated on adhering to the type contract. Supressing it breaks this contract and thus is not allowed.
@compiled/shorthand-property-sortingPrevent unwanted side-effects by ensuring shorthand properties are always defined before their corresponding longhand properties.

FAQs

Package last updated on 08 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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