eslint-plugin-no-relative-path

1.3.3 • Public • Published

eslint-plugin-no-relative-path

npm version

Disallow relative path import.

eslint

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-no-relative-path:

npm install eslint-plugin-no-relative-path --save-dev

Usage

Add no-relative-path to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
	"plugins": ["no-relative-path"]
}

And add no-relative-path/no-relative-path to the rules section of your .eslintrc configuration file:

{
	"rules": {
		"no-relative-path/no-relative-path": 2
	}
}

And also, you can designate absolute path prefix such as "/@":

{
	"rules": {
		"no-relative-path/no-relative-path": [2, { "pathPrefix": "/@" }]
	}
}

This prefix is default to "/@".

Extra feature

I belong to traP, which is a programming club in Tokyo Institute of Technology, and this club name is sometimes mistakenly written as "trap", "Trap", "TraP", and so on... So I added a feature to detect this mistake.

{
	"rules": {
		"no-relative-path/no-trap-with-invalid-casing": 2
	}
}

And if you set strict mode true, eslint check not only literals but also identifiers.

{
	"rules": {
		"no-relative-path/no-trap-with-invalid-casing": [2, { "strict": true }]
	}
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.3.3
    2
    • latest

Version History

Package Sidebar

Install

npm i eslint-plugin-no-relative-path

Weekly Downloads

2

Version

1.3.3

License

ISC

Unpacked Size

1.02 MB

Total Files

6

Last publish

Collaborators

  • mehm8128