Commit 4232e83
fix(typestate): Prevent false positives on Array.prototype.find()
Remove generic `.find(` from JavaScript/TypeScript database query patterns
since it conflicts with `Array.prototype.find()`. Add more specific ORM
patterns instead:
- `.findById(`, `.findUnique(`, `.findFirst(` (Prisma)
- `.findByPk(`, `.findOrCreate(` (Sequelize)
- `.insertMany(`, `.updateMany(`, `.deleteMany(` (MongoDB)
- `.bulkCreate(` (Sequelize)
- `collection.find(` (explicit MongoDB collection access)
This fixes false positives where `addresses.find(a => a.isDefault)` was
incorrectly flagged as "Query executed without establishing connection".
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 0924b06 commit 4232e83
1 file changed
+14
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2848 | 2848 | | |
2849 | 2849 | | |
2850 | 2850 | | |
2851 | | - | |
| 2851 | + | |
| 2852 | + | |
2852 | 2853 | | |
2853 | 2854 | | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
2854 | 2858 | | |
| 2859 | + | |
2855 | 2860 | | |
| 2861 | + | |
2856 | 2862 | | |
| 2863 | + | |
2857 | 2864 | | |
2858 | 2865 | | |
2859 | 2866 | | |
2860 | 2867 | | |
| 2868 | + | |
| 2869 | + | |
2861 | 2870 | | |
| 2871 | + | |
2862 | 2872 | | |
2863 | 2873 | | |
2864 | 2874 | | |
2865 | 2875 | | |
2866 | 2876 | | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
2867 | 2880 | | |
2868 | 2881 | | |
2869 | 2882 | | |
| |||
0 commit comments