eslint-plugin-tailwind-variants 2.0.3 → 2.1.0
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 +6 -4
- package/dist/src/index.d.ts +31 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/rules/index.d.ts +7 -0
- package/dist/src/rules/index.d.ts.map +1 -0
- package/dist/src/rules/limited-inline-classes.d.ts +41 -0
- package/dist/src/rules/limited-inline-classes.d.ts.map +1 -0
- package/dist/src/rules/require-variants-call-styles-name.d.ts +19 -0
- package/dist/src/rules/require-variants-call-styles-name.d.ts.map +1 -0
- package/dist/src/rules/require-variants-suffix.d.ts +19 -0
- package/dist/src/rules/require-variants-suffix.d.ts.map +1 -0
- package/dist/src/rules/sort-custom-properties.d.ts +86 -0
- package/dist/src/rules/sort-custom-properties.d.ts.map +1 -0
- package/dist/src/utils/create-rule-visitors.d.ts +2 -0
- package/dist/src/utils/create-rule-visitors.d.ts.map +1 -0
- package/dist/src/utils/get-bind-class-expression.d.ts +3 -0
- package/dist/src/utils/get-bind-class-expression.d.ts.map +1 -0
- package/package.json +42 -37
- package/src/index.js +62 -0
- package/{dist → src}/rules/index.js +5 -5
- package/src/rules/limited-inline-classes.js +440 -0
- package/src/rules/limited-inline-classes.test.js +268 -0
- package/src/rules/require-variants-call-styles-name.js +195 -0
- package/src/rules/require-variants-call-styles-name.test.js +105 -0
- package/src/rules/require-variants-suffix.js +146 -0
- package/src/rules/require-variants-suffix.test.js +81 -0
- package/src/rules/sort-custom-properties.js +596 -0
- package/src/rules/sort-custom-properties.test.js +758 -0
- package/src/utils/create-rule-visitors.js +28 -0
- package/src/utils/get-bind-class-expression.js +36 -0
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -43
- package/dist/rules/index.d.ts +0 -2
- package/dist/rules/limited-inline-classes.d.ts +0 -23
- package/dist/rules/limited-inline-classes.js +0 -198
- package/dist/rules/require-variants-call-styles-name.d.ts +0 -17
- package/dist/rules/require-variants-call-styles-name.js +0 -75
- package/dist/rules/require-variants-suffix.d.ts +0 -17
- package/dist/rules/require-variants-suffix.js +0 -66
- package/dist/rules/sort-custom-properties.d.ts +0 -37
- package/dist/rules/sort-custom-properties.js +0 -210
- package/dist/utils/create-rule-visitors.d.ts +0 -6
- package/dist/utils/create-rule-visitors.js +0 -18
- package/dist/utils/get-bind-class-expression.d.ts +0 -6
- package/dist/utils/get-bind-class-expression.js +0 -20
package/README.md
CHANGED
|
@@ -16,6 +16,10 @@ ESLint plugin to enforce best practices and consistent naming conventions for ta
|
|
|
16
16
|
|
|
17
17
|
Automatically enforces proper variable naming, limits excessive inline classes, and promotes clean tv() usage with auto-fix support. This plugin supports a wide range of projects, including React, Vue, plain JavaScript or TypeScript.
|
|
18
18
|
|
|
19
|
+
<div align="center">
|
|
20
|
+
<img alt="eslint-plugin-tailwind-variants demo" width="500px" src="./.github/assets/eslint-plugin-tailwind-variants-demo.png" />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
19
23
|
## Installation
|
|
20
24
|
|
|
21
25
|
```sh
|
|
@@ -42,9 +46,7 @@ npm i -D vue-eslint-parser
|
|
|
42
46
|
// ...
|
|
43
47
|
import tailwindVariants from "eslint-plugin-tailwind-variants";
|
|
44
48
|
|
|
45
|
-
export default defineConfig([
|
|
46
|
-
...tailwindVariants.configs.recommended,
|
|
47
|
-
]);
|
|
49
|
+
export default defineConfig([...tailwindVariants.configs.recommended]);
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
### Editor setup
|
|
@@ -64,4 +66,4 @@ If you are using the ESLint plugin in VS Code add the following to your `setting
|
|
|
64
66
|
| [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) | ✔ | ✔ |
|
|
65
67
|
| [require-variants-suffix](docs/rules/require-variants-suffix.md) | require variables assigned from tv() to end with a specific suffix | ✔ | ✔ |
|
|
66
68
|
| [limited-inline-classes](docs/rules/limited-inline-classes.md) | enforce limited number of inline class names and prohibit cn() usage | ✔ | |
|
|
67
|
-
| [sort-custom-properties](docs/rules/sort-custom-properties.md) | enforce consistent ordering of CSS custom properties (CSS variables) | ✔ | ✔ |
|
|
69
|
+
| [sort-custom-properties](docs/rules/sort-custom-properties.md) | enforce consistent ordering of CSS custom properties (CSS variables) | ✔ | ✔ |
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} PluginConfigs
|
|
3
|
+
* @property {import("eslint").Linter.Config[]} recommended Recommended ESLint configurations for this plugin.
|
|
4
|
+
*/
|
|
5
|
+
/** @type {PluginConfigs} */
|
|
6
|
+
export const configs: PluginConfigs;
|
|
7
|
+
declare const _default: {
|
|
8
|
+
configs: PluginConfigs;
|
|
9
|
+
meta: ({
|
|
10
|
+
name?: string | undefined;
|
|
11
|
+
version?: string | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
namespace?: string | undefined;
|
|
14
|
+
}) | undefined;
|
|
15
|
+
rules: {
|
|
16
|
+
"limited-inline-classes": import("eslint").Rule.RuleModule;
|
|
17
|
+
"require-variants-call-styles-name": import("eslint").Rule.RuleModule;
|
|
18
|
+
"require-variants-suffix": import("eslint").Rule.RuleModule;
|
|
19
|
+
"sort-custom-properties": import("eslint").Rule.RuleModule;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
23
|
+
export type PluginConfigs = {
|
|
24
|
+
/**
|
|
25
|
+
* Recommended ESLint configurations for this plugin.
|
|
26
|
+
*/
|
|
27
|
+
recommended: import("eslint").Linter.Config[];
|
|
28
|
+
};
|
|
29
|
+
/** @type {import("eslint").ESLint.Plugin} */
|
|
30
|
+
export const plugin: import("eslint").ESLint.Plugin;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":"AAoBA;;;GAGG;AAEH,4BAA4B;AAC5B,sBADW,aAAa,CA2BtB;;;;;;;;;;;;;;;;;;;;;iBA9BY,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;;AAX9C,6CAA6C;AAC7C,qBADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,CAOvC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const rules: {
|
|
2
|
+
"limited-inline-classes": import("eslint").Rule.RuleModule;
|
|
3
|
+
"require-variants-call-styles-name": import("eslint").Rule.RuleModule;
|
|
4
|
+
"require-variants-suffix": import("eslint").Rule.RuleModule;
|
|
5
|
+
"sort-custom-properties": import("eslint").Rule.RuleModule;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/index.js"],"names":[],"mappings":"AAKA;;;;;EAKE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export namespace MESSAGE_IDS {
|
|
2
|
+
let limitedInlineClasses: string;
|
|
3
|
+
let noCnInClassName: string;
|
|
4
|
+
}
|
|
5
|
+
/** @typedef {typeof MESSAGE_IDS[keyof typeof MESSAGE_IDS]} MessageIds */
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} RuleOptions
|
|
8
|
+
* @property {string} [directoryPattern="/components/"] Directory pattern to match for processing files.
|
|
9
|
+
* @property {number} [maxInlineClasses=5] Maximum number of inline classes allowed.
|
|
10
|
+
*/
|
|
11
|
+
/** @type {import("eslint").Rule.RuleModule} */
|
|
12
|
+
export const rule: import("eslint").Rule.RuleModule;
|
|
13
|
+
export type MessageIds = (typeof MESSAGE_IDS)[keyof typeof MESSAGE_IDS];
|
|
14
|
+
export type RuleOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* Directory pattern to match for processing files.
|
|
17
|
+
*/
|
|
18
|
+
directoryPattern?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum number of inline classes allowed.
|
|
21
|
+
*/
|
|
22
|
+
maxInlineClasses?: number | undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Shared validation options for all expression validators.
|
|
26
|
+
*/
|
|
27
|
+
export type ValidationOptions = {
|
|
28
|
+
/**
|
|
29
|
+
* Node being validated.
|
|
30
|
+
*/
|
|
31
|
+
node: import("estree").Node | import("vue-eslint-parser").AST.VAttribute;
|
|
32
|
+
/**
|
|
33
|
+
* RuleContext for reporting.
|
|
34
|
+
*/
|
|
35
|
+
context: import("eslint").Rule.RuleContext;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum number of inline classes allowed.
|
|
38
|
+
*/
|
|
39
|
+
maxInlineClasses: number;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=limited-inline-classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-inline-classes.d.ts","sourceRoot":"","sources":["../../../src/rules/limited-inline-classes.js"],"names":[],"mappings":";;;;AAWA,yEAAyE;AAEzE;;;;GAIG;AAEH,+CAA+C;AAC/C,mBADW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU,CAuDzC;yBA/DY,CAAA,OAAO,WAAW,EAAC,MAAM,OAAO,WAAW,CAAC;;;;;;;;;;;;;;;;;;UA4E5C,OAAO,QAAQ,EAAE,IAAI,GAClC,OAAU,mBAAmB,EAAE,GAAG,CAAC,UAAU;;;;aAChC,OAAO,QAAQ,EAAE,IAAI,CAAC,WAAW;;;;sBACjC,MAAM"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export namespace MESSAGE_IDS {
|
|
2
|
+
let renameAllOccurrences: string;
|
|
3
|
+
let requireVariantsCallStylesName: string;
|
|
4
|
+
}
|
|
5
|
+
/** @typedef {typeof MESSAGE_IDS[keyof typeof MESSAGE_IDS]} MessageIds */
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} RuleOptions
|
|
8
|
+
* @property {string} [name="styles"] Name required for variables assigned from tv().
|
|
9
|
+
*/
|
|
10
|
+
/** @type {import("eslint").Rule.RuleModule} */
|
|
11
|
+
export const rule: import("eslint").Rule.RuleModule;
|
|
12
|
+
export type MessageIds = (typeof MESSAGE_IDS)[keyof typeof MESSAGE_IDS];
|
|
13
|
+
export type RuleOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Name required for variables assigned from tv().
|
|
16
|
+
*/
|
|
17
|
+
name?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=require-variants-call-styles-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-variants-call-styles-name.d.ts","sourceRoot":"","sources":["../../../src/rules/require-variants-call-styles-name.js"],"names":[],"mappings":";;;;AAKA,yEAAyE;AAEzE;;;GAGG;AAEH,+CAA+C;AAC/C,mBADW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU,CAoFzC;yBA3FY,CAAA,OAAO,WAAW,EAAC,MAAM,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export namespace MESSAGE_IDS {
|
|
2
|
+
let renameAllOccurrences: string;
|
|
3
|
+
let requireVariantsSuffix: string;
|
|
4
|
+
}
|
|
5
|
+
/** @typedef {typeof MESSAGE_IDS[keyof typeof MESSAGE_IDS]} MessageIds */
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} RuleOptions
|
|
8
|
+
* @property {string} [suffix="Variants"] Suffix required for variables assigned from tv().
|
|
9
|
+
*/
|
|
10
|
+
/** @type {import("eslint").Rule.RuleModule} */
|
|
11
|
+
export const rule: import("eslint").Rule.RuleModule;
|
|
12
|
+
export type MessageIds = (typeof MESSAGE_IDS)[keyof typeof MESSAGE_IDS];
|
|
13
|
+
export type RuleOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Suffix required for variables assigned from tv().
|
|
16
|
+
*/
|
|
17
|
+
suffix?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=require-variants-suffix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-variants-suffix.d.ts","sourceRoot":"","sources":["../../../src/rules/require-variants-suffix.js"],"names":[],"mappings":";;;;AAKA,yEAAyE;AAEzE;;;GAGG;AAEH,+CAA+C;AAC/C,mBADW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU,CA2CzC;yBAlDY,CAAA,OAAO,WAAW,EAAC,MAAM,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export namespace MESSAGE_IDS {
|
|
2
|
+
let invalidPattern: string;
|
|
3
|
+
let missingEmptyLineBetweenGroups: string;
|
|
4
|
+
let patternTooLong: string;
|
|
5
|
+
let unsortedCustomProperties: string;
|
|
6
|
+
}
|
|
7
|
+
/** @typedef {typeof MESSAGE_IDS[keyof typeof MESSAGE_IDS]} MessageIds */
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} RuleOptions
|
|
10
|
+
* @property {boolean} [emptyLineBetweenGroups=false] Add empty line between different prefix groups.
|
|
11
|
+
* @property {string[]} [order=DEFAULT_ORDER] Order of patterns (RegExp strings) for custom properties.
|
|
12
|
+
*/
|
|
13
|
+
/** @type {import("eslint").Rule.RuleModule} */
|
|
14
|
+
export const rule: import("eslint").Rule.RuleModule;
|
|
15
|
+
export type CustomProperty = {
|
|
16
|
+
/**
|
|
17
|
+
* AST node of the custom property declaration.
|
|
18
|
+
*/
|
|
19
|
+
node: import("estree").Node;
|
|
20
|
+
/**
|
|
21
|
+
* Index of the property based on matching order patterns.
|
|
22
|
+
*/
|
|
23
|
+
orderIndex: number;
|
|
24
|
+
/**
|
|
25
|
+
* Name of the custom property (e.g., '--color-primary').
|
|
26
|
+
*/
|
|
27
|
+
property: string;
|
|
28
|
+
};
|
|
29
|
+
export type MessageIds = (typeof MESSAGE_IDS)[keyof typeof MESSAGE_IDS];
|
|
30
|
+
export type RuleOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* Add empty line between different prefix groups.
|
|
33
|
+
*/
|
|
34
|
+
emptyLineBetweenGroups?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Order of patterns (RegExp strings) for custom properties.
|
|
37
|
+
*/
|
|
38
|
+
order?: string[] | undefined;
|
|
39
|
+
};
|
|
40
|
+
export type FixerConfig = {
|
|
41
|
+
/**
|
|
42
|
+
* Properties in the current block being processed.
|
|
43
|
+
*/
|
|
44
|
+
currentBlockProperties: CustomProperty[];
|
|
45
|
+
/**
|
|
46
|
+
* Properties sorted according to the defined order.
|
|
47
|
+
*/
|
|
48
|
+
sorted: CustomProperty[];
|
|
49
|
+
/**
|
|
50
|
+
* Whether empty lines are required between groups.
|
|
51
|
+
*/
|
|
52
|
+
emptyLineBetweenGroups: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* ESLint SourceCode instance for text extraction.
|
|
55
|
+
*/
|
|
56
|
+
sourceCode: import("eslint").SourceCode;
|
|
57
|
+
};
|
|
58
|
+
export type BlockHandlerConfig = {
|
|
59
|
+
/**
|
|
60
|
+
* Stack of property blocks being processed.
|
|
61
|
+
*/
|
|
62
|
+
blockStack: CustomProperty[][];
|
|
63
|
+
/**
|
|
64
|
+
* Whether empty lines are required between groups.
|
|
65
|
+
*/
|
|
66
|
+
emptyLineBetweenGroups: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Array of RegEx patterns defining the sort order.
|
|
69
|
+
*/
|
|
70
|
+
order: string[];
|
|
71
|
+
/**
|
|
72
|
+
* ESLint SourceCode instance for text extraction.
|
|
73
|
+
*/
|
|
74
|
+
sourceCode: import("eslint").SourceCode;
|
|
75
|
+
/**
|
|
76
|
+
* ESLint rule context for reporting.
|
|
77
|
+
*/
|
|
78
|
+
context: import("eslint").Rule.RuleContext;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Callback to get the order index of a property name based on compiled regex patterns.
|
|
82
|
+
*/
|
|
83
|
+
export type OrderIndexGetter = (propName: string) => number;
|
|
84
|
+
export type FixerFunction = (fixer: import("eslint").Rule.RuleFixer) => import("eslint").Rule.Fix[] | null;
|
|
85
|
+
export type DeclarationCollector = (node: import("estree").Node) => void;
|
|
86
|
+
//# sourceMappingURL=sort-custom-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-custom-properties.d.ts","sourceRoot":"","sources":["../../../src/rules/sort-custom-properties.js"],"names":[],"mappings":";;;;;;AAgCA,yEAAyE;AAEzE;;;;GAIG;AAEH,+CAA+C;AAC/C,mBADW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU,CA6EzC;;;;;UAnHY,OAAO,QAAQ,EAAE,IAAI;;;;gBACrB,MAAM;;;;cACN,MAAM;;yBA4BN,CAAA,OAAO,WAAW,EAAC,MAAM,OAAO,WAAW,CAAC;;;;;;;;;;;;;;;4BAyF5C,cAAc,EAAE;;;;YAChB,cAAc,EAAE;;;;4BAChB,OAAO;;;;gBACP,OAAO,QAAQ,EAAE,UAAU;;;;;;gBAK3B,cAAc,EAAE,EAAE;;;;4BAClB,OAAO;;;;WACP,MAAM,EAAE;;;;gBACR,OAAO,QAAQ,EAAE,UAAU;;;;aAC3B,OAAO,QAAQ,EAAE,IAAI,CAAC,WAAW;;;;;0CAwEpC,MAAM,KACJ,MAAM;oCAmNR,OAAO,QAAQ,EAAE,IAAI,CAAC,SAAS,KAC7B,OAAO,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI;0CAgJpC,OAAO,QAAQ,EAAE,IAAI,KACnB,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-rule-visitors.d.ts","sourceRoot":"","sources":["../../../src/utils/create-rule-visitors.js"],"names":[],"mappings":"AAQO,4CALI,OAAO,QAAQ,EAAE,IAAI,CAAC,WAAW,mBACjC,OAAO,QAAQ,EAAE,IAAI,CAAC,YAAY,iBAClC,OAAO,QAAQ,EAAE,IAAI,CAAC,YAAY,GAChC,OAAO,QAAQ,EAAE,IAAI,CAAC,YAAY,CAqB9C"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export function getBindClassExpression(key: import("vue-eslint-parser").AST.VDirectiveKey, value: import("vue-eslint-parser").AST.VLiteral | import("vue-eslint-parser").AST.VExpressionContainer | null): import("vue-eslint-parser").AST.VExpressionContainer | undefined;
|
|
2
|
+
export function isValidDirective(node: import("vue-eslint-parser").AST.VAttribute): boolean;
|
|
3
|
+
//# sourceMappingURL=get-bind-class-expression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-bind-class-expression.d.ts","sourceRoot":"","sources":["../../../src/utils/get-bind-class-expression.js"],"names":[],"mappings":"AAOO,4CAJI,OAAO,mBAAmB,EAAE,GAAG,CAAC,aAAa,SAC7C,OAAO,mBAAmB,EAAE,GAAG,CAAC,QAAQ,GAAG,OAAO,mBAAmB,EAAE,GAAG,CAAC,oBAAoB,GAAG,IAAI,GACpG,OAAO,mBAAmB,EAAE,GAAG,CAAC,oBAAoB,GAAG,SAAS,CAY5E;AAOM,uCAHI,OAAO,mBAAmB,EAAE,GAAG,CAAC,UAAU,GACxC,OAAO,CAGiD"}
|
package/package.json
CHANGED
|
@@ -1,63 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-tailwind-variants",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "ESLint plugin for Tailwind Variants",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"eslint-plugin",
|
|
8
|
+
"tailwind",
|
|
9
|
+
"tailwind-variants"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "madebydomdev",
|
|
5
13
|
"repository": {
|
|
6
14
|
"type": "git",
|
|
7
15
|
"url": "https://github.com/domingasp/eslint-plugin-tailwind-variants.git"
|
|
8
16
|
},
|
|
9
|
-
"
|
|
17
|
+
"files": [
|
|
18
|
+
"src",
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"main": "src/index.js",
|
|
10
22
|
"types": "dist/index.d.ts",
|
|
11
23
|
"exports": {
|
|
12
24
|
".": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./src/index.js"
|
|
15
27
|
}
|
|
16
28
|
},
|
|
17
29
|
"scripts": {
|
|
18
|
-
"
|
|
30
|
+
"knip": "knip",
|
|
31
|
+
"lint": "oxlint",
|
|
32
|
+
"fmt:check": "oxfmt --check",
|
|
19
33
|
"build": "tsc",
|
|
20
34
|
"prepublishOnly": "pnpm run build",
|
|
21
35
|
"test": "vitest",
|
|
22
36
|
"test:debug": "vitest --reporter=verbose",
|
|
23
37
|
"prepare": "husky"
|
|
24
38
|
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"eslint",
|
|
27
|
-
"eslint-plugin",
|
|
28
|
-
"tailwind",
|
|
29
|
-
"tailwind-variants"
|
|
30
|
-
],
|
|
31
|
-
"files": [
|
|
32
|
-
"dist"
|
|
33
|
-
],
|
|
34
|
-
"author": "madebydomdev",
|
|
35
|
-
"license": "MIT",
|
|
36
|
-
"packageManager": "pnpm@10.22.0",
|
|
37
|
-
"engines": {
|
|
38
|
-
"node": ">=18"
|
|
39
|
-
},
|
|
40
|
-
"peerDependencies": {
|
|
41
|
-
"eslint": ">9.0.0"
|
|
42
|
-
},
|
|
43
39
|
"dependencies": {
|
|
44
|
-
"@eslint/css": "^0.14.1"
|
|
45
|
-
"@typescript-eslint/utils": "^8.51.0"
|
|
40
|
+
"@eslint/css": "^0.14.1"
|
|
46
41
|
},
|
|
47
42
|
"devDependencies": {
|
|
48
|
-
"@commitlint/cli": "^20.
|
|
49
|
-
"@commitlint/config-conventional": "^20.
|
|
50
|
-
"@eslint
|
|
51
|
-
"@types/
|
|
52
|
-
"@
|
|
43
|
+
"@commitlint/cli": "^20.4.1",
|
|
44
|
+
"@commitlint/config-conventional": "^20.4.1",
|
|
45
|
+
"@types/eslint-scope": "^8.4.0",
|
|
46
|
+
"@types/estree": "^1.0.8",
|
|
47
|
+
"@types/estree-jsx": "^1.0.5",
|
|
48
|
+
"@types/node": "^25.2.3",
|
|
49
|
+
"@typescript-eslint/utils": "^8.55.0",
|
|
53
50
|
"eslint": "^9.39.2",
|
|
54
|
-
"eslint-plugin-
|
|
55
|
-
"globals": "^17.0.0",
|
|
51
|
+
"eslint-plugin-jsdoc": "^62.5.5",
|
|
56
52
|
"husky": "^9.1.7",
|
|
57
|
-
"
|
|
53
|
+
"knip": "^5.83.1",
|
|
54
|
+
"lint-staged": "^16.2.7",
|
|
55
|
+
"oxfmt": "^0.32.0",
|
|
56
|
+
"oxlint": "^1.47.0",
|
|
58
57
|
"typescript": "^5.9.3",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
"vitest": "^4.0.18",
|
|
59
|
+
"vue-eslint-parser": "^10.3.0"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"eslint": ">9.0.0"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=18"
|
|
66
|
+
},
|
|
67
|
+
"packageManager": "pnpm@10.29.3"
|
|
63
68
|
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import css from "@eslint/css";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
name as packageName,
|
|
5
|
+
version as packageVersion,
|
|
6
|
+
} from "../package.json";
|
|
7
|
+
|
|
8
|
+
import { rules } from "./rules/index.js";
|
|
9
|
+
|
|
10
|
+
const pluginName = "tailwind-variants";
|
|
11
|
+
|
|
12
|
+
/** @type {import("eslint").ESLint.Plugin} */
|
|
13
|
+
const plugin = {
|
|
14
|
+
meta: {
|
|
15
|
+
name: packageName,
|
|
16
|
+
version: packageVersion,
|
|
17
|
+
},
|
|
18
|
+
rules,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {object} PluginConfigs
|
|
23
|
+
* @property {import("eslint").Linter.Config[]} recommended Recommended ESLint configurations for this plugin.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** @type {PluginConfigs} */
|
|
27
|
+
export const configs = {
|
|
28
|
+
recommended: [
|
|
29
|
+
{
|
|
30
|
+
plugins: {
|
|
31
|
+
[pluginName]: plugin,
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
[`${pluginName}/limited-inline-classes`]: "error",
|
|
35
|
+
[`${pluginName}/require-variants-call-styles-name`]: "error",
|
|
36
|
+
[`${pluginName}/require-variants-suffix`]: "error",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
files: ["**/*.css"],
|
|
41
|
+
language: "css/css",
|
|
42
|
+
plugins: { css },
|
|
43
|
+
rules: {
|
|
44
|
+
[`${pluginName}/sort-custom-properties`]: [
|
|
45
|
+
"error",
|
|
46
|
+
{
|
|
47
|
+
emptyLineBetweenGroups: true,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { plugin };
|
|
56
|
+
|
|
57
|
+
/** @type {import("eslint").ESLint.Plugin & { configs: PluginConfigs }} */
|
|
58
|
+
export default {
|
|
59
|
+
configs,
|
|
60
|
+
meta: plugin.meta,
|
|
61
|
+
rules,
|
|
62
|
+
};
|
|
@@ -2,10 +2,10 @@ import { rule as limitedInlineClasses } from "./limited-inline-classes.js";
|
|
|
2
2
|
import { rule as requireVariantsCallStylesName } from "./require-variants-call-styles-name.js";
|
|
3
3
|
import { rule as requireVariantsSuffix } from "./require-variants-suffix.js";
|
|
4
4
|
import { rule as sortCustomProperties } from "./sort-custom-properties.js";
|
|
5
|
+
|
|
5
6
|
export const rules = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// as unknown due to ESLint and TSESLint types not aligning perfectly
|
|
7
|
+
"limited-inline-classes": limitedInlineClasses,
|
|
8
|
+
"require-variants-call-styles-name": requireVariantsCallStylesName,
|
|
9
|
+
"require-variants-suffix": requireVariantsSuffix,
|
|
10
|
+
"sort-custom-properties": sortCustomProperties,
|
|
11
11
|
};
|