eslint-config-typed 2.3.2 → 3.0.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 (124) hide show
  1. package/README.md +29 -26
  2. package/dist/configs/plugins.d.mts +1 -1
  3. package/dist/configs/plugins.d.mts.map +1 -1
  4. package/dist/configs/plugins.mjs +2 -0
  5. package/dist/configs/plugins.mjs.map +1 -1
  6. package/dist/configs/react-base.d.mts.map +1 -1
  7. package/dist/configs/react-base.mjs +2 -0
  8. package/dist/configs/react-base.mjs.map +1 -1
  9. package/dist/entry-point.d.mts +1 -1
  10. package/dist/entry-point.d.mts.map +1 -1
  11. package/dist/entry-point.mjs +2 -1
  12. package/dist/entry-point.mjs.map +1 -1
  13. package/dist/index.mjs +3 -1
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/plugins/index.d.mts +1 -0
  16. package/dist/plugins/index.d.mts.map +1 -1
  17. package/dist/plugins/index.mjs +1 -0
  18. package/dist/plugins/index.mjs.map +1 -1
  19. package/dist/plugins/react-coding-style/index.d.mts +2 -0
  20. package/dist/plugins/react-coding-style/index.d.mts.map +1 -0
  21. package/dist/plugins/react-coding-style/index.mjs +2 -0
  22. package/dist/plugins/react-coding-style/index.mjs.map +1 -0
  23. package/dist/plugins/react-coding-style/plugin.d.mts +3 -0
  24. package/dist/plugins/react-coding-style/plugin.d.mts.map +1 -0
  25. package/dist/plugins/react-coding-style/plugin.mjs +8 -0
  26. package/dist/plugins/react-coding-style/plugin.mjs.map +1 -0
  27. package/dist/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.d.mts +5 -0
  28. package/dist/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.d.mts.map +1 -0
  29. package/dist/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.mjs +29 -0
  30. package/dist/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.mjs.map +1 -0
  31. package/dist/plugins/react-coding-style/rules/component-name.d.mts +10 -0
  32. package/dist/plugins/react-coding-style/rules/component-name.d.mts.map +1 -0
  33. package/dist/plugins/react-coding-style/rules/component-name.mjs +78 -0
  34. package/dist/plugins/react-coding-style/rules/component-name.mjs.map +1 -0
  35. package/dist/plugins/react-coding-style/rules/component-var-type-annotation.d.mts +5 -0
  36. package/dist/plugins/react-coding-style/rules/component-var-type-annotation.d.mts.map +1 -0
  37. package/dist/plugins/react-coding-style/rules/component-var-type-annotation.mjs +41 -0
  38. package/dist/plugins/react-coding-style/rules/component-var-type-annotation.mjs.map +1 -0
  39. package/dist/plugins/react-coding-style/rules/import-style.d.mts +5 -0
  40. package/dist/plugins/react-coding-style/rules/import-style.d.mts.map +1 -0
  41. package/dist/plugins/react-coding-style/rules/import-style.mjs +45 -0
  42. package/dist/plugins/react-coding-style/rules/import-style.mjs.map +1 -0
  43. package/dist/plugins/react-coding-style/rules/index.d.mts +2 -0
  44. package/dist/plugins/react-coding-style/rules/index.d.mts.map +1 -0
  45. package/dist/plugins/react-coding-style/rules/index.mjs +2 -0
  46. package/dist/plugins/react-coding-style/rules/index.mjs.map +1 -0
  47. package/dist/plugins/react-coding-style/rules/props-type-annotation-style.d.mts +5 -0
  48. package/dist/plugins/react-coding-style/rules/props-type-annotation-style.d.mts.map +1 -0
  49. package/dist/plugins/react-coding-style/rules/props-type-annotation-style.mjs +44 -0
  50. package/dist/plugins/react-coding-style/rules/props-type-annotation-style.mjs.map +1 -0
  51. package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.d.mts +5 -0
  52. package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.d.mts.map +1 -0
  53. package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.mjs +55 -0
  54. package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.mjs.map +1 -0
  55. package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.d.mts +5 -0
  56. package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.d.mts.map +1 -0
  57. package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.mjs +78 -0
  58. package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.mjs.map +1 -0
  59. package/dist/plugins/react-coding-style/rules/rules.d.mts +14 -0
  60. package/dist/plugins/react-coding-style/rules/rules.d.mts.map +1 -0
  61. package/dist/plugins/react-coding-style/rules/rules.mjs +22 -0
  62. package/dist/plugins/react-coding-style/rules/rules.mjs.map +1 -0
  63. package/dist/plugins/react-coding-style/rules/shared.d.mts +5 -0
  64. package/dist/plugins/react-coding-style/rules/shared.d.mts.map +1 -0
  65. package/dist/plugins/react-coding-style/rules/shared.mjs +22 -0
  66. package/dist/plugins/react-coding-style/rules/shared.mjs.map +1 -0
  67. package/dist/plugins/react-coding-style/rules/use-memo-hooks-style.d.mts +5 -0
  68. package/dist/plugins/react-coding-style/rules/use-memo-hooks-style.d.mts.map +1 -0
  69. package/dist/plugins/react-coding-style/rules/use-memo-hooks-style.mjs +42 -0
  70. package/dist/plugins/react-coding-style/rules/use-memo-hooks-style.mjs.map +1 -0
  71. package/dist/rules/eslint-react-coding-style-rules.d.mts +13 -0
  72. package/dist/rules/eslint-react-coding-style-rules.d.mts.map +1 -0
  73. package/dist/rules/eslint-react-coding-style-rules.mjs +13 -0
  74. package/dist/rules/eslint-react-coding-style-rules.mjs.map +1 -0
  75. package/dist/rules/eslint-rules.d.mts +0 -57
  76. package/dist/rules/eslint-rules.d.mts.map +1 -1
  77. package/dist/rules/eslint-rules.mjs +1 -151
  78. package/dist/rules/eslint-rules.mjs.map +1 -1
  79. package/dist/rules/index.d.mts +1 -0
  80. package/dist/rules/index.d.mts.map +1 -1
  81. package/dist/rules/index.mjs +2 -1
  82. package/dist/rules/index.mjs.map +1 -1
  83. package/dist/types/define-known-rules.d.mts +2 -2
  84. package/dist/types/define-known-rules.d.mts.map +1 -1
  85. package/dist/types/define-known-rules.mjs.map +1 -1
  86. package/dist/types/rules/eslint-react-coding-style-rules.d.mts +148 -0
  87. package/dist/types/rules/eslint-react-coding-style-rules.d.mts.map +1 -0
  88. package/dist/types/rules/eslint-react-coding-style-rules.mjs +2 -0
  89. package/dist/types/rules/eslint-react-coding-style-rules.mjs.map +1 -0
  90. package/dist/types/rules/index.d.mts +1 -0
  91. package/dist/types/rules/index.d.mts.map +1 -1
  92. package/package.json +1 -5
  93. package/src/configs/plugins.mts +3 -0
  94. package/src/configs/react-base.mts +2 -0
  95. package/src/entry-point.mts +2 -1
  96. package/src/plugins/index.mts +1 -0
  97. package/src/plugins/react-coding-style/README.md +36 -0
  98. package/src/plugins/react-coding-style/index.mts +1 -0
  99. package/src/plugins/react-coding-style/plugin.mts +6 -0
  100. package/src/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.mts +31 -0
  101. package/src/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.test.mts +40 -0
  102. package/src/plugins/react-coding-style/rules/component-name.mts +93 -0
  103. package/src/plugins/react-coding-style/rules/component-name.test.mts +72 -0
  104. package/src/plugins/react-coding-style/rules/component-var-type-annotation.mts +54 -0
  105. package/src/plugins/react-coding-style/rules/component-var-type-annotation.test.mts +62 -0
  106. package/src/plugins/react-coding-style/rules/import-style.mts +53 -0
  107. package/src/plugins/react-coding-style/rules/import-style.test.mts +63 -0
  108. package/src/plugins/react-coding-style/rules/index.mts +1 -0
  109. package/src/plugins/react-coding-style/rules/props-type-annotation-style.mts +59 -0
  110. package/src/plugins/react-coding-style/rules/props-type-annotation-style.test.mts +71 -0
  111. package/src/plugins/react-coding-style/rules/react-memo-props-argument-name.mts +70 -0
  112. package/src/plugins/react-coding-style/rules/react-memo-props-argument-name.test.mts +56 -0
  113. package/src/plugins/react-coding-style/rules/react-memo-type-parameter.mts +102 -0
  114. package/src/plugins/react-coding-style/rules/react-memo-type-parameter.test.mts +98 -0
  115. package/src/plugins/react-coding-style/rules/rules.mts +20 -0
  116. package/src/plugins/react-coding-style/rules/shared.mts +33 -0
  117. package/src/plugins/react-coding-style/rules/use-memo-hooks-style.mts +52 -0
  118. package/src/plugins/react-coding-style/rules/use-memo-hooks-style.test.mts +72 -0
  119. package/src/rules/eslint-react-coding-style-rules.mts +12 -0
  120. package/src/rules/eslint-rules.mts +0 -181
  121. package/src/rules/index.mts +1 -0
  122. package/src/types/define-known-rules.mts +2 -0
  123. package/src/types/rules/eslint-react-coding-style-rules.mts +166 -0
  124. package/src/types/rules/index.mts +1 -0
@@ -0,0 +1,166 @@
1
+ /* cSpell:disable */
2
+ import { type Linter } from 'eslint';
3
+
4
+ type SpreadOptionsIfIsArray<
5
+ T extends readonly [Linter.StringSeverity, unknown],
6
+ > = T[1] extends readonly unknown[]
7
+ ? readonly [Linter.StringSeverity, ...T[1]]
8
+ : T;
9
+
10
+ /**
11
+ * Enforces naming conventions for variables assigned to React.memo(...)
12
+ * components.
13
+ *
14
+ * ```md
15
+ * | key | value |
16
+ * | :--------- | :--------- |
17
+ * | type | suggestion |
18
+ * | deprecated | false |
19
+ * ```
20
+ */
21
+ namespace ComponentName {
22
+ /**
23
+ * ### schema
24
+ *
25
+ * ```json
26
+ * [
27
+ * {
28
+ * "type": "object",
29
+ * "properties": {
30
+ * "maxLength": {
31
+ * "type": "integer",
32
+ * "minimum": 1
33
+ * },
34
+ * "pattern": {
35
+ * "type": "object"
36
+ * }
37
+ * },
38
+ * "additionalProperties": false
39
+ * }
40
+ * ]
41
+ * ```
42
+ */
43
+ export type Options = {
44
+ readonly maxLength?: number;
45
+ readonly pattern?: UnknownRecord;
46
+ };
47
+
48
+ export type RuleEntry =
49
+ | Linter.Severity
50
+ | SpreadOptionsIfIsArray<readonly [Linter.StringSeverity, Options]>
51
+ | 'off';
52
+ }
53
+
54
+ /**
55
+ * Disallows using React.FC / React.FunctionComponent type annotations.
56
+ *
57
+ * ```md
58
+ * | key | value |
59
+ * | :--------- | :--------- |
60
+ * | type | suggestion |
61
+ * | deprecated | false |
62
+ * ```
63
+ */
64
+ namespace ComponentVarTypeAnnotation {
65
+ export type RuleEntry = Linter.StringSeverity;
66
+ }
67
+
68
+ /**
69
+ * Enforces importing React with a single namespace import named 'React'.
70
+ *
71
+ * ```md
72
+ * | key | value |
73
+ * | :--------- | :--------- |
74
+ * | type | suggestion |
75
+ * | deprecated | false |
76
+ * ```
77
+ */
78
+ namespace ImportStyle {
79
+ export type RuleEntry = Linter.StringSeverity;
80
+ }
81
+
82
+ /**
83
+ * Forbids annotating props directly in the arrow function passed to React.memo.
84
+ *
85
+ * ```md
86
+ * | key | value |
87
+ * | :--------- | :--------- |
88
+ * | type | suggestion |
89
+ * | deprecated | false |
90
+ * ```
91
+ */
92
+ namespace PropsTypeAnnotationStyle {
93
+ export type RuleEntry = Linter.StringSeverity;
94
+ }
95
+
96
+ /**
97
+ * Enforces the arrow function passed to React.memo to use a single argument
98
+ * named 'props'.
99
+ *
100
+ * ```md
101
+ * | key | value |
102
+ * | :--------- | :--------- |
103
+ * | type | suggestion |
104
+ * | deprecated | false |
105
+ * ```
106
+ */
107
+ namespace ReactMemoPropsArgumentName {
108
+ export type RuleEntry = Linter.StringSeverity;
109
+ }
110
+
111
+ /**
112
+ * Requires React.memo calls to have the type parameter 'Props'.
113
+ *
114
+ * ```md
115
+ * | key | value |
116
+ * | :--------- | :--------- |
117
+ * | type | suggestion |
118
+ * | deprecated | false |
119
+ * ```
120
+ */
121
+ namespace ReactMemoTypeParameter {
122
+ export type RuleEntry = Linter.StringSeverity;
123
+ }
124
+
125
+ /**
126
+ * Restricts React.useMemo hook usage patterns for consistent styles.
127
+ *
128
+ * ```md
129
+ * | key | value |
130
+ * | :--------- | :--------- |
131
+ * | type | suggestion |
132
+ * | deprecated | false |
133
+ * ```
134
+ */
135
+ namespace UseMemoHookStyle {
136
+ export type RuleEntry = Linter.StringSeverity;
137
+ }
138
+
139
+ /**
140
+ * Restricts specific React hook usage patterns for consistent component styles.
141
+ *
142
+ * ```md
143
+ * | key | value |
144
+ * | :--------- | :--------- |
145
+ * | type | suggestion |
146
+ * | deprecated | false |
147
+ * ```
148
+ */
149
+ namespace BanUseImperativeHandleHook {
150
+ export type RuleEntry = Linter.StringSeverity;
151
+ }
152
+
153
+ export type EslintReactCodingStyleRules = {
154
+ readonly 'react-coding-style/component-name': ComponentName.RuleEntry;
155
+ readonly 'react-coding-style/component-var-type-annotation': ComponentVarTypeAnnotation.RuleEntry;
156
+ readonly 'react-coding-style/import-style': ImportStyle.RuleEntry;
157
+ readonly 'react-coding-style/props-type-annotation-style': PropsTypeAnnotationStyle.RuleEntry;
158
+ readonly 'react-coding-style/react-memo-props-argument-name': ReactMemoPropsArgumentName.RuleEntry;
159
+ readonly 'react-coding-style/react-memo-type-parameter': ReactMemoTypeParameter.RuleEntry;
160
+ readonly 'react-coding-style/use-memo-hook-style': UseMemoHookStyle.RuleEntry;
161
+ readonly 'react-coding-style/ban-use-imperative-handle-hook': BanUseImperativeHandleHook.RuleEntry;
162
+ };
163
+
164
+ export type EslintReactCodingStyleRulesOption = {
165
+ readonly 'react-coding-style/component-name': ComponentName.Options;
166
+ };
@@ -10,6 +10,7 @@ export * from './eslint-plugin-rules.mjs';
10
10
  export * from './eslint-plugin-sort-destructure-keys-rules.mjs';
11
11
  export * from './eslint-prefer-arrow-functions-rules.mjs';
12
12
  export * from './eslint-promise-rules.mjs';
13
+ export * from './eslint-react-coding-style-rules.mjs';
13
14
  export * from './eslint-react-hooks-rules.mjs';
14
15
  export * from './eslint-react-perf-rules.mjs';
15
16
  export * from './eslint-react-refresh-rules.mjs';