šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
DemoInstallSign in
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
Version published
Weekly downloads
128
204.76%
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