package.jon "exports" option
See original GitHub issuenode 12.18.0, 14.5.0
./node_modules/.bin/eslint --env-info Environment Info:
Node version: v14.5.0 npm version: v6.14.5 Local ESLint version: v7.4.0 (Currently used) Global ESLint version: Not found
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
module.exports = {
env: {
es2020: true,
mocha: true,
},
extends: [
'airbnb-base',
],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
rules: {
'@typescript-eslint/no-unused-vars': 'error',
'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/test.ts', 'src/common/test/**/*.ts'] }],
'import/extensions': ['error', 'ignorePackages', {
ts: 'never',
}],
'no-unused-vars': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.ts'],
paths: ['./src'],
},
},
},
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
in module A’s package.json use “exports”
{
...
"exports": {
"./": "./lib/"
}
...
}
eslint --ext .js,.ts src/
What did you expect to happen? B’s package.json
{
"dependencies": {
"A": "A's url"
}
}
when source code is
import bar from 'A/foo/bar';
From module B it runs well where bar.js is in “node_modules/A/lib/foo/bar” but eslint fail with “Unable to resolve path to module”
What actually happened? Please include the actual, raw output from ESLint. eslint failed
Are you willing to submit a pull request to fix this bug?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thanks!
benmosher/eslint-plugin-import#1810
same issue is in eslint-plugin-import
please close this issue.
Closing since the problem isn’t related to ESLint core rules.