eslint-plugin-fsd-architecture
Version:
ESlint plugin to comply with FSD (Feature Sliced Design) frontend architecture rules
54 lines (38 loc) • 1.67 kB
Markdown
<!-- end auto-generated rule header -->
Checking imports against FSD architecture rules
| Name | Description |
| :----------------------- | :--------------------------------------------- |
| alias | The alias with which the import path begins |
```js
'fsd-architecture/import-path-check': ['error', {
alias: '@', // Example import path with alias - @/shared/...
}],
```
Examples of **correct** code for this rule:
```js
// File path C:/Users/project/src/features/AddComment
import Button from 'shared/Button.tsx'
import { getCommentStatus } from '../../model/selectors/getCommentStatus'
// With option: alias: '@'
// File path C:/Users/project/src/features/AddComment
import Button from '@/shared/Button.tsx'
import { getCommentStatus } from '../../model/selectors/getCommentStatus'
```
Examples of **incorrect** code for this rule:
```js
// File path C:/Users/project/src/features/AddComment
import { getCommentStatus } from 'features/model/selectors/getCommentStatus'
// Error: Within one slice, all import paths must be relative
// With option: alias: '@'
// File path C:/Users/project/src/features/AddComment
import { getCommentStatus } from '@/features/model/selectors/getCommentStatus'
// Error: Within one slice, all import paths must be relative
// File path C:/Users/project/src/features/AddComment
import { Currency } from '../shared/const/currency'
// Error: Shared layer import must be absolute path
```