eslint-plugin-import
eslint-plugin-import copied to clipboard
ESLint plugin with rules that help validate proper imports.
``` "import/no-duplicates": ["error", { "prefer-inline": true }], ``` Will detect an error in the following typescript code: ```ts import type { X } from "xyz"; import "xyz"; // [...] ```...
With an eslintrc containing this rule configuration: `'import/extensions': [ 1, 'ignorePackages' ]` a file containing an [internal package import](https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_internal_package_imports): ```js import dep from '#dep' ``` is incorrectly being flagged as...
Can an option be added to the `no-restricted-paths` rule to ignore TypeScript's type imports? ```ts // Allow this. import type { T } from 'some/restricted/path'; // While still disallowing this....
Packages used: - babel-plugin-module-resolver v4.0.0 eslint-import-resolver-babel-module v5.1.2 eslint-plugin-import v2.22.0 I am unable to get ESLint to recognise the module import (**Unable to resolve path to module '_components/TheThing'.eslint(import/no-unresolved)**) unless I change...
My eslint settings: ``` 'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/*.test.js'] }], ``` and package.json: ``` "devDependencies": { ... "uuid": "^8.3.0", } ``` The following import does not error: ``` const v5...
Some time ago `no-internal-modules` rule added ES modules exports linting as a "fix" -> minor version bump (which was a breaking change btw). From my experience, linting exports with this...
Some of the words might be obvious to seasoned developers, but for others it's not so obvious. Here's my understanding : `src/App/AppContainer.js` where `~` is an alias to `src/**` ```es6...
Good day! I have a folder structure: ``` my-project |----- src │ |----- main | |----- api.1 | |----- ConstService.js | |----- api.2 | |------ AccountService.js | |----- components |...
I had some code like this ```js import { a } from "pkg" import { b } from "pkg" ``` ESLint's autofix for "import/no-duplicates" did work, but it left `a`...
Scenario: ```javascript 'import/no-extraneous-dependencies': [ 'error', { packageDir: [ __dirname, 'node_modules/module-exist', 'node_modules/module-not-exist', ], }, ] ``` If there is a module `module-not-exist` that's not installed in node_modules. Even if `module-exist` did...