eslint-plugin-fsd-lint
raw JSON → 1.2.1 verified Fri May 01 auth: no javascript
ESLint 9+ plugin for enforcing Feature-Sliced Design (FSD) architecture rules with Flat Config support. Current stable version is 1.2.1, regularly released on npm. Provides presets (recommended, strict, base) and individual rules for layer boundaries, public API discipline, relative import hygiene, UI/business-logic separation, and import ordering. Built for modern ESLint, works with TypeScript, path aliases, custom folder naming, and tsconfig mapping. Key differentiator: opinionated FSD rules with flexible configuration and real file resolution.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/eslint-plugin-fsd-lint/dist/index.js not supported. ↓
cause The plugin is ESM-only; using require() to import it.
fix
Change to import syntax: import fsdPlugin from 'eslint-plugin-fsd-lint';
error ESLint configuration is invalid: The config 'plugin:fsd/recommended' is not found. ↓
cause Using the old eslintrc extend format instead of the flat config preset.
fix
Use the new flat config: export default [fsdPlugin.configs.recommended];
error TypeError: fsdPlugin.configs.recommended.rules is not iterable ↓
cause Trying to access .rules from a flat config preset that is an array of config objects.
fix
Use the preset directly as a flat config array item, do not destructure .rules.
error Error: Cannot find module 'eslint-plugin-fsd-lint' ↓
cause Plugin not installed or ESLint cannot resolve it in flat config.
fix
Run npm install --save-dev eslint-plugin-fsd-lint and ensure it is in the project's dependencies.
Warnings
breaking ESM-only: the plugin only exports an ESM module; using require() will throw a Module not found error. ↓
fix Use import syntax with an ESLint 9 flat config. Do not use require().
breaking Peer dependency ESLint >=9: the plugin does not work with ESLint 8 or older. ↓
fix Upgrade ESLint to version 9 or later.
gotcha Presets in v1.0.10 and earlier were not actual flat config presets and could not be used directly. Fixed in v1.0.11. ↓
fix Update to v1.0.11 or later to use presets as flat config arrays.
gotcha Tests were silently no-op in v1.2.0 and earlier due to missing RuleTester bindings; the test suite reported zero tests. ↓
fix Update to v1.2.1 for the test infrastructure fix.
deprecated Some rules used deprecated ESLint context methods in v1.0.11 and earlier; now replaced with context properties. ↓
fix Update to v1.0.12 or later for ESLint v10 readiness.
Install
npm install eslint-plugin-fsd-lint yarn add eslint-plugin-fsd-lint pnpm add eslint-plugin-fsd-lint Imports
- default wrong
const fsdPlugin = require('eslint-plugin-fsd-lint')correctimport fsdPlugin from 'eslint-plugin-fsd-lint' - fsd-plugin configs wrong
fsdPlugin.configs.recommended.rulescorrectfsdPlugin.configs.recommended - rules wrong
module.exports = { rules: { 'fsd/no-relative-imports': 'error' } }correctimport fsdPlugin from 'eslint-plugin-fsd-lint'; export default [{ plugins: { fsd: fsdPlugin }, rules: { 'fsd/no-relative-imports': 'error' } }]
Quickstart
import fsdPlugin from 'eslint-plugin-fsd-lint';
export default [
fsdPlugin.configs.recommended,
{
rules: {
'fsd/ordered-imports': 'warn',
},
},
];