no-unused-modules "missingExports" returns false positives
I'd expect both of these cases to count as exports:
module.exports = {} // Should probably not trigger
export * from './someFile' // Should almost definitely not trigger
module.exports = {} should definitely count.
export * from './someFile' should treat the module as if it had the same exports as someFile.
Similar issue:
./index.js
import { someName } from './foo';
./foo/index.js
export * as someName from './bar'
results in "someNamed was not found in './foo'"
I just removed an eslint-directive that I noted we'd needed due to this issue, but unless ESLint is doing something weird right now, it seems like this issue may be fixed in 2.25.x
If anyone else hits this, give the issue a bump and I'll re-open it.
module.exports = {}should definitely count.
export * from './someFile'should treat the module as if it had the same exports as someFile.
Unfortunately it seems neither of these cases are actually resolved as of 2.26.0. I don't know what led me to believe they were. Perhaps I failed to re-enable the rule properly.
@ljharb any thoughts about possible causes and solutions?
Our settings key in .eslintrc.js looks like this - I wonder if it's possibly related to resolution issues? But it seems to work fine in other capacities, so I'm doubtful.
settings: {
// 'import/resolver': 'webpack',
'import/cache': { lifetime: 0 },
'import/external-module-folders': ['node_modules', 'packages'],
'import/resolver': {
'babel-module': {},
webpack: {
config: './webpack_config/webpack.config.resolve.js',
},
},
},
@Slapbox it might be that you're missing the node resolver - add that last, after webpack.
Sorry for the lengthy absence here.
I finally got to give that a try but unfortunately it makes no difference.
I added
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
And installed eslint-import-resolver-node