Skip to content

Commit f615f9a

Browse files
committed
Deprecate prefer-classlist and set to off in recommended configs.
1 parent 8372d35 commit f615f9a

File tree

4 files changed

+27
-28
lines changed

4 files changed

+27
-28
lines changed

README.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -119,27 +119,25 @@ const [editedValue, setEditedValue] = createSignal(props.value);
119119
🔧: Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems)/IDE auto-fix.
120120

121121
<!-- AUTO-GENERATED-CONTENT:START (RULES) -->
122-
123-
|| 🔧 | Rule | Description |
124-
| :-: | :-: | :--------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
125-
|| 🔧 | [solid/components-return-once](docs/components-return-once.md) | Disallow early returns in components. Solid components only run once, and so conditionals should be inside JSX. |
126-
|| 🔧 | [solid/event-handlers](docs/event-handlers.md) | Enforce naming DOM element event handlers consistently and prevent Solid's analysis from misunderstanding whether a prop should be an event handler. |
127-
|| 🔧 | [solid/imports](docs/imports.md) | Enforce consistent imports from "solid-js", "solid-js/web", and "solid-js/store". |
128-
|| | [solid/jsx-no-duplicate-props](docs/jsx-no-duplicate-props.md) | Disallow passing the same prop twice in JSX. |
129-
|| | [solid/jsx-no-script-url](docs/jsx-no-script-url.md) | Disallow javascript: URLs. |
130-
|| 🔧 | [solid/jsx-no-undef](docs/jsx-no-undef.md) | Disallow references to undefined variables in JSX. Handles custom directives. |
131-
|| | [solid/jsx-uses-vars](docs/jsx-uses-vars.md) | Prevent variables used in JSX from being marked as unused. |
132-
|| 🔧 | [solid/no-destructure](docs/no-destructure.md) | Disallow destructuring props. In Solid, props must be used with property accesses (`props.foo`) to preserve reactivity. This rule only tracks destructuring in the parameter list. |
133-
|| 🔧 | [solid/no-innerhtml](docs/no-innerhtml.md) | Disallow usage of the innerHTML attribute, which can often lead to security vulnerabilities. |
134-
|| 🔧 | [solid/no-react-specific-props](docs/no-react-specific-props.md) | Disallow usage of React-specific `className`/`htmlFor` props, which were deprecated in v1.4.0. |
135-
|| | [solid/no-unknown-namespaces](docs/no-unknown-namespaces.md) | Enforce using only Solid-specific namespaced attribute names (i.e. `'on:'` in `<div on:click={...} />`). |
136-
|| 🔧 | [solid/prefer-classlist](docs/prefer-classlist.md) | Enforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object `{ [class: string]: boolean }` just like classnames. |
137-
|| 🔧 | [solid/prefer-for](docs/prefer-for.md) | Enforce using Solid's `<For />` component for mapping an array to JSX elements. |
138-
|| 🔧 | [solid/prefer-show](docs/prefer-show.md) | Enforce using Solid's `<Show />` component for conditionally showing content. Solid's compiler covers this case, so it's a stylistic rule only. |
139-
|| | [solid/reactivity](docs/reactivity.md) | Enforce that reactive expressions (props, signals, memos, etc.) are only used in tracked scopes; otherwise, they won't update the view as expected. |
140-
|| 🔧 | [solid/self-closing-comp](docs/self-closing-comp.md) | Disallow extra closing tags for components without children. |
141-
|| 🔧 | [solid/style-prop](docs/style-prop.md) | Require CSS properties in the `style` prop to be valid and kebab-cased (ex. 'font-size'), not camel-cased (ex. 'fontSize') like in React, and that property values with dimensions are strings, not numbers with implicit 'px' units. |
142-
122+
|| 🔧 | Rule | Description |
123+
| :---: | :---: | :--- | :--- |
124+
|| 🔧 | [solid/components-return-once](docs/components-return-once.md) | Disallow early returns in components. Solid components only run once, and so conditionals should be inside JSX. |
125+
|| 🔧 | [solid/event-handlers](docs/event-handlers.md) | Enforce naming DOM element event handlers consistently and prevent Solid's analysis from misunderstanding whether a prop should be an event handler. |
126+
|| 🔧 | [solid/imports](docs/imports.md) | Enforce consistent imports from "solid-js", "solid-js/web", and "solid-js/store". |
127+
|| | [solid/jsx-no-duplicate-props](docs/jsx-no-duplicate-props.md) | Disallow passing the same prop twice in JSX. |
128+
|| | [solid/jsx-no-script-url](docs/jsx-no-script-url.md) | Disallow javascript: URLs. |
129+
|| 🔧 | [solid/jsx-no-undef](docs/jsx-no-undef.md) | Disallow references to undefined variables in JSX. Handles custom directives. |
130+
|| | [solid/jsx-uses-vars](docs/jsx-uses-vars.md) | Prevent variables used in JSX from being marked as unused. |
131+
|| 🔧 | [solid/no-destructure](docs/no-destructure.md) | Disallow destructuring props. In Solid, props must be used with property accesses (`props.foo`) to preserve reactivity. This rule only tracks destructuring in the parameter list. |
132+
|| 🔧 | [solid/no-innerhtml](docs/no-innerhtml.md) | Disallow usage of the innerHTML attribute, which can often lead to security vulnerabilities. |
133+
|| 🔧 | [solid/no-react-specific-props](docs/no-react-specific-props.md) | Disallow usage of React-specific `className`/`htmlFor` props, which were deprecated in v1.4.0. |
134+
|| | [solid/no-unknown-namespaces](docs/no-unknown-namespaces.md) | Enforce using only Solid-specific namespaced attribute names (i.e. `'on:'` in `<div on:click={...} />`). |
135+
|| 🔧 | [solid/prefer-classlist](docs/prefer-classlist.md) | Enforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object `{ [class: string]: boolean }` just like classnames. |
136+
|| 🔧 | [solid/prefer-for](docs/prefer-for.md) | Enforce using Solid's `<For />` component for mapping an array to JSX elements. |
137+
|| 🔧 | [solid/prefer-show](docs/prefer-show.md) | Enforce using Solid's `<Show />` component for conditionally showing content. Solid's compiler covers this case, so it's a stylistic rule only. |
138+
|| | [solid/reactivity](docs/reactivity.md) | Enforce that reactive expressions (props, signals, memos, etc.) are only used in tracked scopes; otherwise, they won't update the view as expected. |
139+
|| 🔧 | [solid/self-closing-comp](docs/self-closing-comp.md) | Disallow extra closing tags for components without children. |
140+
|| 🔧 | [solid/style-prop](docs/style-prop.md) | Require CSS properties in the `style` prop to be valid and kebab-cased (ex. 'font-size'), not camel-cased (ex. 'fontSize') like in React, and that property values with dimensions are strings, not numbers with implicit 'px' units. |
143141
<!-- AUTO-GENERATED-CONTENT:END -->
144142

145143
## Versioning
@@ -149,10 +147,8 @@ stable across patch (`0.0.x`) versions, but may change across minor (`0.x`) vers
149147
If you want to pin a minor version, use a tilde in your `package.json`.
150148

151149
<!-- AUTO-GENERATED-CONTENT:START (TILDE) -->
152-
153150
```diff
154151
- "eslint-plugin-solid": "^0.7.4"
155152
+ "eslint-plugin-solid": "~0.7.4"
156153
```
157-
158154
<!-- AUTO-GENERATED-CONTENT:END -->

docs/prefer-classlist.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- AUTO-GENERATED-CONTENT:START (HEADER) -->
22
# solid/prefer-classlist
33
Enforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object `{ [class: string]: boolean }` just like classnames.
4-
This rule is **a warning** by default.
4+
This rule is **off** by default.
55

66
[View source](../src/rules/prefer-classlist.ts) · [View tests](../test/rules/prefer-classlist.test.ts)
77

@@ -14,7 +14,7 @@ Options shown here are the defaults. Manually configuring an array will *replace
1414

1515
```js
1616
{
17-
"solid/prefer-classlist": ["warn", {
17+
"solid/prefer-classlist": ["off", {
1818
// An array of names to treat as `classnames` functions
1919
classnames: ["cn","clsx","classnames"], // Array<string>
2020
}]

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ const plugin = {
7575
"solid/imports": 1,
7676
"solid/style-prop": 1,
7777
"solid/no-react-specific-props": 1,
78-
"solid/prefer-classlist": 1,
7978
"solid/self-closing-comp": 1,
8079
// handled by Solid compiler, opt-in style suggestion
8180
"solid/prefer-show": 0,
81+
// deprecated
82+
"solid/prefer-classlist": 0,
8283
},
8384
},
8485
typescript: {
@@ -105,12 +106,13 @@ const plugin = {
105106
"solid/imports": 1,
106107
"solid/style-prop": 1,
107108
"solid/no-react-specific-props": 1,
108-
"solid/prefer-classlist": 1,
109109
"solid/self-closing-comp": 1,
110110
// namespaces taken care of by TS
111111
"solid/no-unknown-namespaces": 0,
112112
// handled by Solid compiler, opt-in style suggestion
113113
"solid/prefer-show": 0,
114+
// deprecated
115+
"solid/prefer-classlist": 0,
114116
},
115117
},
116118
},

src/rules/prefer-classlist.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const rule: TSESLint.RuleModule<"preferClasslist", [{ classnames?: [string, ...A
66
meta: {
77
type: "problem",
88
docs: {
9-
recommended: "warn",
9+
recommended: false,
1010
description:
1111
"Enforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object `{ [class: string]: boolean }` just like classnames.",
1212
url: "https://github.com/solidjs-community/eslint-plugin-solid/blob/main/docs/prefer-classlist.md",
@@ -34,6 +34,7 @@ const rule: TSESLint.RuleModule<"preferClasslist", [{ classnames?: [string, ...A
3434
preferClasslist:
3535
"The classlist prop should be used instead of {{ classnames }} to efficiently set classes based on an object.",
3636
},
37+
deprecated: true,
3738
},
3839
create(context) {
3940
const classnames = context.options[0]?.classnames ?? ["cn", "clsx", "classnames"];

0 commit comments

Comments
 (0)