Skip to content
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

TypeError with adeira/no-duplicate-import-type-import #3410

Closed
maicol07 opened this issue Nov 3, 2021 · 5 comments · Fixed by #3414
Closed

TypeError with adeira/no-duplicate-import-type-import #3410

maicol07 opened this issue Nov 3, 2021 · 5 comments · Fixed by #3414
Labels
bug Something isn't working

Comments

@maicol07
Copy link

maicol07 commented Nov 3, 2021

I have the following error when there is a type import with the rule adeira/no-duplicate-import-type-import:

PS C:\Users\Maicol\Documents\Projects\Web\scheduled_exams> eslint .\resources\js\_material.js

Oops! Something went wrong! :(

ESLint: 8.1.0

TypeError: Cannot read property 'type' of undefined
Occurred while linting C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\resources\js\_material.js:9
Rule: "adeira/no-duplicate-import-type-import"
    at autoFix (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint-plugin-adeira@0.14.0\node_modules\eslint-plugin-adeira\src\rules\no-duplicate-import-type-import.js:19:36)
    at Object.fix (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint-plugin-adeira@0.14.0\node_modules\eslint-plugin-adeira\src\rules\no-duplicate-import-type-import.js:72:22)
    at normalizeFixes (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@8.1.0\node_modules\eslint\lib\linter\report-translator.js:193:28)
    at C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@8.1.0\node_modules\eslint\lib\linter\report-translator.js:364:49
    at Object.report (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@8.1.0\node_modules\eslint\lib\linter\linter.js:937:41)
    at ImportDeclaration (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint-plugin-adeira@0.14.0\node_modules\eslint-plugin-adeira\src\rules\no-duplicate-import-type-import.js:60:19)
    at ruleErrorHandler (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@8.1.0\node_modules\eslint\lib\linter\linter.js:966:28)
    at C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@8.1.0\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@8.1.0\node_modules\eslint\lib\linter\safe-emitter.js:45:38)

Code:

import '@material/mwc-button';
import '@material/mwc-dialog';
import '@material/mwc-drawer';
import '@material/mwc-icon-button';
import '@material/mwc-list';
import '@material/mwc-menu';
import './WebComponents/TopAppBar';
import './WebComponents/MaterialDrawer';
import type {Dialog} from "@material/mwc-dialog";
@maicol07 maicol07 changed the title Issue with adeira/no-duplicate-import-type-import TypeError with adeira/no-duplicate-import-type-import Nov 3, 2021
@michalsanger
Copy link
Contributor

Hi @maicol07 I see you are using ESLint: 8.1.0, so just a guess if the issue could be related to missing support of ESLint 8 - #3274

To validate, could you downgrade your ESLint and check if the problem remains?

@maicol07
Copy link
Author

maicol07 commented Nov 3, 2021

I have the same issue with ESLint 7.32

@maicol07
Copy link
Author

maicol07 commented Nov 3, 2021

The same error with ESLint 7.32:

PS C:\Users\Maicol\Documents\Projects\Web\scheduled_exams> eslint .\resources\js\_material.js

Oops! Something went wrong! :(

ESLint: 7.32.0

TypeError: Cannot read property 'type' of undefined
Occurred while linting C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\resources\js\_material.js:10
    at autoFix (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint-plugin-adeira@0.14.0\node_modules\eslint-plugin-adeira\src\rules\no-duplicate-import-type-import.js:19:36)
    at Object.fix (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint-plugin-adeira@0.14.0\node_modules\eslint-plugin-adeira\src\rules\no-duplicate-import-type-import.js:72:22)
    at normalizeFixes (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@7.32.0\node_modules\eslint\lib\linter\report-translator.js:193:28)
    at C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@7.32.0\node_modules\eslint\lib\linter\report-translator.js:364:49
    at Object.report (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@7.32.0\node_modules\eslint\lib\linter\linter.js:926:41)
    at ImportDeclaration (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint-plugin-adeira@0.14.0\node_modules\eslint-plugin-adeira\src\rules\no-duplicate-import-type-import.js:60:19)
    at C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@7.32.0\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@7.32.0\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (C:\Users\Maicol\Documents\Projects\Web\scheduled_exams\node_modules\.pnpm\eslint@7.32.0\node_modules\eslint\lib\linter\node-event-generator.js:293:26)

@mrtnzlml
Copy link
Member

mrtnzlml commented Nov 3, 2021

Hi @maicol07! I can indeed confirm there is a bug and I can reproduce it on a current master. Please, allow me some time for fixing it (or optionally feel free to send a PR with a fix).

Also, as @michalsanger said: the latest released version of @adeira/eslint-config doesn't support Eslint version 8 yet because there are still many 3rd party rules broken (not ready yet). It should be correctly specified in peer dependencies.

@mrtnzlml mrtnzlml added the bug Something isn't working label Nov 3, 2021
mrtnzlml added a commit that referenced this issue Nov 4, 2021
I decided to ignore side-effect imports completely because it felt
strange to be enforcing consolidation of side-effects and type imports.

Closes: #3410
@mrtnzlml
Copy link
Member

mrtnzlml commented Nov 4, 2021

This should hopefully fix the issue: #3414

@kodiakhq kodiakhq bot closed this as completed in #3414 Nov 5, 2021
kodiakhq bot pushed a commit that referenced this issue Nov 5, 2021
I decided to ignore side-effect imports completely because it felt
strange to be enforcing consolidation of side-effects and type imports.

Closes: #3410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants