eslint-plugin-clsx
Version:
An ESLint plugin for clsx/classnames
34 lines (19 loc) ⢠1.02 kB
Markdown
# clsx/forbid-false-inside-object-expressions
š Forbid usage of false literal inside object expressions of clsx.
ā ļø This rule _warns_ in the ā
`recommended` [config](https://github.com/temoncher/eslint-plugin-clsx#presets).
š§ This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
<!-- end auto-generated rule header -->
## Rule Details
This rule aims to enforce specific usage of object expressions inside clsx
Examples of **incorrect** code for this rule:
```js
/* eslint clsx/forbid-false-inside-object-expressions: 'error' */
const falseClasses = clsx({ 'dynamic-condition-class': condition, 'false-class': false });
```
Examples of **correct** code for this rule:
```js
/* eslint clsx/forbid-false-inside-object-expressions: 'error' */
const falseClasses = clsx({ 'dynamic-condition-class': condition });
```
## When Not To Use It
If you don't want to enforce specific usage of object expressions inside clsx