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

is-misused-css

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-misused-css

Check if CSS properties applied work as intended.

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

is-misused-css

Check if CSS properties are correctly applied.

Inspired by DevTools, which offers a helpful tooltip now when CSS properties are set, but don't apply to elements. The source-code is taken from the Chromium DevTools repository, so it will show the exactly same information, just as JavaScript API.

Please note: font-variation-settings is currently not checked and can currently only be checked by the DevTools.

Example:

.a {
	display: block;
	align-items: center; /* <-- won't apply, because of 'display: block' => is misused */
}

DevTools:

DevTools shows an tooltip that suggests using something different than display: block

is-misused-css:

Usage

In the browser:

  • Copy is-misused-css.browser.js
  • Run it in a new DevTools snippet, or use a bookmarklet generator
  • Run [...document.querySelectorAll("*")].forEach(el => console.log(el, isMisusedCSS.scan(el)) in your console

With npm/pnpm/yarn:

npm i is-misused-css

import { scan } from 'is-misused-css';

const hints = scan(document.querySelector('#myelement'))
console.log(hints)

Further Ideas

  • Minifier/Critical CSS extractors: Remove properties that do nothing
  • Stylelint: Add a warning/error when there is a CSS prop that does nothing
  • Eslint for JSX/TSX: Add a warning/error for CSS-in-JS
  • Tailwind / Atomic CSS: Lint when classes are used that do not work together

FAQs

Package last updated on 02 Jun 2023

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