facebook / facebook/stylex

[eslint-plugin] Confusing error message when a value is disallowed with `null`

Open
#282 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
10.3k
Forks
481
Avg merge
3d 8h
Merged PRs (30d)
13

Description

**The problem**

When disallowing a property with the ESLint plugin, the error message is:

```
{property} value must be one of:
{reason}
```

While not completely incorrect, it's slightly misleading to say `value must be one of:` when there is no valid value.

Without knowing how the rule is defined, it's also possible to confuse the `{reason}` as the possible value.

**How to reproduce**

**ESLint configuration**

![image](https://github.com/facebook/stylex/assets/44372776/658d13cd-d797-4bd1-9576-2355644b7e93)

**Error message**

![image](https://github.com/facebook/stylex/assets/44372776/d422ba03-a5f5-49fe-867f-3c9678d3176b)

**Expected behavior**

I expect the error message to clearly indicate that the property is disallowed.

e.g.

```
Using {property} is not allowed. {reason}
```

**Environment (include versions). Did this work in previous versions?**
```
@stylexjs/eslint-plugin@0.4.1
```

---

It seems like a good first issue, so let me know if you'd like me to tackle it 🫡

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.