![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
eslint-plugin-import-alias
Advanced tools
An ESLint rule for forcing import path aliases.
npm install --save-dev eslint-plugin-import-alias
import { test } from '@src/test'; // valid
import { test } from './test'; // invalid
import { test } from '../test'; // invalid
// Optional relative depth can be specified.
import { test } from './test'; // valid, { relativeDepth: 0 }
import { test } from '../test'; // valid, { relativeDepth: 1 }
import { test } from '../../test'; // invalid, { relativeDepth: 1 }
{
"rules": {
"import-alias/import-alias": [
"error",
{
"relativeDepth": 0,
"aliases": [
{ "alias": "@src", "matcher": "^src" }, // src/modules/app/test -> @src/modules/app/test
{ "alias": "@test", "matcher": "^test\/unit" }, // test/unit/modules/app -> @test/modules/app
{ "alias": "@testRoot", "matcher": "^(test)\/e2e" } // test/e2e/modules/app -> @testRoot/e2e/modules/app
]
}
]
}
}
Aliases can be configured to fix the path and rewrite to an aliased path. Each alias has the alias text and a regex matcher that will match against the resolved path from the root directory of the eslint process (usually the project root). For example, if the resolved file path is in the 'src' folder (src/modules/app/test) then 'src' will be replaced with '@src'. Optionally, you can define a capture group to replace only the part within the capture group, but still match against the whole regex.
A 'rootDir' can be defined to resolve the file paths from. This defaults to process.cwd()
. In a lot of cases, this is already the project root in most cases.
module.exports = {
"rules": {
"import-alias/import-alias": [
"error",
{
"relativeDepth": 0,
"rootDir": __dirname,
"aliases": [
{ "alias": "@src", "matcher": "^src" } // src/modules/app/test -> @src/modules/app/test
]
}
]
}
};
FAQs
ESLint rule for restricting imports to path aliases
The npm package eslint-plugin-import-alias receives a total of 0 weekly downloads. As such, eslint-plugin-import-alias popularity was classified as not popular.
We found that eslint-plugin-import-alias 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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.