This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Description
Hi there,
This plugin crashes when it encounters imports inside module declarations, for example:
// axios.shim.d.ts
declare module 'axios/lib/adapters/http' {
import { AxiosRequestConfig, AxiosResponse } from 'axios';
function axiosHttpAdapter(
config: AxiosRequestConfig,
): Promise<AxiosResponse>;
export = axiosHttpAdapter;
}
declare module 'axios/lib/adapters/xhr' {
import { AxiosRequestConfig, AxiosResponse } from 'axios';
function axiosXHRAdapter(
config: AxiosRequestConfig,
): Promise<AxiosResponse>;
export = axiosXHRAdapter;
}
When linting the project I get the following error:
TypeError: Cannot read properties of undefined (reading 'range')
Occurred while linting /builds/project/shims/axios.shim.d.ts:2
at Object.fix (/builds/project/node_modules/eslint-plugin-sort-imports-es6-autofix/rules/sort-imports-es6.js:284:83)
at normalizeFixes (/builds/project/node_modules/eslint/lib/linter/report-translator.js:193:28)
at /builds/project/node_modules/eslint/lib/linter/report-translator.js:364:49
at Object.report (/builds/project/node_modules/eslint/lib/linter/linter.js:926:41)
at ImportDeclaration (/builds/project/node_modules/eslint-plugin-sort-imports-es6-autofix/rules/sort-imports-es6.js:274:33)
at /builds/project/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/builds/project/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/builds/project/node_modules/eslint/lib/linter/node-event-generator.js:293:26)
at NodeEventGenerator.applySelectors (/builds/project/node_modules/eslint/lib/linter/node-event-generator.js:322:22)
I'm using eslint version 7.32.0 and the latest version of this plugin.