Files
meteor/docs/rules/core.md
Dominik Ferber b14cbd82a4 feat(rule): Add core rule
Prevent misuse of the Meteor core API
2015-10-06 21:46:00 +02:00

1.3 KiB

Meteor Core API (core)

This rules prevents misuse of the Meteor core API.

Rule Details

This rule aims to prevent reassigning or misusing any part of the Meteor core API, which consists of:

  • Meteor.isClient
  • Meteor.isServer
  • Meteor.isCordova
  • Meteor.startup
  • Meteor.wrapAsync
  • Meteor.absoluteUrl
  • Meteor.settings
  • Meteor.release

The following patterns are considered warnings:


// reassigning any part of the Meteor core API
Meteor.isClient = true


// calling Meteor.startup with anything but one argument
Meteor.startup()
Meteor.startup(foo, bar)


// calling Meteor.wrapAsync with an invalid argument count
Meteor.wrapAsync()
Meteor.wrapAsync(function () {}, context, foo)


// calling Meteor.absoluteUrl with an invalid argument count
Meteor.absoluteUrl(foo, bar, baz)

The following patterns are not warnings:


Meteor.startup(x)
Meteor.startup(() => {})
Meteor.startup(function () {})


if (Meteor.isClient) {
  console.log('Hello world')
}


Meteor.wrapAsync(function () {})
Meteor.wrapAsync(function () {}, context)


Meteor.absoluteUrl()
Meteor.absoluteUrl('/foo')
Meteor.absoluteUrl('/foo', { secure: true })

Further Reading