@tcy/eslint-rules 1.4.4 → 1.5.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.
Files changed (41) hide show
  1. package/coverage/clover.xml +309 -282
  2. package/coverage/coverage-final.json +6 -2
  3. package/coverage/lcov-report/index.html +21 -171
  4. package/coverage/lcov-report/{array-elements-per-line.js.html → src/array-elements-per-line.js.html} +10 -10
  5. package/coverage/lcov-report/{back.js.html → src/back/back.js.html} +11 -11
  6. package/coverage/lcov-report/src/back/index.html +131 -0
  7. package/coverage/lcov-report/src/back/recommended.js.html +100 -0
  8. package/coverage/lcov-report/{client.js.html → src/client/client.js.html} +18 -12
  9. package/coverage/lcov-report/src/client/index.html +131 -0
  10. package/coverage/lcov-report/src/client/recommended.js.html +100 -0
  11. package/coverage/lcov-report/{decorator-type-enforcement.js.html → src/decorator-type-enforcement.js.html} +10 -10
  12. package/coverage/lcov-report/{enforce-tailwind-important.js.html → src/enforce-tailwind-important.js.html} +10 -10
  13. package/coverage/lcov-report/{export-specifiers-per-line.js.html → src/export-specifiers-per-line.js.html} +10 -10
  14. package/coverage/lcov-report/{import-specifiers-per-line.js.html → src/import-specifiers-per-line.js.html} +10 -10
  15. package/coverage/lcov-report/src/index.html +296 -0
  16. package/coverage/lcov-report/{index.js.html → src/index.js.html} +12 -12
  17. package/coverage/lcov-report/src/jsx-boolean-shorthand.js.html +187 -0
  18. package/coverage/lcov-report/{jsx-expression-string-literals.js.html → src/jsx-expression-string-literals.js.html} +10 -10
  19. package/coverage/lcov-report/{plugin.js.html → src/plugin.js.html} +17 -11
  20. package/coverage/lcov-report/src/recommended.js.html +124 -0
  21. package/coverage/lcov-report/{v-model-name-match.js.html → src/v-model-name-match.js.html} +10 -10
  22. package/coverage/lcov-report/{vuejs-define-component.js.html → src/vuejs-define-component.js.html} +10 -10
  23. package/coverage/lcov-report/{vuejs-define-workspace.js.html → src/vuejs-define-workspace.js.html} +10 -10
  24. package/coverage/lcov.info +76 -18
  25. package/decl/{back.d.ts → back/back.d.ts} +1 -1
  26. package/decl/back/recommended.d.ts +11 -0
  27. package/decl/{client.d.ts → client/client.d.ts} +2 -1
  28. package/decl/client/recommended.d.ts +11 -0
  29. package/decl/index.d.ts +2 -2
  30. package/decl/jsx-boolean-shorthand.d.ts +14 -0
  31. package/decl/plugin.d.ts +13 -0
  32. package/decl/recommended.d.ts +11 -0
  33. package/package.json +15 -7
  34. package/src/{back.js → back/back.js} +1 -1
  35. package/src/back/recommended.js +5 -0
  36. package/src/{client.js → client/client.js} +3 -1
  37. package/src/client/recommended.js +5 -0
  38. package/src/index.js +2 -2
  39. package/src/jsx-boolean-shorthand.js +35 -0
  40. package/src/plugin.js +2 -0
  41. package/src/recommended.js +13 -0
@@ -58,24 +58,6 @@ BRF:17
58
58
  BRH:0
59
59
  end_of_record
60
60
  TN:
61
- SF:src/back.js
62
- FNF:0
63
- FNH:0
64
- LF:0
65
- LH:0
66
- BRF:0
67
- BRH:0
68
- end_of_record
69
- TN:
70
- SF:src/client.js
71
- FNF:0
72
- FNH:0
73
- LF:0
74
- LH:0
75
- BRF:0
76
- BRH:0
77
- end_of_record
78
- TN:
79
61
  SF:src/decorator-type-enforcement.js
80
62
  FN:1,(anonymous_0)
81
63
  FN:4,(anonymous_1)
@@ -444,6 +426,37 @@ BRF:0
444
426
  BRH:0
445
427
  end_of_record
446
428
  TN:
429
+ SF:src/jsx-boolean-shorthand.js
430
+ FN:10,(anonymous_0)
431
+ FN:12,(anonymous_1)
432
+ FN:25,(anonymous_2)
433
+ FNF:3
434
+ FNH:0
435
+ FNDA:0,(anonymous_0)
436
+ FNDA:0,(anonymous_1)
437
+ FNDA:0,(anonymous_2)
438
+ DA:11,0
439
+ DA:14,0
440
+ DA:15,0
441
+ DA:18,0
442
+ DA:19,0
443
+ DA:27,0
444
+ LF:6
445
+ LH:0
446
+ BRDA:14,0,0,0
447
+ BRDA:14,0,1,0
448
+ BRDA:14,1,0,0
449
+ BRDA:14,1,1,0
450
+ BRDA:18,2,0,0
451
+ BRDA:18,2,1,0
452
+ BRDA:18,3,0,0
453
+ BRDA:18,3,1,0
454
+ BRDA:23,4,0,0
455
+ BRDA:23,4,1,0
456
+ BRF:10
457
+ BRH:0
458
+ end_of_record
459
+ TN:
447
460
  SF:src/jsx-expression-string-literals.js
448
461
  FN:12,(anonymous_0)
449
462
  FN:14,(anonymous_1)
@@ -485,6 +498,15 @@ BRF:0
485
498
  BRH:0
486
499
  end_of_record
487
500
  TN:
501
+ SF:src/recommended.js
502
+ FNF:0
503
+ FNH:0
504
+ LF:0
505
+ LH:0
506
+ BRF:0
507
+ BRH:0
508
+ end_of_record
509
+ TN:
488
510
  SF:src/v-model-name-match.js
489
511
  FN:16,(anonymous_0)
490
512
  FN:18,(anonymous_1)
@@ -656,3 +678,39 @@ BRDA:55,7,1,0
656
678
  BRF:20
657
679
  BRH:0
658
680
  end_of_record
681
+ TN:
682
+ SF:src/back/back.js
683
+ FNF:0
684
+ FNH:0
685
+ LF:0
686
+ LH:0
687
+ BRF:0
688
+ BRH:0
689
+ end_of_record
690
+ TN:
691
+ SF:src/back/recommended.js
692
+ FNF:0
693
+ FNH:0
694
+ LF:0
695
+ LH:0
696
+ BRF:0
697
+ BRH:0
698
+ end_of_record
699
+ TN:
700
+ SF:src/client/client.js
701
+ FNF:0
702
+ FNH:0
703
+ LF:0
704
+ LH:0
705
+ BRF:0
706
+ BRH:0
707
+ end_of_record
708
+ TN:
709
+ SF:src/client/recommended.js
710
+ FNF:0
711
+ FNH:0
712
+ LF:0
713
+ LH:0
714
+ BRF:0
715
+ BRH:0
716
+ end_of_record
@@ -13,4 +13,4 @@ declare namespace _default {
13
13
  };
14
14
  }
15
15
  export default _default;
16
- import pluginConfig from './plugin.js';
16
+ import pluginConfig from '../plugin.js';
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ '@typescript-eslint/naming-convention': (string | {
3
+ selector: string;
4
+ format: null;
5
+ custom: {
6
+ regex: string;
7
+ match: boolean;
8
+ };
9
+ })[];
10
+ };
11
+ export default _default;
@@ -11,6 +11,7 @@ declare namespace _default {
11
11
  'tcy/export-specifiers-per-line': string;
12
12
  'tcy/array-elements-per-line': string;
13
13
  'tcy/jsx-expression-string-literals': string;
14
+ 'tcy/jsx-boolean-shorthand': string;
14
15
  'tcy/enforce-tailwind-important': string;
15
16
  'tcy/v-model-name-match': string;
16
17
  'tcy/vuejs-define-component': string;
@@ -18,4 +19,4 @@ declare namespace _default {
18
19
  };
19
20
  }
20
21
  export default _default;
21
- import pluginConfig from './plugin.js';
22
+ import pluginConfig from '../plugin.js';
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ '@typescript-eslint/naming-convention': (string | {
3
+ selector: string;
4
+ format: null;
5
+ custom: {
6
+ regex: string;
7
+ match: boolean;
8
+ };
9
+ })[];
10
+ };
11
+ export default _default;
package/decl/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * as client from "./client.js";
2
- export * as back from "./back.js";
1
+ export * as client from "./client/client.js";
2
+ export * as back from "./back/back.js";
@@ -0,0 +1,14 @@
1
+ declare namespace _default {
2
+ namespace meta {
3
+ let type: string;
4
+ namespace docs {
5
+ let description: string;
6
+ }
7
+ let fixable: string;
8
+ let schema: never[];
9
+ }
10
+ function create(context: any): {
11
+ JSXAttribute(node: any): void;
12
+ };
13
+ }
14
+ export default _default;
package/decl/plugin.d.ts CHANGED
@@ -53,6 +53,19 @@ declare const _default: {
53
53
  ExportNamedDeclaration(node: any): void;
54
54
  };
55
55
  };
56
+ 'jsx-boolean-shorthand': {
57
+ meta: {
58
+ type: string;
59
+ docs: {
60
+ description: string;
61
+ };
62
+ fixable: string;
63
+ schema: never[];
64
+ };
65
+ create(context: any): {
66
+ JSXAttribute(node: any): void;
67
+ };
68
+ };
56
69
  'jsx-expression-string-literals': {
57
70
  meta: {
58
71
  type: string;
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ '@typescript-eslint/naming-convention': (string | {
3
+ selector: string;
4
+ format: null;
5
+ custom: {
6
+ regex: string;
7
+ match: boolean;
8
+ };
9
+ })[];
10
+ };
11
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tcy/eslint-rules",
3
- "version": "1.4.4",
3
+ "version": "1.5.0",
4
4
  "description": "```typescript import { plugin as customRules } from 'tcy@eslint-rules/src/index.mjs';",
5
5
  "homepage": "https://github.com/tcastelly/eslint-rules#readme",
6
6
  "bugs": {
@@ -17,12 +17,20 @@
17
17
  "types": "decl/index.d.ts",
18
18
  "exports": {
19
19
  "./client": {
20
- "types": "./decl/client.d.ts",
21
- "import": "./src/client.js"
20
+ "types": "./decl/client/client.d.ts",
21
+ "import": "./src/client/client.js"
22
+ },
23
+ "./client/recommended": {
24
+ "types": "./decl/client/recommended.d.ts",
25
+ "import": "./src/client/recommended.js"
22
26
  },
23
27
  "./back": {
24
- "types": "./decl/back.d.ts",
25
- "import": "./src/back.js"
28
+ "types": "./decl/back/back.d.ts",
29
+ "import": "./src/back/back.js"
30
+ },
31
+ "./back/recommended": {
32
+ "types": "./decl/back/recommended.d.ts",
33
+ "import": "./src/back/recommended.js"
26
34
  }
27
35
  },
28
36
  "scripts": {
@@ -33,12 +41,12 @@
33
41
  },
34
42
  "devDependencies": {
35
43
  "@babel/core": "^7.29.0",
36
- "@babel/preset-env": "^7.29.2",
44
+ "@babel/preset-env": "^7.29.3",
37
45
  "@types/jest": "^30.0.0",
38
46
  "@types/node": "^25.6.0",
39
47
  "babel-jest": "^30.3.0",
40
48
  "jest": "^30.3.0",
41
49
  "rimraf": "^6.1.3",
42
- "typescript": "^6.0.2"
50
+ "typescript": "^6.0.3"
43
51
  }
44
52
  }
@@ -1,4 +1,4 @@
1
- import pluginConfig from './plugin.js'
1
+ import pluginConfig from '../plugin.js'
2
2
 
3
3
  export default {
4
4
  plugins: {
@@ -0,0 +1,5 @@
1
+ import recommended from '../recommended.js'
2
+
3
+ export default {
4
+ ...recommended,
5
+ }
@@ -1,4 +1,4 @@
1
- import pluginConfig from './plugin.js'
1
+ import pluginConfig from '../plugin.js'
2
2
 
3
3
  export default {
4
4
  plugins: {
@@ -7,10 +7,12 @@ export default {
7
7
  },
8
8
  },
9
9
  rules: {
10
+ // apply `tcy` rules
10
11
  'tcy/import-specifiers-per-line': ['error', { maxSpecifiers: 4 }],
11
12
  'tcy/export-specifiers-per-line': 'error',
12
13
  'tcy/array-elements-per-line': 'error',
13
14
  'tcy/jsx-expression-string-literals': 'error',
15
+ 'tcy/jsx-boolean-shorthand': 'error',
14
16
  'tcy/enforce-tailwind-important': 'error',
15
17
  'tcy/v-model-name-match': 'error',
16
18
  'tcy/vuejs-define-component': 'error',
@@ -0,0 +1,5 @@
1
+ import recommended from '../recommended.js'
2
+
3
+ export default {
4
+ ...recommended,
5
+ }
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * as client from './client.js'
2
- export * as back from './back.js'
1
+ export * as client from './client/client.js'
2
+ export * as back from './back/back.js'
@@ -0,0 +1,35 @@
1
+ export default {
2
+ meta: {
3
+ type: 'suggestion',
4
+ docs: {
5
+ description: 'Enforce shorthand boolean syntax in JSX props',
6
+ },
7
+ fixable: 'code',
8
+ schema: [],
9
+ },
10
+ create(context) {
11
+ return {
12
+ JSXAttribute(node) {
13
+ // Only check boolean values in JSX
14
+ if (node.value && node.value.type === 'JSXExpressionContainer') {
15
+ const expression = node.value.expression;
16
+
17
+ // Check if the value is a boolean literal 'true'
18
+ if (expression.type === 'Literal' && expression.value === true) {
19
+ context.report({
20
+ node,
21
+ message: 'Use shorthand boolean syntax instead of {{value}}',
22
+ data: {
23
+ value: node.value.raw || node.value.expression.raw,
24
+ },
25
+ fix(fixer) {
26
+ // Remove the expression container and just keep the attribute name
27
+ return fixer.replaceText(node, node.name.name);
28
+ },
29
+ });
30
+ }
31
+ }
32
+ },
33
+ };
34
+ },
35
+ };
package/src/plugin.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import importSpecifiersPerLineRule from './import-specifiers-per-line.js';
2
2
  import arrayElementsPerLineRule from './array-elements-per-line.js';
3
3
  import exportSpecifiersPerLineRule from './export-specifiers-per-line.js';
4
+ import jsxBooleanShorthand from './jsx-boolean-shorthand.js'
4
5
  import jsxExpressionStringLiterals from './jsx-expression-string-literals.js';
5
6
  import enforceTailwindImportant from './enforce-tailwind-important.js';
6
7
  import vModelNameMatch from './v-model-name-match.js';
@@ -12,6 +13,7 @@ export default {
12
13
  'import-specifiers-per-line': importSpecifiersPerLineRule,
13
14
  'array-elements-per-line': arrayElementsPerLineRule,
14
15
  'export-specifiers-per-line': exportSpecifiersPerLineRule,
16
+ 'jsx-boolean-shorthand': jsxBooleanShorthand,
15
17
  'jsx-expression-string-literals': jsxExpressionStringLiterals,
16
18
  'enforce-tailwind-important': enforceTailwindImportant,
17
19
  'v-model-name-match': vModelNameMatch,
@@ -0,0 +1,13 @@
1
+ export default {
2
+ '@typescript-eslint/naming-convention': [
3
+ 'error',
4
+ {
5
+ selector: 'variable',
6
+ format: null,
7
+ custom: {
8
+ regex: '^(_?[a-zA-Z0-9]*)|([A-Z0-9_])$',
9
+ match: true,
10
+ },
11
+ },
12
+ ],
13
+ }