@r_masseater/oxlint-typed-rules 0.1.1 → 0.1.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/LICENSE +258 -0
- package/README.md +35 -2
- package/dist/config-rules-CIyMUUvG.mjs +6 -0
- package/dist/config-rules-CIyMUUvG.mjs.map +1 -0
- package/dist/drizzle.d.mts +5 -0
- package/dist/drizzle.mjs +232 -0
- package/dist/drizzle.mjs.map +1 -0
- package/dist/eslint-utils-DauzR3x9.mjs +489 -0
- package/dist/eslint-utils-DauzR3x9.mjs.map +1 -0
- package/dist/index.d.mts +69 -17
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +16 -0
- package/dist/react.mjs +30826 -0
- package/dist/react.mjs.map +1 -0
- package/dist/rolldown-runtime-DQp2zzRu.mjs +41 -0
- package/dist/tanstack-query.d.mts +5 -0
- package/dist/tanstack-query.mjs +1379 -0
- package/dist/tanstack-query.mjs.map +1 -0
- package/dist/tanstack-router.d.mts +5 -0
- package/dist/tanstack-router.mjs +344 -0
- package/dist/tanstack-router.mjs.map +1 -0
- package/dist/tanstack-start.mjs +20 -297
- package/dist/tanstack-start.mjs.map +1 -1
- package/dist/ts-compat-kqrVqnFj.mjs +132 -0
- package/dist/ts-compat-kqrVqnFj.mjs.map +1 -0
- package/dist/typed-rule-DsbM82SI.mjs +300 -0
- package/dist/typed-rule-DsbM82SI.mjs.map +1 -0
- package/dist/typescript-eslint-utils-QnYasB-9.mjs +16 -0
- package/dist/typescript-eslint-utils-QnYasB-9.mjs.map +1 -0
- package/dist/upstream-plugin-DqJEA6iy.mjs +20 -0
- package/dist/upstream-plugin-DqJEA6iy.mjs.map +1 -0
- package/dist/upstream-plugin-xn91RvOJ.d.mts +15 -0
- package/package.json +70 -13
- package/dist/typed-rule-BPSyA0px.mjs +0 -146
- package/dist/typed-rule-BPSyA0px.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -48,6 +48,264 @@ SOFTWARE.
|
|
|
48
48
|
|
|
49
49
|
---
|
|
50
50
|
|
|
51
|
+
@tanstack/eslint-plugin-query
|
|
52
|
+
|
|
53
|
+
MIT License
|
|
54
|
+
|
|
55
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
56
|
+
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
59
|
+
in the Software without restriction, including without limitation the rights
|
|
60
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
62
|
+
furnished to do so, subject to the following conditions:
|
|
63
|
+
|
|
64
|
+
The above copyright notice and this permission notice shall be included in all
|
|
65
|
+
copies or substantial portions of the Software.
|
|
66
|
+
|
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
73
|
+
SOFTWARE.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
@tanstack/eslint-plugin-router
|
|
78
|
+
|
|
79
|
+
MIT License
|
|
80
|
+
|
|
81
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
82
|
+
|
|
83
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
84
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
85
|
+
in the Software without restriction, including without limitation the rights
|
|
86
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
87
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
88
|
+
furnished to do so, subject to the following conditions:
|
|
89
|
+
|
|
90
|
+
The above copyright notice and this permission notice shall be included in all
|
|
91
|
+
copies or substantial portions of the Software.
|
|
92
|
+
|
|
93
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
94
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
95
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
96
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
97
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
98
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
99
|
+
SOFTWARE.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
eslint-plugin-drizzle
|
|
104
|
+
|
|
105
|
+
Apache License
|
|
106
|
+
Version 2.0, January 2004
|
|
107
|
+
http://www.apache.org/licenses/
|
|
108
|
+
|
|
109
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
110
|
+
|
|
111
|
+
1. Definitions.
|
|
112
|
+
|
|
113
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
114
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
115
|
+
|
|
116
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
117
|
+
the copyright owner that is granting the License.
|
|
118
|
+
|
|
119
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
120
|
+
other entities that control, are controlled by, or are under common
|
|
121
|
+
control with that entity. For the purposes of this definition,
|
|
122
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
123
|
+
direction or management of such entity, whether by contract or
|
|
124
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
125
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
126
|
+
|
|
127
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
128
|
+
exercising permissions granted by this License.
|
|
129
|
+
|
|
130
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
131
|
+
including but not limited to software source code, documentation
|
|
132
|
+
source, and configuration files.
|
|
133
|
+
|
|
134
|
+
"Object" form shall mean any form resulting from mechanical
|
|
135
|
+
transformation or translation of a Source form, including but
|
|
136
|
+
not limited to compiled object code, generated documentation,
|
|
137
|
+
and conversions to other media types.
|
|
138
|
+
|
|
139
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
140
|
+
Object form, made available under the License, as indicated by a
|
|
141
|
+
copyright notice that is included in or attached to the work
|
|
142
|
+
(an example is provided in the Appendix below).
|
|
143
|
+
|
|
144
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
145
|
+
form, that is based on (or derived from) the Work and for which the
|
|
146
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
147
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
148
|
+
of this License, Derivative Works shall not include works that remain
|
|
149
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
150
|
+
the Work and Derivative Works thereof.
|
|
151
|
+
|
|
152
|
+
"Contribution" shall mean any work of authorship, including
|
|
153
|
+
the original version of the Work and any modifications or additions
|
|
154
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
155
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
156
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
157
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
158
|
+
means any form of electronic, verbal, or written communication sent
|
|
159
|
+
to the Licensor or its representatives, including but not limited to
|
|
160
|
+
communication on electronic mailing lists, source code control systems,
|
|
161
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
162
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
163
|
+
excluding communication that is conspicuously marked or otherwise
|
|
164
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
165
|
+
|
|
166
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
167
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
168
|
+
subsequently incorporated within the Work.
|
|
169
|
+
|
|
170
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
171
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
172
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
173
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
174
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
175
|
+
Work and such Derivative Works in Source or Object form.
|
|
176
|
+
|
|
177
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
178
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
179
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
180
|
+
(except as stated in this section) patent license to make, have made,
|
|
181
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
182
|
+
where such license applies only to those patent claims licensable
|
|
183
|
+
by such Contributor that are necessarily infringed by their
|
|
184
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
185
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
186
|
+
institute patent litigation against any entity (including a
|
|
187
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
188
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
189
|
+
or contributory patent infringement, then any patent licenses
|
|
190
|
+
granted to You under this License for that Work shall terminate
|
|
191
|
+
as of the date such litigation is filed.
|
|
192
|
+
|
|
193
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
194
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
195
|
+
modifications, and in Source or Object form, provided that You
|
|
196
|
+
meet the following conditions:
|
|
197
|
+
|
|
198
|
+
(a) You must give any other recipients of the Work or
|
|
199
|
+
Derivative Works a copy of this License; and
|
|
200
|
+
|
|
201
|
+
(b) You must cause any modified files to carry prominent notices
|
|
202
|
+
stating that You changed the files; and
|
|
203
|
+
|
|
204
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
205
|
+
that You distribute, all copyright, patent, trademark, and
|
|
206
|
+
attribution notices from the Source form of the Work,
|
|
207
|
+
excluding those notices that do not pertain to any part of
|
|
208
|
+
the Derivative Works; and
|
|
209
|
+
|
|
210
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
211
|
+
distribution, then any Derivative Works that You distribute must
|
|
212
|
+
include a readable copy of the attribution notices contained
|
|
213
|
+
within such NOTICE file, excluding those notices that do not
|
|
214
|
+
pertain to any part of the Derivative Works, in at least one
|
|
215
|
+
of the following places: within a NOTICE text file distributed
|
|
216
|
+
as part of the Derivative Works; within the Source form or
|
|
217
|
+
documentation, if provided along with the Derivative Works; or,
|
|
218
|
+
within a display generated by the Derivative Works, if and
|
|
219
|
+
wherever such third-party notices normally appear. The contents
|
|
220
|
+
of the NOTICE file are for informational purposes only and
|
|
221
|
+
do not modify the License. You may add Your own attribution
|
|
222
|
+
notices within Derivative Works that You distribute, alongside
|
|
223
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
224
|
+
that such additional attribution notices cannot be construed
|
|
225
|
+
as modifying the License.
|
|
226
|
+
|
|
227
|
+
You may add Your own copyright statement to Your modifications and
|
|
228
|
+
may provide additional or different license terms and conditions
|
|
229
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
230
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
231
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
232
|
+
the conditions stated in this License.
|
|
233
|
+
|
|
234
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
235
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
236
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
237
|
+
this License, without any additional terms or conditions.
|
|
238
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
239
|
+
the terms of any separate license agreement you may have executed
|
|
240
|
+
with Licensor regarding such Contributions.
|
|
241
|
+
|
|
242
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
243
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
244
|
+
except as required for reasonable and customary use in describing the
|
|
245
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
246
|
+
|
|
247
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
248
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
249
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
250
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
251
|
+
implied, including, without limitation, any warranties or conditions
|
|
252
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
253
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
254
|
+
appropriateness of using or redistributing the Work and assume any
|
|
255
|
+
risks associated with Your exercise of permissions under this License.
|
|
256
|
+
|
|
257
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
258
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
259
|
+
unless required by applicable law (such as deliberate and grossly
|
|
260
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
261
|
+
liable to You for damages, including any direct, indirect, special,
|
|
262
|
+
incidental, or consequential damages of any character arising as a
|
|
263
|
+
result of this License or out of the use or inability to use the
|
|
264
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
265
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
266
|
+
other commercial damages or losses), even if such Contributor
|
|
267
|
+
has been advised of the possibility of such damages.
|
|
268
|
+
|
|
269
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
270
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
271
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
272
|
+
or other liability obligations and/or rights consistent with this
|
|
273
|
+
License. However, in accepting such obligations, You may act only
|
|
274
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
275
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
276
|
+
defend, and hold each Contributor harmless for any liability
|
|
277
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
278
|
+
of your accepting any such warranty or additional liability.
|
|
279
|
+
|
|
280
|
+
END OF TERMS AND CONDITIONS
|
|
281
|
+
|
|
282
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
283
|
+
|
|
284
|
+
To apply the Apache License to your work, attach the following
|
|
285
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
286
|
+
replaced with your own identifying information. (Don't include
|
|
287
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
288
|
+
comment syntax for the file format. We also recommend that a
|
|
289
|
+
file or class name and description of purpose be included on the
|
|
290
|
+
same "printed page" as the copyright notice for easier
|
|
291
|
+
identification within third-party archives.
|
|
292
|
+
|
|
293
|
+
Copyright [yyyy] [name of copyright owner]
|
|
294
|
+
|
|
295
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
296
|
+
you may not use this file except in compliance with the License.
|
|
297
|
+
You may obtain a copy of the License at
|
|
298
|
+
|
|
299
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
300
|
+
|
|
301
|
+
Unless required by applicable law or agreed to in writing, software
|
|
302
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
303
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
304
|
+
See the License for the specific language governing permissions and
|
|
305
|
+
limitations under the License.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
51
309
|
@typescript-eslint/utils
|
|
52
310
|
|
|
53
311
|
MIT License
|
package/README.md
CHANGED
|
@@ -13,11 +13,37 @@ ESLint を入れずに、型情報を使うルールを oxlint だけで回せ
|
|
|
13
13
|
|
|
14
14
|
- `@r_masseater/oxlint-typed-rules/tanstack-start`
|
|
15
15
|
- [@tanstack/eslint-plugin-start][tanstack] の 2 ルール
|
|
16
|
+
- `@r_masseater/oxlint-typed-rules/tanstack-query`
|
|
17
|
+
- [@tanstack/eslint-plugin-query][tanstack-query] 5.105.3 の全ルールと configs
|
|
18
|
+
- `@r_masseater/oxlint-typed-rules/tanstack-router`
|
|
19
|
+
- [@tanstack/eslint-plugin-router][tanstack-router] 1.162.0 の全ルールと configs
|
|
20
|
+
- `@r_masseater/oxlint-typed-rules/drizzle`
|
|
21
|
+
- [eslint-plugin-drizzle][drizzle] 0.2.3 の全ルールと configs
|
|
22
|
+
- `@r_masseater/oxlint-typed-rules/react`
|
|
23
|
+
- [@eslint-react/eslint-plugin][eslint-react] 5.28.8 の全ルールと configs
|
|
16
24
|
|
|
17
25
|
[tanstack]: https://github.com/TanStack/router/tree/main/packages/eslint-plugin-start
|
|
26
|
+
[tanstack-query]: https://github.com/TanStack/query/tree/main/packages/eslint-plugin-query
|
|
27
|
+
[tanstack-router]: https://github.com/TanStack/router/tree/main/packages/eslint-plugin-router
|
|
28
|
+
[drizzle]: https://github.com/drizzle-team/drizzle-orm/tree/main/eslint-plugin-drizzle
|
|
29
|
+
[eslint-react]: https://github.com/Rel1cx/eslint-react
|
|
18
30
|
|
|
19
31
|
元のリポのテストを手を入れずに移植し、すべて同じ結果になることを確かめている。
|
|
20
32
|
TanStack Start の 2 ルールは、ファイルをまたぐと違反を取りこぼす点を直してある。
|
|
33
|
+
@eslint-react はルールの ID と configs を元のプラグインと同じにしてあるので、
|
|
34
|
+
jsPlugins の `specifier` を差し替えるだけで乗り換えられる。
|
|
35
|
+
TanStack Query・Router・Drizzle は、プラグインの名前を `tanstack-query`・`tanstack-router`・`drizzle` にしてある。
|
|
36
|
+
configs の `rules` も同じ名前で始まるので、そのまま `rules` に広げられる。
|
|
37
|
+
configs は元のプラグインの名前で引けば `undefined` にならない型にしてある。
|
|
38
|
+
Query の `no-void-query-fn` と `no-rest-destructuring` は型情報を読み、
|
|
39
|
+
ほかのルールは型を作らずに動く。
|
|
40
|
+
Router と Drizzle のエントリーは tsgo を起動しない。
|
|
41
|
+
eslint-plugin-drizzle は依存に書いていない `@typescript-eslint/utils` を読むので、
|
|
42
|
+
元のままではそれが巻き上げられた環境でしか読み込めない。このパッケージは同梱して読ませる。
|
|
43
|
+
oxc の構文木は JSX の属性の文字参照を復号しないので([oxc#9667][oxc-9667])、
|
|
44
|
+
`jsx-no-children-prop` は属性の元の文字列から復号するよう直してある。
|
|
45
|
+
|
|
46
|
+
[oxc-9667]: https://github.com/oxc-project/oxc/issues/9667
|
|
21
47
|
|
|
22
48
|
## 使い方
|
|
23
49
|
|
|
@@ -26,6 +52,7 @@ vp add -D @r_masseater/oxlint-typed-rules
|
|
|
26
52
|
```
|
|
27
53
|
|
|
28
54
|
```ts
|
|
55
|
+
import tanstackQuery from "@r_masseater/oxlint-typed-rules/tanstack-query";
|
|
29
56
|
import { defineConfig } from "vite-plus";
|
|
30
57
|
|
|
31
58
|
export default defineConfig({
|
|
@@ -35,8 +62,13 @@ export default defineConfig({
|
|
|
35
62
|
name: "tanstack-start",
|
|
36
63
|
specifier: "@r_masseater/oxlint-typed-rules/tanstack-start",
|
|
37
64
|
},
|
|
65
|
+
{
|
|
66
|
+
name: "tanstack-query",
|
|
67
|
+
specifier: "@r_masseater/oxlint-typed-rules/tanstack-query",
|
|
68
|
+
},
|
|
38
69
|
],
|
|
39
70
|
rules: {
|
|
71
|
+
...tanstackQuery.configs["flat/recommended"].rules,
|
|
40
72
|
"tanstack-start/no-client-code-in-server-component": "error",
|
|
41
73
|
"tanstack-start/no-async-client-component": "error",
|
|
42
74
|
},
|
|
@@ -49,9 +81,10 @@ export default defineConfig({
|
|
|
49
81
|
|
|
50
82
|
## TypeScript 7 との変換層
|
|
51
83
|
|
|
52
|
-
同梱したルールは TypeScript 6
|
|
84
|
+
同梱したルールは TypeScript 6 までの `ts` 名前空間と `Program`・`TypeChecker` を読む。
|
|
53
85
|
TypeScript 7.1 の `typescript/sync` は形が違う。
|
|
54
|
-
|
|
86
|
+
そこで、同梱したルールが使う分だけを `typescript/sync` と `typescript/ast` で組み立てる層を持つ。
|
|
87
|
+
ビルドでルールの `typescript` の import をこの層に向けるので、TypeScript 6 以前は入らない。
|
|
55
88
|
この層は暫定である。
|
|
56
89
|
typescript-eslint の [#12803][tse-12803] が同じ層を持つので、
|
|
57
90
|
それが公開されたら乗り換える([#13][issue-13])。
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Option, Predicate } from "effect";
|
|
2
|
+
// src/config-rules.ts
|
|
3
|
+
const rulesOf = (config) => Option.liftPredicate(config, Predicate.hasProperty("rules")).pipe(Option.flatMap(({ rules }) => Option.liftPredicate(rules, Predicate.isReadonlyObject)));
|
|
4
|
+
export { rulesOf as t };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=config-rules-CIyMUUvG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-rules-CIyMUUvG.mjs","names":[],"sources":["../src/config-rules.ts"],"sourcesContent":["import { Option, Predicate } from \"effect\";\n\nconst rulesOf = (config: unknown): Option.Option<Readonly<Record<string, unknown>>> =>\n Option.liftPredicate(config, Predicate.hasProperty(\"rules\")).pipe(\n Option.flatMap(({ rules }) => Option.liftPredicate(rules, Predicate.isReadonlyObject)),\n );\n\nexport { rulesOf };\n"],"mappings":";;AAEA,MAAM,WAAW,WACf,OAAO,cAAc,QAAQ,UAAU,YAAY,OAAO,CAAC,CAAC,CAAC,KAC3D,OAAO,SAAS,EAAE,YAAY,OAAO,cAAc,OAAO,UAAU,gBAAgB,CAAC,CACvF"}
|
package/dist/drizzle.mjs
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { i as __toCommonJS, t as __commonJSMin } from "./rolldown-runtime-DQp2zzRu.mjs";
|
|
2
|
+
import { i as typescript_eslint_utils_exports, r as init_typescript_eslint_utils } from "./typescript-eslint-utils-QnYasB-9.mjs";
|
|
3
|
+
import { n as upstreamPlugin, t as plainRules } from "./upstream-plugin-DqJEA6iy.mjs";
|
|
4
|
+
// ../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/package.json
|
|
5
|
+
var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
+
module.exports = {
|
|
7
|
+
"name": "eslint-plugin-drizzle",
|
|
8
|
+
"version": "0.2.3",
|
|
9
|
+
"description": "Eslint plugin for drizzle users to avoid common pitfalls",
|
|
10
|
+
"main": "src/index.js",
|
|
11
|
+
"types": "src/index.d.ts",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"build": "tsc -b && pnpm cpy readme.md dist/",
|
|
15
|
+
"pack": "(cd dist && npm pack --pack-destination ..) && rm -f package.tgz && mv *.tgz package.tgz",
|
|
16
|
+
"publish": "npm publish package.tgz"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"eslint",
|
|
20
|
+
"eslintplugin",
|
|
21
|
+
"eslint-plugin",
|
|
22
|
+
"drizzle"
|
|
23
|
+
],
|
|
24
|
+
"author": "Drizzle Team",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/drizzle-team/drizzle-orm/tree/main/eslint-plugin-drizzle.git"
|
|
28
|
+
},
|
|
29
|
+
"license": "Apache-2.0",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^20.10.1",
|
|
32
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
33
|
+
"@typescript-eslint/rule-tester": "^6.10.0",
|
|
34
|
+
"@typescript-eslint/utils": "^6.10.0",
|
|
35
|
+
"cpy-cli": "^5.0.0",
|
|
36
|
+
"eslint": "^8.53.0",
|
|
37
|
+
"typescript": "^5.2.2",
|
|
38
|
+
"vitest": "^0.34.6"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": { "eslint": ">=8.0.0" }
|
|
41
|
+
};
|
|
42
|
+
}));
|
|
43
|
+
// ../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/configs/all.js
|
|
44
|
+
var require_all = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.default = {
|
|
47
|
+
env: { es2024: true },
|
|
48
|
+
parserOptions: {
|
|
49
|
+
ecmaVersion: "latest",
|
|
50
|
+
sourceType: "module"
|
|
51
|
+
},
|
|
52
|
+
plugins: ["drizzle"],
|
|
53
|
+
rules: {
|
|
54
|
+
"drizzle/enforce-delete-with-where": "error",
|
|
55
|
+
"drizzle/enforce-update-with-where": "error"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}));
|
|
59
|
+
// ../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/configs/recommended.js
|
|
60
|
+
var require_recommended = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.default = {
|
|
63
|
+
env: { es2024: true },
|
|
64
|
+
parserOptions: {
|
|
65
|
+
ecmaVersion: "latest",
|
|
66
|
+
sourceType: "module"
|
|
67
|
+
},
|
|
68
|
+
plugins: ["drizzle"],
|
|
69
|
+
rules: {
|
|
70
|
+
"drizzle/enforce-delete-with-where": "error",
|
|
71
|
+
"drizzle/enforce-update-with-where": "error"
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}));
|
|
75
|
+
// ../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/utils/ast.js
|
|
76
|
+
var require_ast = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
77
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
78
|
+
exports.resolveMemberExpressionPath = void 0;
|
|
79
|
+
const resolveMemberExpressionPath = (node) => {
|
|
80
|
+
let objectExpression = node.object;
|
|
81
|
+
let fullName = "";
|
|
82
|
+
const addToFullName = (name) => {
|
|
83
|
+
fullName = `${name}${fullName ? "." : ""}${fullName}`;
|
|
84
|
+
};
|
|
85
|
+
while (objectExpression) if (objectExpression.type === "MemberExpression") {
|
|
86
|
+
if (objectExpression.property.type === "Identifier") addToFullName(objectExpression.property.name);
|
|
87
|
+
objectExpression = objectExpression.object;
|
|
88
|
+
} else if (objectExpression.type === "CallExpression" && objectExpression.callee.type === "Identifier") {
|
|
89
|
+
addToFullName(`${objectExpression.callee.name}(...)`);
|
|
90
|
+
break;
|
|
91
|
+
} else if (objectExpression.type === "CallExpression" && objectExpression.callee.type === "MemberExpression") {
|
|
92
|
+
if (objectExpression.callee.property.type === "Identifier") addToFullName(`${objectExpression.callee.property.name}(...)`);
|
|
93
|
+
objectExpression = objectExpression.callee.object;
|
|
94
|
+
} else if (objectExpression.type === "Identifier") {
|
|
95
|
+
addToFullName(objectExpression.name);
|
|
96
|
+
break;
|
|
97
|
+
} else if (objectExpression.type === "ThisExpression") {
|
|
98
|
+
addToFullName("this");
|
|
99
|
+
break;
|
|
100
|
+
} else break;
|
|
101
|
+
return fullName;
|
|
102
|
+
};
|
|
103
|
+
exports.resolveMemberExpressionPath = resolveMemberExpressionPath;
|
|
104
|
+
}));
|
|
105
|
+
// ../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/utils/options.js
|
|
106
|
+
var require_options = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
107
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
108
|
+
exports.isDrizzleObj = void 0;
|
|
109
|
+
const isDrizzleObjName = (name, drizzleObjectName) => {
|
|
110
|
+
if (typeof drizzleObjectName === "string") return name === drizzleObjectName;
|
|
111
|
+
if (Array.isArray(drizzleObjectName)) {
|
|
112
|
+
if (drizzleObjectName.length === 0) return true;
|
|
113
|
+
return drizzleObjectName.includes(name);
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
};
|
|
117
|
+
const isDrizzleObj = (node, options) => {
|
|
118
|
+
const drizzleObjectName = options[0].drizzleObjectName;
|
|
119
|
+
if (node.object.type === "Identifier") return isDrizzleObjName(node.object.name, drizzleObjectName);
|
|
120
|
+
else if (node.object.type === "MemberExpression" && node.object.property.type === "Identifier") return isDrizzleObjName(node.object.property.name, drizzleObjectName);
|
|
121
|
+
else if (node.object.type === "CallExpression") {
|
|
122
|
+
if (node.object.callee.type === "Identifier") return isDrizzleObjName(node.object.callee.name, drizzleObjectName);
|
|
123
|
+
else if (node.object.callee.type === "MemberExpression" && node.object.callee.property.type === "Identifier") return isDrizzleObjName(node.object.callee.property.name, drizzleObjectName);
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
};
|
|
127
|
+
exports.isDrizzleObj = isDrizzleObj;
|
|
128
|
+
}));
|
|
129
|
+
// ../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/enforce-delete-with-where.js
|
|
130
|
+
var require_enforce_delete_with_where = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
131
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
132
|
+
const utils_1 = (init_typescript_eslint_utils(), __toCommonJS(typescript_eslint_utils_exports));
|
|
133
|
+
const ast_1 = require_ast();
|
|
134
|
+
const options_1 = require_options();
|
|
135
|
+
const createRule = utils_1.ESLintUtils.RuleCreator(() => "https://github.com/drizzle-team/eslint-plugin-drizzle");
|
|
136
|
+
let lastNodeName = "";
|
|
137
|
+
exports.default = createRule({
|
|
138
|
+
defaultOptions: [{ drizzleObjectName: [] }],
|
|
139
|
+
name: "enforce-delete-with-where",
|
|
140
|
+
meta: {
|
|
141
|
+
type: "problem",
|
|
142
|
+
docs: { description: "Enforce that `delete` method is used with `where` to avoid deleting all the rows in a table." },
|
|
143
|
+
fixable: "code",
|
|
144
|
+
messages: { enforceDeleteWithWhere: "Without `.where(...)` you will delete all the rows in a table. If you didn't want to do it, please use `{{ drizzleObjName }}.delete(...).where(...)` instead. Otherwise you can ignore this rule here" },
|
|
145
|
+
schema: [{
|
|
146
|
+
type: "object",
|
|
147
|
+
properties: { drizzleObjectName: { type: ["string", "array"] } },
|
|
148
|
+
additionalProperties: false
|
|
149
|
+
}]
|
|
150
|
+
},
|
|
151
|
+
create(context, options) {
|
|
152
|
+
return { MemberExpression: (node) => {
|
|
153
|
+
if (node.property.type === "Identifier") {
|
|
154
|
+
if (node.property.name === "delete" && lastNodeName !== "where" && (0, options_1.isDrizzleObj)(node, options)) context.report({
|
|
155
|
+
node,
|
|
156
|
+
messageId: "enforceDeleteWithWhere",
|
|
157
|
+
data: { drizzleObjName: (0, ast_1.resolveMemberExpressionPath)(node) }
|
|
158
|
+
});
|
|
159
|
+
lastNodeName = node.property.name;
|
|
160
|
+
}
|
|
161
|
+
} };
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}));
|
|
165
|
+
// ../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/enforce-update-with-where.js
|
|
166
|
+
var require_enforce_update_with_where = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
167
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
168
|
+
const utils_1 = (init_typescript_eslint_utils(), __toCommonJS(typescript_eslint_utils_exports));
|
|
169
|
+
const ast_1 = require_ast();
|
|
170
|
+
const options_1 = require_options();
|
|
171
|
+
const createRule = utils_1.ESLintUtils.RuleCreator(() => "https://github.com/drizzle-team/eslint-plugin-drizzle");
|
|
172
|
+
let lastNodeName = "";
|
|
173
|
+
exports.default = createRule({
|
|
174
|
+
defaultOptions: [{ drizzleObjectName: [] }],
|
|
175
|
+
name: "enforce-update-with-where",
|
|
176
|
+
meta: {
|
|
177
|
+
type: "problem",
|
|
178
|
+
docs: { description: "Enforce that `update` method is used with `where` to avoid deleting all the rows in a table." },
|
|
179
|
+
fixable: "code",
|
|
180
|
+
messages: { enforceUpdateWithWhere: "Without `.where(...)` you will update all the rows in a table. If you didn't want to do it, please use `{{ drizzleObjName }}.update(...).set(...).where(...)` instead. Otherwise you can ignore this rule here" },
|
|
181
|
+
schema: [{
|
|
182
|
+
type: "object",
|
|
183
|
+
properties: { drizzleObjectName: { type: ["string", "array"] } },
|
|
184
|
+
additionalProperties: false
|
|
185
|
+
}]
|
|
186
|
+
},
|
|
187
|
+
create(context, options) {
|
|
188
|
+
return { MemberExpression: (node) => {
|
|
189
|
+
if (node.property.type === "Identifier") {
|
|
190
|
+
if (lastNodeName !== "where" && node.property.name === "set" && node.object.type === "CallExpression" && node.object.callee.type === "MemberExpression" && node.object.callee.property.type === "Identifier" && node.object.callee.property.name === "update" && (0, options_1.isDrizzleObj)(node.object.callee, options)) context.report({
|
|
191
|
+
node,
|
|
192
|
+
messageId: "enforceUpdateWithWhere",
|
|
193
|
+
data: { drizzleObjName: (0, ast_1.resolveMemberExpressionPath)(node.object.callee) }
|
|
194
|
+
});
|
|
195
|
+
lastNodeName = node.property.name;
|
|
196
|
+
}
|
|
197
|
+
} };
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}));
|
|
201
|
+
// src/drizzle.ts
|
|
202
|
+
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
203
|
+
var __importDefault = this$1 && this$1.__importDefault || function(mod) {
|
|
204
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
205
|
+
};
|
|
206
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
207
|
+
exports.meta = exports.configs = exports.rules = void 0;
|
|
208
|
+
const package_json_1 = require_package();
|
|
209
|
+
const all_1 = __importDefault(require_all());
|
|
210
|
+
const recommended_1 = __importDefault(require_recommended());
|
|
211
|
+
const enforce_delete_with_where_1 = __importDefault(require_enforce_delete_with_where());
|
|
212
|
+
const enforce_update_with_where_1 = __importDefault(require_enforce_update_with_where());
|
|
213
|
+
exports.rules = {
|
|
214
|
+
"enforce-delete-with-where": enforce_delete_with_where_1.default,
|
|
215
|
+
"enforce-update-with-where": enforce_update_with_where_1.default
|
|
216
|
+
};
|
|
217
|
+
exports.configs = {
|
|
218
|
+
all: all_1.default,
|
|
219
|
+
recommended: recommended_1.default
|
|
220
|
+
};
|
|
221
|
+
exports.meta = {
|
|
222
|
+
name: package_json_1.name,
|
|
223
|
+
version: package_json_1.version
|
|
224
|
+
};
|
|
225
|
+
})))();
|
|
226
|
+
const plugin = upstreamPlugin("drizzle", {
|
|
227
|
+
configs: import_src.configs,
|
|
228
|
+
rules: import_src.rules
|
|
229
|
+
}, plainRules);
|
|
230
|
+
export { plugin as default };
|
|
231
|
+
|
|
232
|
+
//# sourceMappingURL=drizzle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drizzle.mjs","names":[],"sources":["../../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/package.json","../../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/configs/all.js","../../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/configs/recommended.js","../../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/utils/ast.js","../../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/utils/options.js","../../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/enforce-delete-with-where.js","../../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/enforce-update-with-where.js","../../../node_modules/.pnpm/eslint-plugin-drizzle@0.2.3_patch_hash=970a4ab095ef16d6b77ccac81c31e17b85e1423d06ec977b_ab291f5b243d8e5c885cda6fd01a554a/node_modules/eslint-plugin-drizzle/src/index.js","../src/drizzle.ts"],"sourcesContent":["","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = {\n env: {\n es2024: true,\n },\n parserOptions: {\n ecmaVersion: 'latest',\n sourceType: 'module',\n },\n plugins: ['drizzle'],\n rules: {\n 'drizzle/enforce-delete-with-where': 'error',\n 'drizzle/enforce-update-with-where': 'error',\n },\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = {\n env: {\n es2024: true,\n },\n parserOptions: {\n ecmaVersion: 'latest',\n sourceType: 'module',\n },\n plugins: ['drizzle'],\n rules: {\n 'drizzle/enforce-delete-with-where': 'error',\n 'drizzle/enforce-update-with-where': 'error',\n },\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveMemberExpressionPath = void 0;\nconst resolveMemberExpressionPath = (node) => {\n let objectExpression = node.object;\n let fullName = '';\n const addToFullName = (name) => {\n const prefix = fullName ? '.' : '';\n fullName = `${name}${prefix}${fullName}`;\n };\n while (objectExpression) {\n if (objectExpression.type === 'MemberExpression') {\n if (objectExpression.property.type === 'Identifier') {\n addToFullName(objectExpression.property.name);\n }\n objectExpression = objectExpression.object;\n }\n else if (objectExpression.type === 'CallExpression' && objectExpression.callee.type === 'Identifier') {\n addToFullName(`${objectExpression.callee.name}(...)`);\n break;\n }\n else if (objectExpression.type === 'CallExpression' && objectExpression.callee.type === 'MemberExpression') {\n if (objectExpression.callee.property.type === 'Identifier') {\n addToFullName(`${objectExpression.callee.property.name}(...)`);\n }\n objectExpression = objectExpression.callee.object;\n }\n else if (objectExpression.type === 'Identifier') {\n addToFullName(objectExpression.name);\n break;\n }\n else if (objectExpression.type === 'ThisExpression') {\n addToFullName('this');\n break;\n }\n else {\n break;\n }\n }\n return fullName;\n};\nexports.resolveMemberExpressionPath = resolveMemberExpressionPath;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isDrizzleObj = void 0;\nconst isDrizzleObjName = (name, drizzleObjectName) => {\n if (typeof drizzleObjectName === 'string') {\n return name === drizzleObjectName;\n }\n if (Array.isArray(drizzleObjectName)) {\n if (drizzleObjectName.length === 0) {\n return true;\n }\n return drizzleObjectName.includes(name);\n }\n return false;\n};\nconst isDrizzleObj = (node, options) => {\n const drizzleObjectName = options[0].drizzleObjectName;\n if (node.object.type === 'Identifier') {\n return isDrizzleObjName(node.object.name, drizzleObjectName);\n }\n else if (node.object.type === 'MemberExpression' && node.object.property.type === 'Identifier') {\n return isDrizzleObjName(node.object.property.name, drizzleObjectName);\n }\n else if (node.object.type === 'CallExpression') {\n if (node.object.callee.type === 'Identifier') {\n return isDrizzleObjName(node.object.callee.name, drizzleObjectName);\n }\n else if (node.object.callee.type === 'MemberExpression' && node.object.callee.property.type === 'Identifier') {\n return isDrizzleObjName(node.object.callee.property.name, drizzleObjectName);\n }\n }\n return false;\n};\nexports.isDrizzleObj = isDrizzleObj;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst utils_1 = require(\"@typescript-eslint/utils\");\nconst ast_1 = require(\"./utils/ast\");\nconst options_1 = require(\"./utils/options\");\nconst createRule = utils_1.ESLintUtils.RuleCreator(() => 'https://github.com/drizzle-team/eslint-plugin-drizzle');\nlet lastNodeName = '';\nconst deleteRule = createRule({\n defaultOptions: [{ drizzleObjectName: [] }],\n name: 'enforce-delete-with-where',\n meta: {\n type: 'problem',\n docs: {\n description: 'Enforce that `delete` method is used with `where` to avoid deleting all the rows in a table.',\n },\n fixable: 'code',\n messages: {\n enforceDeleteWithWhere: \"Without `.where(...)` you will delete all the rows in a table. If you didn't want to do it, please use `{{ drizzleObjName }}.delete(...).where(...)` instead. Otherwise you can ignore this rule here\",\n },\n schema: [{\n type: 'object',\n properties: {\n drizzleObjectName: {\n type: ['string', 'array'],\n },\n },\n additionalProperties: false,\n }],\n },\n create(context, options) {\n return {\n MemberExpression: (node) => {\n if (node.property.type === 'Identifier') {\n if (node.property.name === 'delete' && lastNodeName !== 'where' && (0, options_1.isDrizzleObj)(node, options)) {\n context.report({\n node,\n messageId: 'enforceDeleteWithWhere',\n data: {\n drizzleObjName: (0, ast_1.resolveMemberExpressionPath)(node),\n },\n });\n }\n lastNodeName = node.property.name;\n }\n return;\n },\n };\n },\n});\nexports.default = deleteRule;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst utils_1 = require(\"@typescript-eslint/utils\");\nconst ast_1 = require(\"./utils/ast\");\nconst options_1 = require(\"./utils/options\");\nconst createRule = utils_1.ESLintUtils.RuleCreator(() => 'https://github.com/drizzle-team/eslint-plugin-drizzle');\nlet lastNodeName = '';\nconst updateRule = createRule({\n defaultOptions: [{ drizzleObjectName: [] }],\n name: 'enforce-update-with-where',\n meta: {\n type: 'problem',\n docs: {\n description: 'Enforce that `update` method is used with `where` to avoid deleting all the rows in a table.',\n },\n fixable: 'code',\n messages: {\n enforceUpdateWithWhere: \"Without `.where(...)` you will update all the rows in a table. If you didn't want to do it, please use `{{ drizzleObjName }}.update(...).set(...).where(...)` instead. Otherwise you can ignore this rule here\",\n },\n schema: [{\n type: 'object',\n properties: {\n drizzleObjectName: {\n type: ['string', 'array'],\n },\n },\n additionalProperties: false,\n }],\n },\n create(context, options) {\n return {\n MemberExpression: (node) => {\n if (node.property.type === 'Identifier') {\n if (lastNodeName !== 'where'\n && node.property.name === 'set'\n && node.object.type === 'CallExpression'\n && node.object.callee.type === 'MemberExpression'\n && node.object.callee.property.type === 'Identifier'\n && node.object.callee.property.name === 'update'\n && (0, options_1.isDrizzleObj)(node.object.callee, options)) {\n context.report({\n node,\n messageId: 'enforceUpdateWithWhere',\n data: {\n drizzleObjName: (0, ast_1.resolveMemberExpressionPath)(node.object.callee),\n },\n });\n }\n lastNodeName = node.property.name;\n }\n return;\n },\n };\n },\n});\nexports.default = updateRule;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.meta = exports.configs = exports.rules = void 0;\nconst package_json_1 = require(\"../package.json\");\nconst all_1 = __importDefault(require(\"./configs/all\"));\nconst recommended_1 = __importDefault(require(\"./configs/recommended\"));\nconst enforce_delete_with_where_1 = __importDefault(require(\"./enforce-delete-with-where\"));\nconst enforce_update_with_where_1 = __importDefault(require(\"./enforce-update-with-where\"));\nexports.rules = {\n 'enforce-delete-with-where': enforce_delete_with_where_1.default,\n 'enforce-update-with-where': enforce_update_with_where_1.default,\n};\nexports.configs = { all: all_1.default, recommended: recommended_1.default };\nexports.meta = { name: package_json_1.name, version: package_json_1.version };\n","import { configs, rules } from \"eslint-plugin-drizzle\";\n\nimport { plainRules, upstreamPlugin } from \"./upstream-plugin.ts\";\nimport type { UpstreamPlugin } from \"./upstream-plugin.ts\";\n\ntype ConfigName = \"all\" | \"recommended\";\n\nconst plugin: UpstreamPlugin<ConfigName> = upstreamPlugin(\n \"drizzle\",\n { configs, rules },\n plainRules,\n);\n\nexport type { ConfigName };\nexport default plugin;\n"],"ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CCCA,OAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CAAC;CAC5D,QAAQ,UAAU;EACd,KAAK,EACD,QAAQ,KACZ;EACA,eAAe;GACX,aAAa;GACb,YAAY;EAChB;EACA,SAAS,CAAC,SAAS;EACnB,OAAO;GACH,qCAAqC;GACrC,qCAAqC;EACzC;CACJ;;;;CCdA,OAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CAAC;CAC5D,QAAQ,UAAU;EACd,KAAK,EACD,QAAQ,KACZ;EACA,eAAe;GACX,aAAa;GACb,YAAY;EAChB;EACA,SAAS,CAAC,SAAS;EACnB,OAAO;GACH,qCAAqC;GACrC,qCAAqC;EACzC;CACJ;;;;CCdA,OAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CAAC;CAC5D,QAAQ,8BAA8B,KAAK;CAC3C,MAAM,+BAA+B,SAAS;EAC1C,IAAI,mBAAmB,KAAK;EAC5B,IAAI,WAAW;EACf,MAAM,iBAAiB,SAAS;GAE5B,WAAW,GAAG,OADC,WAAW,MAAM,KACF;EAClC;EACA,OAAO,kBACH,IAAI,iBAAiB,SAAS,oBAAoB;GAC9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