
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
eslint-plugin-path
Advanced tools
An ESLint plugin for enforcing consistent imports across project. In other words, it helps to replace all relatives import with absolutes dependinng on settings.
An ESLint plugin for enforcing consistent imports across project. In other words, it helps to replace all relatives import with absolutes dependinng on settings.
# npm
npm install eslint-plugin-path --save-dev
# yarn
yarn add eslint-plugin-path --dev
If you are using ESLint 9 or later, you can use the plugin without any additional configuration. Just install it and add it to your ESLint configuration.
import eslintPluginPath from 'eslint-plugin-path';
export default [
{
files: ['*.{js,ts,jsx,tsx}'],
plugins: {
path: eslintPluginPath,
},
rules: {
'path/no-relative-imports': [
'error',
{
maxDepth: 2,
suggested: false,
},
],
},
},
];
If you are using ESLint 8 or below, you need to add the plugin to your ESLint configuration file. You can do this by adding the following lines to your .eslintrc
file:
{
"plugins": ["path"],
"extends": ["plugin:path/recommended"] // optional
"rules": {
"path/no-relative-imports": [
"error",
{
"maxDepth": 2,
"suggested": false
}
]
}
}
Or if you are using a JavaScript configuration file, you can add the following lines to your .eslintrc.js
file:
module.exports = {
plugins: ['path'],
extends: ['plugin:path/recommended'], // optional
rules: {
'path/no-relative-imports': [
'error',
{
maxDepth: 2,
suggested: false,
},
],
},
};
If you are using custom paths in your tsconfig.json
or jsconfig.json
file, you can specify the path to the configuration file in the ESLint configuration file. You can do this by adding the following lines to your config file:
{
"settings": {
"path": {
"config": "tsconfig.json" // or "./jsconfig.json"
}
}
}
Enable the rules in your ESLint configuration file:
{
"plugins": ["path"],
"rules": {
"path/no-relative-imports": "error",
},
}
Or add the "recommended" preset:
{
"extends": ["plugin:path/recommended"]
}
✔ included in the "recommended" preset
🔧 fixable using the --fix
command line option
Name | Description | ||
---|---|---|---|
✔ | 🔧 | no-relative-imports | disallow relative imports of files where absolute is preferred |
🔧 | no-absolute-imports | disallow absolute imports of files where relative is preferred | |
🔧 | only-absolute-imports | disallow relative imports of files through the whole project |
recommended
enables rules recommended for all usersall
enables all rulesFAQs
An ESLint plugin for enforcing consistent imports across project. In other words, it helps to replace all relatives import with absolutes dependinng on settings.
The npm package eslint-plugin-path receives a total of 7,665 weekly downloads. As such, eslint-plugin-path popularity was classified as popular.
We found that eslint-plugin-path demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.