eslint-plugin-nextfriday 1.0.2 → 1.1.1
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/CHANGELOG.md +12 -0
- package/README.md +24 -15
- package/docs/rules/PREFER_INTERFACE_OVER_INLINE_TYPES.md +211 -0
- package/docs/rules/PREFER_REACT_IMPORT_TYPES.md +175 -0
- package/docs/rules/REACT_PROPS_DESTRUCTURE.md +158 -0
- package/lib/index.cjs +317 -6
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +42 -0
- package/lib/index.d.ts +42 -0
- package/lib/index.js +317 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -12,6 +12,9 @@ declare const rules: {
|
|
|
12
12
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
13
13
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
14
14
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
15
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
16
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
17
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
15
18
|
};
|
|
16
19
|
declare const configs: {
|
|
17
20
|
readonly base: {
|
|
@@ -29,6 +32,9 @@ declare const configs: {
|
|
|
29
32
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
30
33
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
31
34
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
35
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
36
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
37
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
32
38
|
};
|
|
33
39
|
};
|
|
34
40
|
};
|
|
@@ -49,6 +55,9 @@ declare const configs: {
|
|
|
49
55
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
50
56
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
51
57
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
58
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
59
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
60
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
52
61
|
};
|
|
53
62
|
};
|
|
54
63
|
};
|
|
@@ -69,6 +78,9 @@ declare const configs: {
|
|
|
69
78
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
70
79
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
71
80
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
81
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
82
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
83
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
72
84
|
};
|
|
73
85
|
};
|
|
74
86
|
};
|
|
@@ -89,6 +101,9 @@ declare const configs: {
|
|
|
89
101
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
90
102
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
91
103
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
104
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
105
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
106
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
92
107
|
};
|
|
93
108
|
};
|
|
94
109
|
};
|
|
@@ -109,6 +124,9 @@ declare const configs: {
|
|
|
109
124
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
110
125
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
111
126
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
127
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
128
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
129
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
112
130
|
};
|
|
113
131
|
};
|
|
114
132
|
};
|
|
@@ -129,6 +147,9 @@ declare const configs: {
|
|
|
129
147
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
130
148
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
131
149
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
150
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
151
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
152
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
132
153
|
};
|
|
133
154
|
};
|
|
134
155
|
};
|
|
@@ -156,6 +177,9 @@ declare const nextfridayPlugin: {
|
|
|
156
177
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
157
178
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
158
179
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
180
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
181
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
182
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
159
183
|
};
|
|
160
184
|
};
|
|
161
185
|
};
|
|
@@ -176,6 +200,9 @@ declare const nextfridayPlugin: {
|
|
|
176
200
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
177
201
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
178
202
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
203
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
204
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
205
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
179
206
|
};
|
|
180
207
|
};
|
|
181
208
|
};
|
|
@@ -196,6 +223,9 @@ declare const nextfridayPlugin: {
|
|
|
196
223
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
197
224
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
198
225
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
226
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
227
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
228
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
199
229
|
};
|
|
200
230
|
};
|
|
201
231
|
};
|
|
@@ -216,6 +246,9 @@ declare const nextfridayPlugin: {
|
|
|
216
246
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
217
247
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
218
248
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
249
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
250
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
251
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
219
252
|
};
|
|
220
253
|
};
|
|
221
254
|
};
|
|
@@ -236,6 +269,9 @@ declare const nextfridayPlugin: {
|
|
|
236
269
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
237
270
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
238
271
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
272
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
273
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
274
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
239
275
|
};
|
|
240
276
|
};
|
|
241
277
|
};
|
|
@@ -256,6 +292,9 @@ declare const nextfridayPlugin: {
|
|
|
256
292
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
257
293
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
258
294
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
295
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
296
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
297
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
259
298
|
};
|
|
260
299
|
};
|
|
261
300
|
};
|
|
@@ -270,6 +309,9 @@ declare const nextfridayPlugin: {
|
|
|
270
309
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
271
310
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
272
311
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
312
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
313
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
314
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
273
315
|
};
|
|
274
316
|
};
|
|
275
317
|
|
package/lib/index.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ declare const rules: {
|
|
|
12
12
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
13
13
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
14
14
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
15
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
16
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
17
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
15
18
|
};
|
|
16
19
|
declare const configs: {
|
|
17
20
|
readonly base: {
|
|
@@ -29,6 +32,9 @@ declare const configs: {
|
|
|
29
32
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
30
33
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
31
34
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
35
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
36
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
37
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
32
38
|
};
|
|
33
39
|
};
|
|
34
40
|
};
|
|
@@ -49,6 +55,9 @@ declare const configs: {
|
|
|
49
55
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
50
56
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
51
57
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
58
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
59
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
60
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
52
61
|
};
|
|
53
62
|
};
|
|
54
63
|
};
|
|
@@ -69,6 +78,9 @@ declare const configs: {
|
|
|
69
78
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
70
79
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
71
80
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
81
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
82
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
83
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
72
84
|
};
|
|
73
85
|
};
|
|
74
86
|
};
|
|
@@ -89,6 +101,9 @@ declare const configs: {
|
|
|
89
101
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
90
102
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
91
103
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
104
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
105
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
106
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
92
107
|
};
|
|
93
108
|
};
|
|
94
109
|
};
|
|
@@ -109,6 +124,9 @@ declare const configs: {
|
|
|
109
124
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
110
125
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
111
126
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
127
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
128
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
129
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
112
130
|
};
|
|
113
131
|
};
|
|
114
132
|
};
|
|
@@ -129,6 +147,9 @@ declare const configs: {
|
|
|
129
147
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
130
148
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
131
149
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
150
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
151
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
152
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
132
153
|
};
|
|
133
154
|
};
|
|
134
155
|
};
|
|
@@ -156,6 +177,9 @@ declare const nextfridayPlugin: {
|
|
|
156
177
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
157
178
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
158
179
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
180
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
181
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
182
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
159
183
|
};
|
|
160
184
|
};
|
|
161
185
|
};
|
|
@@ -176,6 +200,9 @@ declare const nextfridayPlugin: {
|
|
|
176
200
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
177
201
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
178
202
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
203
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
204
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
205
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
179
206
|
};
|
|
180
207
|
};
|
|
181
208
|
};
|
|
@@ -196,6 +223,9 @@ declare const nextfridayPlugin: {
|
|
|
196
223
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
197
224
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
198
225
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
226
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
227
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
228
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
199
229
|
};
|
|
200
230
|
};
|
|
201
231
|
};
|
|
@@ -216,6 +246,9 @@ declare const nextfridayPlugin: {
|
|
|
216
246
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
217
247
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
218
248
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
249
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
250
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
251
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
219
252
|
};
|
|
220
253
|
};
|
|
221
254
|
};
|
|
@@ -236,6 +269,9 @@ declare const nextfridayPlugin: {
|
|
|
236
269
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
237
270
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
238
271
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
272
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
273
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
274
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
239
275
|
};
|
|
240
276
|
};
|
|
241
277
|
};
|
|
@@ -256,6 +292,9 @@ declare const nextfridayPlugin: {
|
|
|
256
292
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
257
293
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
258
294
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
295
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
296
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
297
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
259
298
|
};
|
|
260
299
|
};
|
|
261
300
|
};
|
|
@@ -270,6 +309,9 @@ declare const nextfridayPlugin: {
|
|
|
270
309
|
readonly "no-explicit-return-type": TSESLint.RuleModule<"noExplicitReturnType", [], unknown, TSESLint.RuleListener>;
|
|
271
310
|
readonly "prefer-destructuring-params": TSESLint.RuleModule<"preferDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
272
311
|
readonly "prefer-import-type": TSESLint.RuleModule<"preferImportType", [], unknown, TSESLint.RuleListener>;
|
|
312
|
+
readonly "prefer-interface-over-inline-types": TSESLint.RuleModule<"useInterface", [], unknown, TSESLint.RuleListener>;
|
|
313
|
+
readonly "prefer-react-import-types": TSESLint.RuleModule<"preferDirectImport", [], unknown, TSESLint.RuleListener>;
|
|
314
|
+
readonly "react-props-destructure": TSESLint.RuleModule<"noParameterDestructuring", [], unknown, TSESLint.RuleListener>;
|
|
273
315
|
};
|
|
274
316
|
};
|
|
275
317
|
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "eslint-plugin-nextfriday",
|
|
4
|
-
version: "1.
|
|
4
|
+
version: "1.1.1",
|
|
5
5
|
description: "A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.",
|
|
6
6
|
keywords: [
|
|
7
7
|
"eslint",
|
|
@@ -444,6 +444,308 @@ var preferImportType = createRule7({
|
|
|
444
444
|
});
|
|
445
445
|
var prefer_import_type_default = preferImportType;
|
|
446
446
|
|
|
447
|
+
// src/rules/prefer-interface-over-inline-types.ts
|
|
448
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES3, ESLintUtils as ESLintUtils8 } from "@typescript-eslint/utils";
|
|
449
|
+
var createRule8 = ESLintUtils8.RuleCreator(
|
|
450
|
+
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name}.md`
|
|
451
|
+
);
|
|
452
|
+
var preferInterfaceOverInlineTypes = createRule8({
|
|
453
|
+
name: "prefer-interface-over-inline-types",
|
|
454
|
+
meta: {
|
|
455
|
+
type: "suggestion",
|
|
456
|
+
docs: {
|
|
457
|
+
description: "Enforce interface declarations over inline type annotations for React component props"
|
|
458
|
+
},
|
|
459
|
+
fixable: void 0,
|
|
460
|
+
schema: [],
|
|
461
|
+
messages: {
|
|
462
|
+
useInterface: "Use interface declaration for component props instead of inline type annotation"
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
defaultOptions: [],
|
|
466
|
+
create(context) {
|
|
467
|
+
function hasJSXInConditional(node) {
|
|
468
|
+
return node.consequent.type === AST_NODE_TYPES3.JSXElement || node.consequent.type === AST_NODE_TYPES3.JSXFragment || node.alternate.type === AST_NODE_TYPES3.JSXElement || node.alternate.type === AST_NODE_TYPES3.JSXFragment;
|
|
469
|
+
}
|
|
470
|
+
function hasJSXInLogical(node) {
|
|
471
|
+
return node.right.type === AST_NODE_TYPES3.JSXElement || node.right.type === AST_NODE_TYPES3.JSXFragment;
|
|
472
|
+
}
|
|
473
|
+
function hasJSXReturn(block) {
|
|
474
|
+
return block.body.some((stmt) => {
|
|
475
|
+
if (stmt.type === AST_NODE_TYPES3.ReturnStatement && stmt.argument) {
|
|
476
|
+
return stmt.argument.type === AST_NODE_TYPES3.JSXElement || stmt.argument.type === AST_NODE_TYPES3.JSXFragment || stmt.argument.type === AST_NODE_TYPES3.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES3.LogicalExpression && hasJSXInLogical(stmt.argument);
|
|
477
|
+
}
|
|
478
|
+
return false;
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
function isReactComponent(node) {
|
|
482
|
+
if (node.type === AST_NODE_TYPES3.ArrowFunctionExpression) {
|
|
483
|
+
if (node.body.type === AST_NODE_TYPES3.JSXElement || node.body.type === AST_NODE_TYPES3.JSXFragment) {
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
486
|
+
if (node.body.type === AST_NODE_TYPES3.BlockStatement) {
|
|
487
|
+
return hasJSXReturn(node.body);
|
|
488
|
+
}
|
|
489
|
+
} else if (node.type === AST_NODE_TYPES3.FunctionExpression || node.type === AST_NODE_TYPES3.FunctionDeclaration) {
|
|
490
|
+
if (node.body && node.body.type === AST_NODE_TYPES3.BlockStatement) {
|
|
491
|
+
return hasJSXReturn(node.body);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
function isInlineTypeAnnotation(node) {
|
|
497
|
+
if (node.type === AST_NODE_TYPES3.TSTypeLiteral) {
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
if (node.type === AST_NODE_TYPES3.TSTypeReference && node.typeArguments) {
|
|
501
|
+
return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES3.TSTypeLiteral);
|
|
502
|
+
}
|
|
503
|
+
if (node.type === AST_NODE_TYPES3.TSUnionType) {
|
|
504
|
+
return node.types.some((type) => isInlineTypeAnnotation(type));
|
|
505
|
+
}
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
function hasInlineObjectType(node) {
|
|
509
|
+
if (node.type === AST_NODE_TYPES3.TSTypeLiteral) {
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
if (node.type === AST_NODE_TYPES3.TSTypeReference && node.typeArguments) {
|
|
513
|
+
return node.typeArguments.params.some((param) => param.type === AST_NODE_TYPES3.TSTypeLiteral);
|
|
514
|
+
}
|
|
515
|
+
if (node.type === AST_NODE_TYPES3.TSUnionType) {
|
|
516
|
+
return node.types.some((type) => hasInlineObjectType(type));
|
|
517
|
+
}
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
function checkFunction(node) {
|
|
521
|
+
if (!isReactComponent(node)) {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
if (node.params.length !== 1) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const param = node.params[0];
|
|
528
|
+
if (param.type === AST_NODE_TYPES3.Identifier && param.typeAnnotation) {
|
|
529
|
+
const { typeAnnotation } = param.typeAnnotation;
|
|
530
|
+
if (isInlineTypeAnnotation(typeAnnotation) && hasInlineObjectType(typeAnnotation)) {
|
|
531
|
+
context.report({
|
|
532
|
+
node: param.typeAnnotation,
|
|
533
|
+
messageId: "useInterface"
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
ArrowFunctionExpression: checkFunction,
|
|
540
|
+
FunctionExpression: checkFunction,
|
|
541
|
+
FunctionDeclaration: checkFunction
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
var prefer_interface_over_inline_types_default = preferInterfaceOverInlineTypes;
|
|
546
|
+
|
|
547
|
+
// src/rules/prefer-react-import-types.ts
|
|
548
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES4, ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
|
|
549
|
+
var createRule9 = ESLintUtils9.RuleCreator(
|
|
550
|
+
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name}.md`
|
|
551
|
+
);
|
|
552
|
+
var preferReactImportTypes = createRule9({
|
|
553
|
+
name: "prefer-react-import-types",
|
|
554
|
+
meta: {
|
|
555
|
+
type: "suggestion",
|
|
556
|
+
docs: {
|
|
557
|
+
description: "Enforce importing React types and utilities from 'react' instead of using React.X"
|
|
558
|
+
},
|
|
559
|
+
fixable: "code",
|
|
560
|
+
schema: [],
|
|
561
|
+
messages: {
|
|
562
|
+
preferDirectImport: "Use direct import '{{importStatement}}' instead of 'React.{{typeName}}'"
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
defaultOptions: [],
|
|
566
|
+
create(context) {
|
|
567
|
+
const reactTypes = /* @__PURE__ */ new Set([
|
|
568
|
+
"ReactNode",
|
|
569
|
+
"ReactElement",
|
|
570
|
+
"ReactChildren",
|
|
571
|
+
"ReactChild",
|
|
572
|
+
"ComponentType",
|
|
573
|
+
"FC",
|
|
574
|
+
"FunctionComponent",
|
|
575
|
+
"Component",
|
|
576
|
+
"PureComponent",
|
|
577
|
+
"ReactEventHandler",
|
|
578
|
+
"MouseEventHandler",
|
|
579
|
+
"ChangeEventHandler",
|
|
580
|
+
"FormEventHandler",
|
|
581
|
+
"KeyboardEventHandler",
|
|
582
|
+
"TouchEventHandler",
|
|
583
|
+
"PointerEventHandler",
|
|
584
|
+
"FocusEventHandler",
|
|
585
|
+
"UIEventHandler",
|
|
586
|
+
"WheelEventHandler",
|
|
587
|
+
"AnimationEventHandler",
|
|
588
|
+
"TransitionEventHandler",
|
|
589
|
+
"RefObject",
|
|
590
|
+
"MutableRefObject",
|
|
591
|
+
"Ref",
|
|
592
|
+
"ForwardedRef",
|
|
593
|
+
"HTMLProps",
|
|
594
|
+
"ComponentProps",
|
|
595
|
+
"JSXElementConstructor"
|
|
596
|
+
]);
|
|
597
|
+
const reactRuntimeExports = /* @__PURE__ */ new Set([
|
|
598
|
+
"useState",
|
|
599
|
+
"useEffect",
|
|
600
|
+
"useContext",
|
|
601
|
+
"useReducer",
|
|
602
|
+
"useCallback",
|
|
603
|
+
"useMemo",
|
|
604
|
+
"useRef",
|
|
605
|
+
"useImperativeHandle",
|
|
606
|
+
"useLayoutEffect",
|
|
607
|
+
"useDebugValue",
|
|
608
|
+
"useDeferredValue",
|
|
609
|
+
"useTransition",
|
|
610
|
+
"useId",
|
|
611
|
+
"useSyncExternalStore",
|
|
612
|
+
"useInsertionEffect",
|
|
613
|
+
"createElement",
|
|
614
|
+
"createContext",
|
|
615
|
+
"forwardRef",
|
|
616
|
+
"memo",
|
|
617
|
+
"lazy",
|
|
618
|
+
"Suspense",
|
|
619
|
+
"Fragment",
|
|
620
|
+
"StrictMode",
|
|
621
|
+
"createRef",
|
|
622
|
+
"isValidElement",
|
|
623
|
+
"cloneElement",
|
|
624
|
+
"Children"
|
|
625
|
+
]);
|
|
626
|
+
const allReactExports = /* @__PURE__ */ new Set([...reactTypes, ...reactRuntimeExports]);
|
|
627
|
+
function checkMemberExpression(node) {
|
|
628
|
+
if (node.object.type === AST_NODE_TYPES4.Identifier && node.object.name === "React" && node.property.type === AST_NODE_TYPES4.Identifier && allReactExports.has(node.property.name)) {
|
|
629
|
+
const typeName = node.property.name;
|
|
630
|
+
const isType = reactTypes.has(typeName);
|
|
631
|
+
const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
|
|
632
|
+
context.report({
|
|
633
|
+
node,
|
|
634
|
+
messageId: "preferDirectImport",
|
|
635
|
+
data: { typeName, importStatement },
|
|
636
|
+
fix(fixer) {
|
|
637
|
+
return fixer.replaceText(node, typeName);
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return {
|
|
643
|
+
MemberExpression: checkMemberExpression,
|
|
644
|
+
"TSTypeReference > TSQualifiedName": (node) => {
|
|
645
|
+
if (node.left.type === AST_NODE_TYPES4.Identifier && node.left.name === "React" && node.right.type === AST_NODE_TYPES4.Identifier && allReactExports.has(node.right.name)) {
|
|
646
|
+
const typeName = node.right.name;
|
|
647
|
+
const isType = reactTypes.has(typeName);
|
|
648
|
+
const importStatement = isType ? `import type { ${typeName} } from "react"` : `import { ${typeName} } from "react"`;
|
|
649
|
+
context.report({
|
|
650
|
+
node,
|
|
651
|
+
messageId: "preferDirectImport",
|
|
652
|
+
data: { typeName, importStatement },
|
|
653
|
+
fix(fixer) {
|
|
654
|
+
return fixer.replaceText(node, typeName);
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
var prefer_react_import_types_default = preferReactImportTypes;
|
|
663
|
+
|
|
664
|
+
// src/rules/react-props-destructure.ts
|
|
665
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES5, ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
|
|
666
|
+
var createRule10 = ESLintUtils10.RuleCreator(
|
|
667
|
+
(name) => `https://github.com/next-friday/eslint-plugin-nextfriday/blob/main/docs/rules/${name}.md`
|
|
668
|
+
);
|
|
669
|
+
var reactPropsDestructure = createRule10({
|
|
670
|
+
name: "react-props-destructure",
|
|
671
|
+
meta: {
|
|
672
|
+
type: "suggestion",
|
|
673
|
+
docs: {
|
|
674
|
+
description: "Enforce destructuring props inside React component body instead of parameters"
|
|
675
|
+
},
|
|
676
|
+
fixable: void 0,
|
|
677
|
+
schema: [],
|
|
678
|
+
messages: {
|
|
679
|
+
noParameterDestructuring: "Destructure props inside component body instead of parameters. Use 'const { {{properties}} } = props;'"
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
defaultOptions: [],
|
|
683
|
+
create(context) {
|
|
684
|
+
function hasJSXInConditional(node) {
|
|
685
|
+
return node.consequent.type === AST_NODE_TYPES5.JSXElement || node.consequent.type === AST_NODE_TYPES5.JSXFragment || node.alternate.type === AST_NODE_TYPES5.JSXElement || node.alternate.type === AST_NODE_TYPES5.JSXFragment;
|
|
686
|
+
}
|
|
687
|
+
function hasJSXInLogical(node) {
|
|
688
|
+
return node.right.type === AST_NODE_TYPES5.JSXElement || node.right.type === AST_NODE_TYPES5.JSXFragment;
|
|
689
|
+
}
|
|
690
|
+
function hasJSXReturn(block) {
|
|
691
|
+
return block.body.some((stmt) => {
|
|
692
|
+
if (stmt.type === AST_NODE_TYPES5.ReturnStatement && stmt.argument) {
|
|
693
|
+
return stmt.argument.type === AST_NODE_TYPES5.JSXElement || stmt.argument.type === AST_NODE_TYPES5.JSXFragment || stmt.argument.type === AST_NODE_TYPES5.ConditionalExpression && hasJSXInConditional(stmt.argument) || stmt.argument.type === AST_NODE_TYPES5.LogicalExpression && hasJSXInLogical(stmt.argument);
|
|
694
|
+
}
|
|
695
|
+
return false;
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
function isReactComponent(node) {
|
|
699
|
+
if (node.type === AST_NODE_TYPES5.ArrowFunctionExpression) {
|
|
700
|
+
if (node.body.type === AST_NODE_TYPES5.JSXElement || node.body.type === AST_NODE_TYPES5.JSXFragment) {
|
|
701
|
+
return true;
|
|
702
|
+
}
|
|
703
|
+
if (node.body.type === AST_NODE_TYPES5.BlockStatement) {
|
|
704
|
+
return hasJSXReturn(node.body);
|
|
705
|
+
}
|
|
706
|
+
} else if (node.type === AST_NODE_TYPES5.FunctionExpression || node.type === AST_NODE_TYPES5.FunctionDeclaration) {
|
|
707
|
+
if (node.body && node.body.type === AST_NODE_TYPES5.BlockStatement) {
|
|
708
|
+
return hasJSXReturn(node.body);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
function checkFunction(node) {
|
|
714
|
+
if (!isReactComponent(node)) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
if (node.params.length !== 1) {
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
const param = node.params[0];
|
|
721
|
+
if (param.type === AST_NODE_TYPES5.ObjectPattern) {
|
|
722
|
+
const properties = param.properties.filter((prop) => prop.type === AST_NODE_TYPES5.Property).map((prop) => {
|
|
723
|
+
if (prop.key.type === AST_NODE_TYPES5.Identifier) {
|
|
724
|
+
return prop.key.name;
|
|
725
|
+
}
|
|
726
|
+
return null;
|
|
727
|
+
}).filter((name) => name !== null);
|
|
728
|
+
if (properties.length === 0) {
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
context.report({
|
|
732
|
+
node: param,
|
|
733
|
+
messageId: "noParameterDestructuring",
|
|
734
|
+
data: {
|
|
735
|
+
properties: properties.join(", ")
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
return {
|
|
741
|
+
ArrowFunctionExpression: checkFunction,
|
|
742
|
+
FunctionExpression: checkFunction,
|
|
743
|
+
FunctionDeclaration: checkFunction
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
var react_props_destructure_default = reactPropsDestructure;
|
|
748
|
+
|
|
447
749
|
// src/index.ts
|
|
448
750
|
var meta = {
|
|
449
751
|
name: package_default.name,
|
|
@@ -456,7 +758,10 @@ var rules = {
|
|
|
456
758
|
"no-emoji": no_emoji_default,
|
|
457
759
|
"no-explicit-return-type": no_explicit_return_type_default,
|
|
458
760
|
"prefer-destructuring-params": prefer_destructuring_params_default,
|
|
459
|
-
"prefer-import-type": prefer_import_type_default
|
|
761
|
+
"prefer-import-type": prefer_import_type_default,
|
|
762
|
+
"prefer-interface-over-inline-types": prefer_interface_over_inline_types_default,
|
|
763
|
+
"prefer-react-import-types": prefer_react_import_types_default,
|
|
764
|
+
"react-props-destructure": react_props_destructure_default
|
|
460
765
|
};
|
|
461
766
|
var plugin = {
|
|
462
767
|
meta,
|
|
@@ -468,7 +773,8 @@ var baseRules = {
|
|
|
468
773
|
"nextfriday/md-filename-case-restriction": "warn",
|
|
469
774
|
"nextfriday/prefer-destructuring-params": "warn",
|
|
470
775
|
"nextfriday/no-explicit-return-type": "warn",
|
|
471
|
-
"nextfriday/prefer-import-type": "warn"
|
|
776
|
+
"nextfriday/prefer-import-type": "warn",
|
|
777
|
+
"nextfriday/prefer-react-import-types": "warn"
|
|
472
778
|
};
|
|
473
779
|
var baseRecommendedRules = {
|
|
474
780
|
"nextfriday/no-emoji": "error",
|
|
@@ -476,13 +782,18 @@ var baseRecommendedRules = {
|
|
|
476
782
|
"nextfriday/md-filename-case-restriction": "error",
|
|
477
783
|
"nextfriday/prefer-destructuring-params": "error",
|
|
478
784
|
"nextfriday/no-explicit-return-type": "error",
|
|
479
|
-
"nextfriday/prefer-import-type": "error"
|
|
785
|
+
"nextfriday/prefer-import-type": "error",
|
|
786
|
+
"nextfriday/prefer-react-import-types": "error"
|
|
480
787
|
};
|
|
481
788
|
var jsxRules = {
|
|
482
|
-
"nextfriday/jsx-pascal-case": "warn"
|
|
789
|
+
"nextfriday/jsx-pascal-case": "warn",
|
|
790
|
+
"nextfriday/prefer-interface-over-inline-types": "warn",
|
|
791
|
+
"nextfriday/react-props-destructure": "warn"
|
|
483
792
|
};
|
|
484
793
|
var jsxRecommendedRules = {
|
|
485
|
-
"nextfriday/jsx-pascal-case": "error"
|
|
794
|
+
"nextfriday/jsx-pascal-case": "error",
|
|
795
|
+
"nextfriday/prefer-interface-over-inline-types": "error",
|
|
796
|
+
"nextfriday/react-props-destructure": "error"
|
|
486
797
|
};
|
|
487
798
|
var createConfig = (configRules) => ({
|
|
488
799
|
plugins: {
|