Prefer ES6 import statements when importing files
npm install eslint-plugin-prefer-importESLint plugin to prefer ES6 import statements when importing files.
Install the npm package
``bashIf eslint is installed globally
npm install -g eslint-plugin-prefe-import
Add the plugin to the
plugins section and the rule to the rules section in your .eslintrc
`js
"plugins": [
"prefer-import"
],
"rules": {
"prefer-import/prefer-import-over-require": ["error"]
}
`
Rules
* prefer-import-over-require: Checks for any require calls and prefer the usage of import` statements instead.