mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
1.4 KiB
1.4 KiB
Core API for collections (collections)
Prevent misusage of collection.
Collections have to be declared in .eslintrc as settings. See options for details.
Rule Details
This rule aims to prevent misusing any collections.
The following patterns are considered warnings:
new Mongo.Collection() // deprecated
// When "Users" is declared as a Meteor collection in `.eslintrc`
Users = true // no reassignment of collections possible
This rule checks the argument count of all collection methods.
Users.insert() // Missing argument
The following patterns are not warnings:
Users = new Mongo.Collection('users')
Users = new Mongo.Collection(null)
Options
Declare the available collections through .eslintrc.
Example of an .eslintrc file declaring the collections Users and Posts:
{
settings: {
meteor: {
collections: [
'Users',
'Posts'
]
}
}
}
Limitations
- Does not verify usage of
- Mongo.ObjectID
- Mongo Cursors
- Arguments to collection methods, e.g.
find()
- Does not warn when declaring the same collection multiple times