-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to resolve path to module
on bun
or modules with bun:
prefix
#92
Comments
Configuration Solution / WorkaroundIf automating this based on the TS types in
const configArray = [
rules: {
'import-x/no-unresolved':
- 'error',
+ [
+ 'error',
+ {
+ ignore: ['^bun(:\\w+)?$'],
+ },
+ ],
},
},
]; Full configimport eslintTypescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import eslintImportX from 'eslint-plugin-import-x';
import globals from 'globals';
/** @type
* {import('@typescript-eslint/utils/ts-eslint').FlatConfig.ConfigArray}
* */
const configArray = [
{
// Lint common extensions by default with rules above
files: [
'**/*.js',
'**/*.jsx',
'**/*.cjs',
'**/*.mjs',
'**/*.ts',
'**/*.tsx',
'**/*.cts',
'**/*.mts',
],
languageOptions: {
parser: typescriptParser,
parserOptions: {
project: './tsconfig.json',
// typescript-eslint specific options
warnOnUnsupportedTypeScriptVersion: true,
},
globals: {
...globals.browser,
...globals.node,
...globals.commonjs,
...globals.es2021,
// Allow using React as a global without importing it
React: true,
},
},
plugins: {
'@typescript-eslint': {
rules: eslintTypescript.rules,
},
'import-x': eslintImportX,
},
settings: {
'import-x/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import-x/resolver': {
// Load <rootdir>/tsconfig.json
typescript: true,
node: true,
},
},
rules: {
// Error on imports that don't match the underlying file
// system
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unresolved.md
'import-x/no-unresolved': [
'error',
{
ignore: ['^bun:\\w+$'],
},
],
},
},
];
export default configArray; |
Unable to resolve path to module
on modules with 'bun:' prefixUnable to resolve path to module
on bun
or modules with bun:
prefix
import { isBuiltin } from 'node:module'
console.log(isBuiltin('bun:sqlite'))
// In Node.js: false
// In Bun: true Thus we can't use |
Ah just saw this other PR: I guess once this is published and |
@karlhorky You don't have to upgrade I just became the co-maintainer of |
Importing modules with
bun:
prefix (eg.bun:test
) orbun
itself with@types/bun
installed results in a resolution error withimport-x/no-unresolved
index.test.ts
The text was updated successfully, but these errors were encountered: