
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
eslint-plugin-feature-sliced-design-imports
Advanced tools
A custom ESLint plugin designed to enforce strict import rules in projects following the Feature-Sliced Design architecture.
Custom ESLint plugin designed to enforce strict import rules in projects following the Feature-Sliced Design architecture.
Install ESLint:
npm i eslint --save-dev
Next install eslint-plugin-feature-sliced-design-imports
:
npm install eslint-plugin-feature-sliced-design-imports --save-dev
Add feature-sliced-design-imports
to the plugins section of your eslint configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"feature-sliced-design-imports"
]
}
Add custom layers or alias if needed:
{
"settings": [
"feature-sliced-design-imports/layers": {
"app": "app-layer",
"pages": "pages-layer",
"entities": "custom-entities-layer-name",
},
"feature-sliced-design-imports/alias": "@"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"feature-sliced-design-imports/layer-imports": "error",
"feature-sliced-design-imports/public-api-imports": "error",
"feature-sliced-design-imports/relative-imports": "error",
}
}
layer-imports
This rule enforces strict import order between defined architectural layers (e.g., app
, shared
, features
, entities
, etc.) in a feature-sliced design architecture. It ensures that higher-level layers only import from allowed lower-level layers to maintain a clear dependency hierarchy. The proccess
layer isn't supported.
@x
folder convention to encapsulate shared logic or functionality.// @/entities/user/ui/UserForm
import { Button } from '@/shared/ui/Button'; // shared -> entities
// @/entities/message/ui/MessageCard
import { UserType } from '@/entities/user/@x/message'; // Cross-entity via @x folder
// @/entities/user/ui/UserForm
import { SomeType } from '@/features/auth-user'; // features -> entities
// @/entities/message/ui/MessageCard
import { UserType } from '@/entities/user'; // Cross-entity without @x folder
{
"feature-sliced-design-imports/layer-imports": ["error", {
"ignoreImportsPattern": ["**/Store", "**/*.test.ts"]
}],
}
relative-imports
This rule enforces that imports within the same entity and layer use relative paths. This helps improve modularity and reduce coupling between slices of the same layer.
// @/entities/user/ui/UserCard
import { UserType } from '../model/UserType'; // Relative import within the same entity
// @/entities/user/ui/UserCard
import { UserType } from '@/entities/user/model/UserType'; // Absolute import within the same entity
import { UserType } from '@/entities/user'; // Absolute import from public api within the same entity
{
"feature-sliced-design-imports/relative-imports": "error",
}
public-api-imports
This rule enforces that imports from other layers or entities should only access the public API of those modules. For test files, it allows importing from a dedicated public testing API.
index.ts
or equivalent).testing.{ts,js}
point, ensuring test isolation.@x
folder when necessary.import { Button } from '@/entities/user'; // Importing from public API
// myFile.test.ts or any file -> "should be allowed in configuration"
import { mockUser } from '@/entities/user/testing'; // Importing from testing public API in an allowed test file
import { UserType } from '@/entities/user/model/UserType'; // Importing from private module
// @/pages/home/ui/Page
import { mockUser } from '@/entities/user/testing'; // Testing API imported in a production file
{
"feature-sliced-design-imports/public-api-imports": ["error", {
"testFilePatterns": ["**/*.test.ts", "**/*-test.{ts,js}"]
}],
}
FAQs
A custom ESLint plugin designed to enforce strict import rules in projects following the Feature-Sliced Design architecture.
The npm package eslint-plugin-feature-sliced-design-imports receives a total of 41 weekly downloads. As such, eslint-plugin-feature-sliced-design-imports popularity was classified as not popular.
We found that eslint-plugin-feature-sliced-design-imports demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.