{"id":19702,"library":"eslint-plugin-boundaries","title":"eslint-plugin-boundaries","description":"ESLint plugin for enforcing architectural boundaries between elements in JavaScript and TypeScript projects. Current stable version is 6.0.2 (released Feb 2025) with active development. It allows defining layered architectures (e.g., controllers, models, views) with dependency rules that restrict which elements can import from others. Features object-based element selectors (v6), monorepo support, TypeScript types, and real-time ESLint feedback. Differentiators: flexible element/rule definitions, built-in recommended config, and a dedicated documentation site (jsboundaries.dev). Release cadence is roughly monthly. Requires eslint >=6.0.0 and node >=18.18.","status":"active","version":"6.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/javierbrea/eslint-plugin-boundaries","tags":["javascript","eslint","eslint-plugin","eslintplugin","plugin","architecture","boundaries","dependencies","elements","typescript"],"install":[{"cmd":"npm install eslint-plugin-boundaries","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-boundaries","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-boundaries","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required at >=6.0.0 to function as a plugin","package":"eslint","optional":false}],"imports":[{"note":"Default import is ESM. In CommonJS, use const boundaries = require('eslint-plugin-boundaries').default (since v6).","wrong":"const boundaries = require('eslint-plugin-boundaries')","symbol":"plugin","correct":"import boundaries from 'eslint-plugin-boundaries'"},{"note":"Named export 'rules' is part of the default export object, not a top-level export.","wrong":"import { rules } from 'eslint-plugin-boundaries'","symbol":"rules","correct":"import boundaries from 'eslint-plugin-boundaries'; const { rules } = boundaries"},{"note":"createConfig is a named export (since v6). For ESLint v9/v10 flat config.","wrong":"import createConfig from 'eslint-plugin-boundaries'","symbol":"createConfig","correct":"import { createConfig } from 'eslint-plugin-boundaries'"},{"note":"configs is a property of the default export.","wrong":"import { configs } from 'eslint-plugin-boundaries'","symbol":"configs.recommended","correct":"import boundaries from 'eslint-plugin-boundaries'; boundaries.configs.recommended"}],"quickstart":{"code":"// npm install eslint eslint-plugin-boundaries --save-dev\n// eslint.config.js (flat config)\nimport boundaries from 'eslint-plugin-boundaries';\n\nexport default [\n  {\n    plugins: { boundaries },\n    settings: {\n      'boundaries/elements': [\n        { type: 'controller', pattern: 'controllers/*' },\n        { type: 'model', pattern: 'models/*' },\n        { type: 'view', pattern: 'views/*' },\n        { type: 'service', pattern: 'services/*' },\n        { type: 'utility', pattern: 'utils/*' },\n      ],\n    },\n    rules: {\n      'boundaries/element-types': [2, {\n        default: 'disallow',\n        rules: [\n          { from: 'controller', to: 'view', allow: true },\n          { from: 'controller', to: 'model', allow: true },\n          { from: 'view', to: 'controller', allow: false },\n          { from: 'model', to: 'service', allow: true },\n          { from: 'service', to: ['model', 'utility'], allow: true },\n          { from: 'utility', to: ['utility', 'model'], allow: true },\n        ],\n      }],\n    },\n  },\n];","lang":"javascript","description":"Configures eslint-plugin-boundaries with element types and dependency rules in flat ESLint config (v9+)."},"warnings":[{"fix":"Use import or require('eslint-plugin-boundaries').default","message":"ESM-only since v6; require() fails without .default","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Explicitly enable in rules: 'boundaries/no-private': [2, { allowUncles: true }]","message":"no-private rule disabled by default in recommended config since v6.0.0-beta.2","severity":"breaking","affected_versions":">=6.0.0-beta.2"},{"fix":"Use boundaries/element-types with appropriate rules instead","message":"no-private rule is deprecated and will be removed in future major version","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Upgrade to >=5.3.1 or ensure every element has at least one pattern","message":"Elements selector validation error when selector is an empty array (v5.3.1 fixed this)","severity":"gotcha","affected_versions":"<5.3.1"},{"fix":"Update to v6.0.1 or later","message":"TypeScript createConfig helper types incompatible with ESLint v10 before v6.0.1","severity":"gotcha","affected_versions":"6.0.0"},{"fix":"Migrate elements definition to object form (type + pattern)","message":"Legacy string-based element selectors are deprecated in v6; use object-based selectors","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Upgrade to v6.0.2 or later","message":"handlebars dependency had critical vulnerability GHSA-2w6w-674q-4c4q before v6.0.2","severity":"gotcha","affected_versions":"<6.0.2"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use const boundaries = require('eslint-plugin-boundaries').default;","cause":"Using CommonJS require() without .default in ESM-only v6","error":"Cannot read properties of undefined (reading 'default')"},{"fix":"Add plugins: { boundaries } to the config object (see quickstart)","cause":"Plugin not added to plugins field in flat config","error":"ESLint configuration error: Rule 'boundaries/element-types' is not found"},{"fix":"Add a pattern that matches the file or adjust existing patterns","cause":"File path does not match any defined element pattern","error":"Boundaries: No element matched for file '...' (settings 'boundaries/elements')"},{"fix":"Use import boundaries from 'eslint-plugin-boundaries'; boundaries.createConfig()","cause":"Using named import for createConfig in CommonJS without default import","error":"TypeError: boundaries.createConfig is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}