Reputation: 20152
Not sure why, I can import this file and use expect
in my test files just fine, but I am getting an eslint error:
error expect not found in '../../testImports' import/named
This is where I export, testImports.js
:
import chai from 'chai'
const expect = require('chai').expect
import { BrowserRouter } from 'react-router-dom'
import { jsdom } from './jsdom'
module.exports = {
BrowserRouter,
expect,
jsdom
}
And I'm importing as so into files: import { expect } from '../../testImports'
.
Upvotes: 1
Views: 1863
Reputation: 57924
The problem is eslint-plugin-import
only picks up on ES6 module system exports, not ES5. They mean the same thing, the plugin just doesn't catch it. Since the plugin doesn't see you've exported anything, it reports the error, but there's nothing actually wrong about your code. If you want to get rid of the error, just use ES6's export
:
export {
BrowserRouter,
expect,
jsdom
};
Upvotes: 4