Skip to content

refactor: migrate eslint resolver-oxc to resolver-typescript #3030

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openbas-front/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint import/no-extraneous-dependencies: 0 */

// imports to not let tools report them as unused
import 'eslint-import-resolver-oxc';
import 'eslint-import-resolver-typescript';

import js from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
Expand Down Expand Up @@ -33,7 +33,7 @@ export default [
importPlugin.flatConfigs.typescript,
{
settings: {
'import/resolver': 'oxc',
'import/resolver': 'typescript',
'import/ignore': [
'react-apexcharts', // ignore react-apexcharts as the default export is broken
],
Expand Down
2 changes: 1 addition & 1 deletion openbas-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"cross-env": "7.0.3",
"esbuild": "0.25.1",
"eslint": "9.23.0",
"eslint-import-resolver-oxc": "0.13.1",
"eslint-import-resolver-typescript": "4.3.4",
"eslint-plugin-custom-rules": "link:packages/eslint-plugin-custom-rules",
"eslint-plugin-i18next": "6.1.1",
"eslint-plugin-import": "2.31.0",
Expand Down
1 change: 1 addition & 0 deletions openbas-front/src/reducers/App.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-named-as-default -- named `Immutable` is a `type`
Copy link
Author

@JounQin JounQin Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an issue from eslint-plugin-import, see also un-ts/eslint-plugin-import-x#312

I'll fix it in eslint-plugin-import-x, but it's also fine to keep using eslint-plugin-import with this disable comment.

Then why there is no such issue when using resolver-oxc? Because resolver-typescript prefers .d.ts over .js which enables the possibility to recognize type from the import statement, import { Immutable } from 'seamless-immutable' without import type { Immutable } or import { type Immutable }, eslint-plugin-import will reports import/named error because named Immutable export doesn't exist in the .js source, only available in the .d.ts declaration.

import Immutable from 'seamless-immutable';

import * as Constants from '../constants/ActionTypes';
Expand Down
1 change: 1 addition & 0 deletions openbas-front/src/reducers/Referential.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as R from 'ramda';
// eslint-disable-next-line import/no-named-as-default -- named `Immutable` is a `type`
import Immutable from 'seamless-immutable';

import * as Constants from '../constants/ActionTypes';
Expand Down
1 change: 1 addition & 0 deletions openbas-front/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as R from 'ramda';
import { useSelector } from 'react-redux';
import { applyMiddleware, createStore } from 'redux';
import { thunk } from 'redux-thunk';
// eslint-disable-next-line import/no-named-as-default -- named `Immutable` is a `type`
import Immutable from 'seamless-immutable';

import { storeHelper } from './actions/Schema';
Expand Down
1 change: 1 addition & 0 deletions openbas-front/src/utils/Action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { type Schema } from 'normalizr';
import * as R from 'ramda';
import { createIntl, createIntlCache } from 'react-intl';
import { type Dispatch } from 'redux';
// eslint-disable-next-line import/no-named-as-default -- named `Immutable` is a `type`
import Immutable from 'seamless-immutable';

import { LANG } from '../components/AppIntlProvider';
Expand Down
Loading