eslint-plugin-tailwind-variants 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -49,8 +49,8 @@ export default defineConfig([
|
|
|
49
49
|
|
|
50
50
|
### Rules
|
|
51
51
|
|
|
52
|
-
| Name | Description
|
|
53
|
-
| ------------------------------------------------------------------------------------ |
|
|
54
|
-
| [require-variants-call-styles-name](docs/rules/require-variants-call-styles-name.md) | enforce that
|
|
55
|
-
| [require-variants-suffix](docs/rules/require-variants-suffix.md) | require variables assigned from tv() to end with a specific suffix
|
|
56
|
-
| [limited-inline-classes](docs/rules/limited-inline-classes.md) | enforce limited number of inline class names and prohibit cn() usage
|
|
52
|
+
| Name | Description | `recommended` | autofix |
|
|
53
|
+
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------- |
|
|
54
|
+
| [require-variants-call-styles-name](docs/rules/require-variants-call-styles-name.md) | enforce that when calling a function returned by tailwind-variants (`tv()`), the result is assigned to a variable named `styles` (or a configurable name) | ✔ | ✔ |
|
|
55
|
+
| [require-variants-suffix](docs/rules/require-variants-suffix.md) | require variables assigned from tv() to end with a specific suffix | ✔ | ✔ |
|
|
56
|
+
| [limited-inline-classes](docs/rules/limited-inline-classes.md) | enforce limited number of inline class names and prohibit cn() usage | ✔ | |
|
|
@@ -7,11 +7,11 @@ export const rule = createRule({
|
|
|
7
7
|
name: "require-variants-call-styles-name",
|
|
8
8
|
meta: {
|
|
9
9
|
docs: {
|
|
10
|
-
description: "Require variables assigned from tv() to be named {{name}}.",
|
|
10
|
+
description: "Require variables assigned from calling a function returned by tv() to be named {{name}}.",
|
|
11
11
|
},
|
|
12
12
|
fixable: "code",
|
|
13
13
|
messages: {
|
|
14
|
-
requireVariantsCallStylesName: "
|
|
14
|
+
requireVariantsCallStylesName: "Require variables assigned from calling a function returned by tv() to be named {{name}}.",
|
|
15
15
|
},
|
|
16
16
|
schema: [
|
|
17
17
|
{
|
|
@@ -49,19 +49,8 @@ export const rule = createRule({
|
|
|
49
49
|
return;
|
|
50
50
|
if (id.type !== "Identifier")
|
|
51
51
|
return;
|
|
52
|
-
//
|
|
52
|
+
// Track variant functions created by tv()
|
|
53
53
|
if (init.callee.name === "tv") {
|
|
54
|
-
if (id.name !== requiredName) {
|
|
55
|
-
context.report({
|
|
56
|
-
data: {
|
|
57
|
-
functionName: "tv",
|
|
58
|
-
name: requiredName,
|
|
59
|
-
},
|
|
60
|
-
fix: (fixer) => fixer.replaceText(id, requiredName),
|
|
61
|
-
messageId: MESSAGE_IDS.requireVariantsCallStylesName,
|
|
62
|
-
node: id,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
54
|
variantFunctions.add(id.name);
|
|
66
55
|
return;
|
|
67
56
|
}
|