Files
meteor/docs/rules/collections.md
2015-10-21 21:32:09 +02:00

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
  • Does not warn when declaring the same collection multiple times

Further Reading