Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Eslint shows error: 'import' and 'export' may appear only with 'sourceType: module'

I have a simple HTML + CSS + JS project, where I want to use a JS class. I defined the class as:

class Warning {
    constructor(id, className) {
        this.id = id;
        this.className = className;
    }

    add () {
        $(this.id).addClass(this.className);
    }
    remove () {
        $(this.id).removeClass(this.className);
    }
}

export default Warning;

and tried to use it in contact.js:

import Warning from './Warning.js';
const warning = new Warning();

However with both import and export, I got ESLint error:

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

I tried to use type="module" where the class is imported, but error is still there:

<script src="/static/js/Warning.js" charset="utf-8" type="module"></script>

Any idea how I could use the class?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!