Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
eslint-plugin-greenwich
Advanced tools
Define import prefix for omit Vue Lint 'One word imports'
This ESLint rule enforces naming conventions for imports of single-word identifiers within specific directories. It is part of the eslint-plugin-greenwich plugin.
The rule checks that single-word import names do not violate specified naming conventions in certain directory paths. In this rule's context, a "single-word import" refers to an import statement that imports a default export with a single-word identifier.
To use this rule in your ESLint configuration, you can install the eslint-plugin-greenwich plugin using your preferred package manager.
Using pnpm:
pnpm install eslint-plugin-greenwich --save-dev
Using npm:
npm install eslint-plugin-greenwich --save-dev
Using yarn:
yarn add eslint-plugin-greenwich --dev
This rule checks import statements within specified directories (e.g., "/components/") and ensures that single-word import names adhere to specific naming conventions.
This rule supports the following configuration options:
allowedPrefixes
(array of strings, default: ['V']
): Specifies a list of allowed prefixes for single-word import names. If provided, the rule allows import names that start with any of the specified prefixes.
paths
(array of strings, default: ['/components/']
): Specifies an array of directory paths where the rule should be applied. Only import statements within these paths will be checked for compliance with the rule.
To configure ESLint for your project, you can create or edit an ESLint configuration file (e.g., .eslintrc.js
) in your project's root directory. Below is an example ESLint configuration:
module.exports = {
extends: ["eslint:recommended"], // Use recommended rules as a starting point
plugins: ["greenwich"], // Add the 'greenwich' plugin
rules: {
"greenwich/prefix-one-word-import": [
"error",
{
allowedPrefixes: ["V"], // Customize allowed prefixes
paths: ["/components/"] // Specify the directory paths to check
}
]
// Add more rules and configurations as needed
}
};
Here are some examples of how this rule works:
// ESLint: Single-word file names in components directory must start with one of the following prefixes: ['V']
import Button from "@/components/base/Button.vue";
// ESLint: Single-word file names in components directory must start with one of the following prefixes: ['V']
import MyButton from "@/components/base/Button.vue";
// Correct: Import name "VButton" starts with an allowed prefix ['V']
import VButton from "@/components/base/Button.vue";
// Correct: Import name "DragDrop" is multi word, don't check it
import DragDrop from "@/components/base/DragDrop.vue";
FAQs
Define import prefix for omit Vue Lint 'One word imports'
The npm package eslint-plugin-greenwich receives a total of 12 weekly downloads. As such, eslint-plugin-greenwich popularity was classified as not popular.
We found that eslint-plugin-greenwich demonstrated a not healthy version release cadence and project activity because the last version was released 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.