Closed
Description
Since 3.8 aliases are no-longer being resolved in .js
files.
I've read a few of the issues raised about 3.8, but I think this is separate. I have tested with 3.8.3 and still face the issue.
We use aliases that are actually defined in three possible places:
- webpack.config
- jsconfig
- tsconfig
Perhaps it was never intended to resolve imports from js files?
It's fine is I use relative paths with lots of ../
.
We have a verbose config but the key details are:
{
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
importPlugin.flatConfigs.recommended,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: ['**/*.js', '**/*.mjs'],
...tseslint.configs.disableTypeChecked,
},
{
languageOptions: {
globals: {
...globals.node,
...globals.jest,
},
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
'@babel/eslint-parser': ['.js', '.mjs'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
// Gives false positives because RRD has two versions in our dependency tree.
'import/ignore': ['react-router-dom'],
'import/internal-regex': aliasesRegex,
},
rules: {
'import/order': [
'error',
{
'newlines-between': 'always',
groups: ['type', 'external', 'internal', ['parent', 'sibling', 'index'], 'object'],
alphabetize: {
order: 'asc',
},
},
],
'import/no-cycle': 'error',
'import/no-unresolved': [
'error',
{
caseSensitiveStrict: true,
},
],
'workspaces/no-cross-imports': [
'error',
{
allow: '@blink/core',
},
],
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['*.css', '!*.module.css'],
importNames: ['default'],
message: 'For CSS modules, use the `.module.css` extension.',
},
],
},
],
},
},
}
Happy to try and create a proper repro repo. Do you have a base I can clone?
Metadata
Metadata
Assignees
Labels
No labels