@freehour/eslint-rules 1.0.1 → 1.0.3

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
@@ -21,6 +21,7 @@ export default defineConfig(
21
21
  // node: true, // enable when targeting Node.js
22
22
  // browser: true, // enable when targeting browsers
23
23
  // react: true, // enable when using React
24
+ // tailwindcss: true, // enable when using Tailwind CSS
24
25
  // stylistic: true, // enable to use stylistic rules
25
26
  // imports: true, // enable to use import rules
26
27
  }),
package/dist/config.d.ts CHANGED
@@ -10,19 +10,20 @@ export interface ConfigOptions {
10
10
  browser?: boolean;
11
11
  /**
12
12
  * Enable when using React.
13
- * Requires `eslint-plugin-react` to be installed.
14
13
  */
15
14
  react?: boolean;
15
+ /**
16
+ * Enable when using Tailwind CSS.
17
+ */
18
+ tailwindcss?: boolean;
16
19
  /**
17
20
  * Enable to use stylistic rules.
18
- * Requires `@stylistic/eslint-plugin` to be installed.
19
21
  */
20
22
  stylistic?: boolean;
21
23
  /**
22
24
  * Enable to use import rules.
23
- * Requires `eslint-plugin-import-x` and `eslint-import-resolver-typescript` to be installed.
24
25
  */
25
26
  imports?: boolean;
26
27
  }
27
- export declare function createConfig({ node, browser, react, stylistic, imports, }?: ConfigOptions): Promise<Config>;
28
+ export declare function createConfig({ node, browser, react, tailwindcss, stylistic, imports, }?: ConfigOptions): Promise<Config>;
28
29
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../lib/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAU5C,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,YAAY,CAAC,EAC/B,IAAY,EACZ,OAAe,EACf,KAAa,EACb,SAAiB,EACjB,OAAe,GAClB,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAikCtC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../lib/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAW5C,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,YAAY,CAAC,EAC/B,IAAY,EACZ,OAAe,EACf,KAAa,EACb,WAAmB,EACnB,SAAiB,EACjB,OAAe,GAClB,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgmCtC"}
package/dist/index.js CHANGED
@@ -6,35 +6,46 @@ import i from "eslint-plugin-react-hooks";
6
6
  import a from "eslint-plugin-react-refresh";
7
7
  import o from "@stylistic/eslint-plugin";
8
8
  import s from "eslint-plugin-import-x";
9
+ import c from "eslint-plugin-tailwindcss";
9
10
  //#region lib/config.ts
10
- async function c({ node: c = !1, browser: l = !1, react: u = !1, stylistic: d = !1, imports: f = !1 } = {}) {
11
+ async function l({ node: l = !1, browser: u = !1, react: d = !1, tailwindcss: f = !1, stylistic: p = !1, imports: m = !1 } = {}) {
11
12
  return {
12
13
  languageOptions: {
13
14
  ecmaVersion: "latest",
14
15
  sourceType: "module",
15
16
  parserOptions: {
16
17
  projectService: !0,
17
- ...u && { ecmaFeatures: { jsx: !0 } }
18
+ ...d && { ecmaFeatures: { jsx: !0 } }
18
19
  },
19
20
  parser: n.parser,
20
21
  globals: {
21
- ...l && t.browser,
22
- ...c && t.nodeBuiltin
22
+ ...u && t.browser,
23
+ ...l && t.nodeBuiltin
23
24
  }
24
25
  },
25
26
  settings: {
26
- ...f && { "import-x/resolver-next": [e({ alwaysTryTypes: !0 })] },
27
- ...u && { react: { version: "detect" } }
27
+ ...m && { "import-x/resolver-next": [e({ alwaysTryTypes: !0 })] },
28
+ ...d && { react: { version: "detect" } },
29
+ ...f && { tailwindcss: { callees: [
30
+ "tw",
31
+ "clsx",
32
+ "cn",
33
+ "cva",
34
+ "twMerge",
35
+ "classnames",
36
+ "ctl"
37
+ ] } }
28
38
  },
29
39
  plugins: {
30
40
  "@typescript-eslint": n.plugin,
31
- ...u && {
41
+ ...d && {
32
42
  react: r,
33
43
  "react-hooks": i,
34
44
  "react-refresh": a
35
45
  },
36
- ...d && { "@stylistic": o },
37
- ...f && { "import-x": s }
46
+ ...p && { "@stylistic": o },
47
+ ...m && { "import-x": s },
48
+ ...f && { tailwindcss: c }
38
49
  },
39
50
  rules: {
40
51
  "array-callback-return": "error",
@@ -405,7 +416,7 @@ async function c({ node: c = !1, browser: l = !1, react: u = !1, stylistic: d =
405
416
  "@typescript-eslint/unbound-method": ["error", { ignoreStatic: !0 }],
406
417
  "@typescript-eslint/unified-signatures": "warn",
407
418
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
408
- ...d && {
419
+ ...p && {
409
420
  "@stylistic/array-bracket-newline": "warn",
410
421
  "@stylistic/array-bracket-spacing": "warn",
411
422
  "@stylistic/array-element-newline": ["warn", "consistent"],
@@ -566,7 +577,7 @@ async function c({ node: c = !1, browser: l = !1, react: u = !1, stylistic: d =
566
577
  "@stylistic/wrap-regex": "off",
567
578
  "@stylistic/yield-star-spacing": "off"
568
579
  },
569
- ...f && {
580
+ ...m && {
570
581
  "no-duplicate-imports": "off",
571
582
  "import-x/export": "error",
572
583
  "import-x/no-deprecated": "warn",
@@ -580,7 +591,7 @@ async function c({ node: c = !1, browser: l = !1, react: u = !1, stylistic: d =
580
591
  "import-x/no-amd": "error",
581
592
  "import-x/no-commonjs": "error",
582
593
  "import-x/no-import-module-exports": "error",
583
- "import-x/no-nodejs-modules": l && !c ? "error" : "off",
594
+ "import-x/no-nodejs-modules": u && !l ? "error" : "off",
584
595
  "import-x/unambiguous": "error",
585
596
  "import-x/default": "error",
586
597
  "import-x/named": "off",
@@ -621,8 +632,8 @@ async function c({ node: c = !1, browser: l = !1, react: u = !1, stylistic: d =
621
632
  "import-x/prefer-default-export": "off",
622
633
  "import-x/prefer-namespace-import": "off"
623
634
  },
624
- ...u && {
625
- ...d && {
635
+ ...d && {
636
+ ...p && {
626
637
  "@stylistic/jsx-child-element-spacing": "off",
627
638
  "@stylistic/jsx-closing-bracket-location": "off",
628
639
  "@stylistic/jsx-closing-tag-location": "off",
@@ -782,9 +793,19 @@ async function c({ node: c = !1, browser: l = !1, react: u = !1, stylistic: d =
782
793
  "react-hooks/use-memo": "error",
783
794
  "react-hooks/incompatible-library": "warn",
784
795
  "react-refresh/only-export-components": ["warn", { allowConstantExport: !0 }]
796
+ },
797
+ ...f && {
798
+ "tailwindcss/classnames-order": "warn",
799
+ "tailwindcss/enforces-negative-arbitrary-values": "warn",
800
+ "tailwindcss/enforces-shorthand": "warn",
801
+ "tailwindcss/migration-from-tailwind-2": "off",
802
+ "tailwindcss/no-arbitrary-value": "off",
803
+ "tailwindcss/no-custom-classname": "warn",
804
+ "tailwindcss/no-contradicting-classname": "off",
805
+ "tailwindcss/no-unnecessary-arbitrary-value": "warn"
785
806
  }
786
807
  }
787
808
  };
788
809
  }
789
810
  //#endregion
790
- export { c as createConfig };
811
+ export { l as createConfig };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "displayName": "eslint-rules",
5
5
  "description": "ESLint rules for TypeScript projects.",
6
- "version": "1.0.1",
6
+ "version": "1.0.3",
7
7
  "type": "module",
8
8
  "repository": {
9
9
  "type": "git",
@@ -28,6 +28,7 @@
28
28
  "eslint-plugin-react": "7.37.5",
29
29
  "eslint-plugin-react-hooks": "7.0.1",
30
30
  "eslint-plugin-react-refresh": "0.5.2",
31
+ "eslint-plugin-tailwindcss": "4.0.0-beta.0",
31
32
  "typescript-eslint": "8.57.2"
32
33
  },
33
34
  "peerDependencies": {
@@ -35,12 +36,13 @@
35
36
  "typescript": "^6.0.0"
36
37
  },
37
38
  "devDependencies": {
38
- "eslint": "9.39.4",
39
+ "@types/eslint-plugin-tailwindcss": "^3.17.0",
39
40
  "ajv": "^8.18.0",
40
41
  "bun-types": "^1.3.11",
42
+ "eslint": "9.39.4",
43
+ "typescript": "^6.0.0",
41
44
  "vite": "^8.0.3",
42
- "vite-plugin-dts": "^4.5.4",
43
- "typescript": "^6.0.0"
45
+ "vite-plugin-dts": "^4.5.4"
44
46
  },
45
47
  "trustedDependencies": [
46
48
  "unrs-resolver"