1.3.0 • Published 8 months ago

eslint-plugin-no-nested-import v1.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

eslint-plugin-no-nested-import

Description

Plugin, looks at imports and checks that there are no nested imports more than a certain number and replaces them with absolute imports, the allowed nesting level is determined by the maxLevel parameter, you also need to specify the baseUrl parameter so that it substitutes the value for absolute imports, baseUrl by default @. The rule is called no-relative-parent-imports.

Installation

npm install eslit-plugin-no-nested-import --save-dev

Usage

Add no-nested-import to plugin list in eslint.json; Add no-nested-import/no-relative-parent-imports rules in eslint.json

Finally it will look like:

rules: [
	...
	"no-nested-import/no-relative-parent-imports": ["error", {
		"maxLevel": 2
    }],
]

You can set maxLevel value, it will check if level you have more than 2 ../ in your import line and will show elsint error with suggestion

Also you can set baseUrl value as alias to base url, default value is @, so it will put this symbol in the beginning of import e.g. - ../../../../components/myFeature.ts will be replaced with @/components/myFeature.ts

If you don't have baseUrl alias, you can pass noAlias option and ../../../../components/myFeature.ts will be replaced with components/myFeature.ts

1.2.8

8 months ago

1.3.0

8 months ago

1.2.9

8 months ago

1.2.7

11 months ago

1.2.6

11 months ago

1.2.5

11 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

11 months ago

1.2.0

11 months ago

1.1.9

11 months ago

1.1.8

11 months ago

1.1.7

11 months ago

1.1.6

11 months ago

1.1.5

11 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago