ESLint error: 'Image' is not defined

I’m having a ESLint Error with Image() — why? The app seems to work just fine as is. Is there something I have to import? Thanks! :slight_smile:

ESLint Error no-undef: ‘Image’ is not defined

Template.pic.helpers({
  fileDimensions() {
    const url = this.url;
    const img = new Image();
    img.src = url;
    console.log('w/h: ' + img.width + '/' + img.height);
  }
});

You just need to configure Image to be a global: http://eslint.org/docs/user-guide/configuring#specifying-globals

1 Like