Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-no-relative-import-paths

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-no-relative-import-paths - npm Package Compare versions

Comparing version 1.0.3 to 1.0.5

2

package.json
{
"name": "eslint-plugin-no-relative-import-paths",
"version": "1.0.3",
"version": "1.0.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,1 +0,62 @@

# eslint-plugin-no-relative-import-paths
# eslint-plugin-no-relative-import-paths
Moving a file to different folder, could result in changing all imports statement in that file. This will not happen is the import paths are absolute. The eslint rule helps enforcing having absolute import paths.
# Installation
Install [ESLint](https://www.github.com/eslint/eslint) either locally or globally. (Note that locally, per project, is strongly preferred)
```sh
$ npm install eslint --save-dev
```
If you installed `ESLint` globally, you have to install this plugin globally too. Otherwise, install it locally.
```sh
$ npm install eslint-plugin-no-relative-import-paths --save-dev
```
# Configuration
Add the plugin to the plugins section, and configure the rule options.
```json
{
"plugins": ["no-relative-import-paths"],
"rules": {
"no-relative-import-paths/no-relative-import-paths": [
"warn",
{ "allowSameFolder": true }
]
}
}
```
## Rule options
```json
...
"no-relative-import-paths/no-relative-import-paths": [
"warn",
{ "allowSameFolder": true }
]
...
```
- `enabled`: for enabling the rule. 0=off, 1=warn, 2=error. Defaults to 0.
- `ignorePureComponents`: optional boolean set to `true` to allow relative import paths for imported files from the same folder (default to `false`).
### `allowSameFolder`
When `true` the rule will ignore relative import paths for imported files from the same folder
Examples of code for this rule:
```js
// when true this will be ignored
// when false this will generate a warning
import Something from "./something";
// will always generate a warning
import Something from "../modules/something";
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc