0

I use airbnb-base eslint rule. I have a function in a.js

const test = () => {
    console.log('OK');
}

And in b.js

import '../scripts/a.js';
test()

But in eslint error is no-unused-vars in a.js and no-undef in b.js.

I don't want to change the rules of ESLint and I would like to find an elegant way to get rid of these error messages. How should I do? Thanks.

Mark
  • 27
  • 1
  • 9
  • 2
    Just configure it. https://eslint.org/docs/user-guide/configuring Furthermore, it's not really best practice to do that anyway. If you're exporting your variables then you won't get those errors. – Sebastian Olsen Jul 10 '18 at 09:50
  • all you need to do is to export test and import it like `export const test = () => { console.log('OK'); }` and `import { test } from '../scripts/a.js';` – Shubham Khatri Jul 10 '18 at 09:54
  • There is an error in 'export const test = () => { console.log('OK'); ':Prefer default export. (import/prefer-default-export) How could I solve it? – Mark Jul 10 '18 at 10:21
  • You might find this answer useful: https://stackoverflow.com/questions/41062416/eslint-determine-globals-from-another-file#tab-top – kurdtpage Mar 23 '20 at 01:36

0 Answers0