How to fix import/no-named-as-default ESlint rule when you want to change the name of a default import?

Viewed 2246

I have the following warning from ESlint import plugin:

eslint - import/no-named-as-default: use default import syntax to import clearRegister.

import { default as clearRegister } from "./utils/form/clearForm";

Here I am using default as to rename my default imported function to clearRegister. This renaming works as a charm.

//clearForm.js
export default function clearForm() {
 ...
}

How can I fix this warning?

2 Answers

when you export in default, you can import it with whatever you want for example

import blah from "./utils/form/clearForm";
Related