0

I found this in the keystonejs source code:

keystone.import('models');

Sublime text gives warning:

Expected an identifier and instead saw 'import' (a reserved word), Line 34, Column 8

Also, I searched the whole node module (keystonejs) and can't find import method defined. Can't find it on google either.

I know that the import is a new native feature in ES6, but I didn't know it could be a method of an object.

Is this a native method? Or is it defined by the module somewhere, and if it is, why can't I find it?

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Mattias
  • 715
  • 1
  • 6
  • 19
  • It may be wrongly complaining about a method name because "import" is a reserved keyword in Javascript. – jfriend00 Sep 13 '15 at 16:38
  • I still don't get why I don't find it in the module directory. It has to be defined somewhere then, doesn't it? – Mattias Sep 13 '15 at 16:40
  • related: [Is the 'catch' method name of JS Promises/A+ invalid since it's a JS keyword?](http://stackoverflow.com/q/25774628/1048572) - your tooling is faulty (or configured for ES3). – Bergi Sep 13 '15 at 17:49

1 Answers1

0

I found the definition. It was defined as

Keystone.prototype.import = ...

ST3 was wrongly complaining about a method name.

Andy
  • 61,948
  • 13
  • 68
  • 95
Mattias
  • 715
  • 1
  • 6
  • 19
  • ST3 wouldn't do that on its own. Do you have JSHint or ESLint running as a package? – Andy Sep 13 '15 at 16:45