Skip to content

Commit

Permalink
Merge branch 'feature/remove-classlist'
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwilsonvu committed Nov 1, 2022
2 parents 8c871ae + f615f9a commit 197dbb5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/prefer-classlist.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- AUTO-GENERATED-CONTENT:START (HEADER) -->
# solid/prefer-classlist
Enforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object `{ [class: string]: boolean }` just like classnames.
This rule is **a warning** by default.
This rule is **off** by default.

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

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

```js
{
"solid/prefer-classlist": ["warn", {
"solid/prefer-classlist": ["off", {
// An array of names to treat as `classnames` functions
classnames: ["cn","clsx","classnames"], // Array<string>
}]
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ const plugin = {
"solid/imports": 1,
"solid/style-prop": 1,
"solid/no-react-specific-props": 1,
"solid/prefer-classlist": 1,
"solid/self-closing-comp": 1,
// handled by Solid compiler, opt-in style suggestion
"solid/prefer-show": 0,
// deprecated
"solid/prefer-classlist": 0,
},
},
typescript: {
Expand All @@ -105,12 +106,13 @@ const plugin = {
"solid/imports": 1,
"solid/style-prop": 1,
"solid/no-react-specific-props": 1,
"solid/prefer-classlist": 1,
"solid/self-closing-comp": 1,
// namespaces taken care of by TS
"solid/no-unknown-namespaces": 0,
// handled by Solid compiler, opt-in style suggestion
"solid/prefer-show": 0,
// deprecated
"solid/prefer-classlist": 0,
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion src/rules/prefer-classlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const rule: TSESLint.RuleModule<"preferClasslist", [{ classnames?: [string, ...A
meta: {
type: "problem",
docs: {
recommended: "warn",
recommended: false,
description:
"Enforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object `{ [class: string]: boolean }` just like classnames.",
url: "https://github.com/solidjs-community/eslint-plugin-solid/blob/main/docs/prefer-classlist.md",
Expand Down Expand Up @@ -34,6 +34,7 @@ const rule: TSESLint.RuleModule<"preferClasslist", [{ classnames?: [string, ...A
preferClasslist:
"The classlist prop should be used instead of {{ classnames }} to efficiently set classes based on an object.",
},
deprecated: true,
},
create(context) {
const classnames = context.options[0]?.classnames ?? ["cn", "clsx", "classnames"];
Expand Down

0 comments on commit 197dbb5

Please sign in to comment.