Following 1.3 guide, eslint complaining about SimpleSchema not defined


#1

I’m just following the 1.3 guide to get a feel for things. Any idea why it says Notes is not defined? Also SimpleSchema is not defined?


#2

At the top of the file, you should import SimpleSchema:

import {SimpleSchema} from 'meteor/aldeed:simple-schema';

For Notes, you should declare it with var/const/let, export it and import somewhere else, i.e.:

const Notes = new Mongo.Collection('notes');
export defualt Notes;

And where you want to use it:

import Notes from '/lib/collections/notes';

#3

I guess I have to get used to importing things manually. :’(


#4

That’s the whole idea of the modules principle…


#5

Doesn’t mean I have to enjoy it.

Ayy lmao


#6

FYI default is spelled defualt in your example, in case someone copy/pastes. Further, export as default only when you have one collection to export. If you have multiple, you should export/import as:

const Notes = new Mongo.Collection(‘notes’)
export { Notes }
import { Notes }


#7

Ran into the same thing;

You can add

/* globals SimpleSchema */

to the top of your javascript file;
documentation: http://eslint.org/docs/user-guide/configuring#specifying-globals