@noctcore/eslint-plugin-architecture
v0.2.0
Published
Framework-agnostic folder-per-component and feature-boundary architecture ESLint rules.
Maintainers
Readme
@noctcore/eslint-plugin-architecture
Framework-agnostic folder-per-component and feature-boundary architecture rules. Flat-config only, ESLint 9+.
Install
bun add -D @noctcore/eslint-plugin-architecture # or npm i -D / pnpm add -DUse
// eslint.config.js
import architecture from '@noctcore/eslint-plugin-architecture';
export default [
architecture.configs.recommended,
];Or wire rules individually:
import architecture from '@noctcore/eslint-plugin-architecture';
export default [
{
plugins: { 'noctcore-architecture': architecture },
rules: {
'noctcore-architecture/component-folder-structure': ['error', { componentRoot: 'components' }],
'noctcore-architecture/no-cross-feature-imports': ['error', { alias: '@/components' }],
'noctcore-architecture/index-must-reexport-default': 'error',
},
},
];Every rule anchors on a configurable directory segment (default components) rather than an absolute
path, so it behaves the same whether ESLint runs from the repo root or per-package, on POSIX or
Windows. Several rules inspect files on disk (sibling sets, barrel siblings, colocated tests), so run
ESLint against real file paths, not virtual sources.
Rules
🔧 = autofixable · 💡 = provides an editor suggestion.
| Rule | Description | 🔧 |
| --- | --- | --- |
| barrel-purity | A barrel (index.ts / index.tsx) must contain only re-exports — no local declarations, side effects, or default-exported values. | |
| colocated-test-required | A source file matching an include glob must have a colocated *.test.* / *.spec.* sibling on disk. Off until configured. | |
| component-folder-structure | A component entry file must ship its full sibling set (hooks, types, story, test, barrel) on disk. | |
| filename-matches-export | A file's basename must match its primary export (default export, or the sole named export). | 💡 |
| index-must-reexport-default | A component folder's index.ts must re-export the sibling default named after the folder. | |
| max-import-depth | A relative import may not climb more than max parent levels (default 3); autofixed to a path alias when one is configured. | 🔧 |
| no-cross-feature-imports | A file in one feature may not import runtime code from another feature. | |
