New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

eslint-plugin-absolute-only

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-absolute-only

Lightweight eslint plugin for enforcing absolute imports (with or w/o root relative) with --fix ability

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
409
-50.9%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-absolute-only

ESLint zero dependency plugin to prefer absolute imports. By default, the plugin strictly allows absolute imports. However, with the allowRootRelative setting, you can be a little more relaxed if you prefer.

This plugin will automatically fix your code using ESLint's --fix option.

It is written in Typescript and I am always open to requests, advice and PR's. Happy hacking!

Prerequisites

You must have a "baseUrl" defined in either tsconfig.json or jsconfig.json. This plugin does not currently work with paths!

Setup

Install the npm package

#install locally with yarn
yarn add eslint-plugin-absolute-only -D

#install locally with npm
npm i eslint-plugin-absolute-only --save-dev

Add the plugin to the plugins section and the rule to the rules section in your .eslintrc

"plugins": [
  "absolute-only"
],
"rules": {
  "absolute-only/imports": [ "error", { "allowRootRelative": true } ],
}

Configuration

Under the rules section in your .eslintrc you can set the "error" to "off" to display nothing, or "warn" for a warning.

"allowRootRelative" can be set false to enforce a strict absolute pattern, or true to allow root relative imports.

Autofixing

To autofix your code, simply run ESLint with the --fix option.

eslint --fix src

License

MIT

Keywords

eslint

FAQs

Package last updated on 01 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts