Registry / testing / eslint-plugin-clsx

eslint-plugin-clsx

JSON →
library0.1.0jsnpmunverified

ESLint plugin for clsx/classnames utility libraries providing 8 rules to enforce best practices and reduce redundant code. Current stable version 0.0.12 (0.1.0 available), active maintenance with regular releases. Supports ESLint 8, 9, and 10. Ships TypeScript types. Differentiators: auto-fixable rules, recommended and all presets, flat config support, settings for custom import names.

npm install eslint-plugin-clsx
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-CLSX
E
eslint-plugin-clsx
testingjavascriptv0.1.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import clsx from 'eslint-plugin-clsx'
✗ const clsx = require('eslint-plugin-clsx')
Default import is the plugin object. CJS require works but may lack type definitions.
configs.flat.recommended
✓ clsx.configs.flat.recommended
✗ clsx.configs.recommended
Use flat configs for ESLint 9+. Legacy configs available via plugin:clsx/recommended.
rules
✓ import { rules } from 'eslint-plugin-clsx'
✗ const rules = require('eslint-plugin-clsx').rules
Named export for accessing individual rule definitions.

Enable recommended rules with specific overrides in flat config format for ESLint 9+.

import clsx from 'eslint-plugin-clsx'; import { defineConfig } from 'eslint/config'; export default defineConfig({ plugins: { clsx }, rules: { 'clsx/no-redundant-clsx': 'error', 'clsx/forbid-array-expressions': 'warn', 'clsx/forbid-false-inside-object-expressions': 'warn', 'clsx/forbid-true-inside-object-expressions': 'warn', 'clsx/no-spreading': 'warn', 'clsx/prefer-merged-neighboring-elements': 'warn' } }); // Also works with flat config preset: // export default defineConfig(clsx.configs.flat.recommended);
Debug
Known issues
breakingv0.0.2 switched to TypeScript - existing CJS require may need update
fix
Update to >=0.0.2 and use TypeScript or ensure CJS compatibility
affects: <0.0.2
breakingv0.0.7 cleanup published files - may break import paths if using deep imports
fix
Use only top-level imports from 'eslint-plugin-clsx'
affects: <0.0.7
breakingv0.0.12 disallow extra properties in rule options - custom options may become invalid
fix
Stick to documented options schema
affects: <0.0.12
gotchaRequires ESLint 8, 9, or 10 as peer dependency - not compatible with other versions
fix
Install supported ESLint version
affects: *
deprecatedLegacy .eslintrc configs still work but flat configs are preferred for ESLint 9+
fix
Migrate to flat config using clsx.configs.flat.recommended
affects: >=0.0.11
Errors
Common errors & fixes
Error: Failed to load plugin 'clsx': Cannot find module 'eslint-plugin-clsx'
Missing installation or incorrect module resolution
fix
npm install eslint-plugin-clsx --save-dev
TypeError: Cannot read properties of undefined (reading 'recommended')
Attempting to access configs without proper import in flat config
fix
Use: import clsx from 'eslint-plugin-clsx'; then clsx.configs.flat.recommended
Configuration for rule 'clsx/no-redundant-clsx' is invalid: severity must be 'off', 'warn', or 'error'.
Invalid severity level in rule configuration
fix
Set rule to 'off', 'warn', or 'error' (not boolean or string like 'true')
ESLint configuration in .eslintrc.json is invalid: "extends": ["plugin:clsx/recommended"] is not a valid configuration.
Using legacy config syntax with ESLint 9+ flat config only project
fix
Switch to flat config format or ensure ESLint 8 compatibility
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required to run
Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-clsx — npm install eslint-plugin-clsx · libregistry