Summary
Version 6.0.0 introduces object-based selectors as the recommended way to define rules. This provides better readability and access to advanced matching features.
It also introduces several new features and changes in configuration to make it more semantic and powerful. But almost every change is designed to be incremental and non-breaking, allowing you to migrate at your own pace. For further info and examples, read the migration guide at the website
eslint-plugin v6.0.0
Added
- feat(#383, #388): Add object-based element selector syntax as the recommended way to define element selectors, providing better readability and access to advanced matching features.
- feat(#395): Support
fromandtodependency selector objects in theboundaries/dependenciesrule, enabling matching based on dependency relationship, origin, source, internal path, and more. - feat(#387): Add optional
categoryfield to element descriptors to enable multi-dimensional architectural classification. - feat(#386): Support a
nameproperty in theadditional-dependency-nodessetting on each node definition, allowing to identify custom dependency nodes by name in rules and messages. - feat: Add
checkAllOrigins,checkUnknownLocalsandcheckInternalsoptions todependencies(oldelement-types) rule to allow checking or ignoring dependencies based on their properties. By default, only local dependencies with known elements are checked, and internal dependencies are ignored, as in previous versions. - feat: Improve debug output, and add
boundaries/debugsetting to allow enabling/disabling it and filtering the traces that are printed. - feat: Support all element description properties in custom messages templates by using handlebars syntax. Old message templates will continue working as they are, without any change.
Changed
- feat(#403): Rename
boundaries/element-typesrule toboundaries/dependencies. The legacy name is still supported with a deprecation warning. - feat(#393): Deprecate rule-level
importKindoption in favor of selector-leveldependency.kind, allowing more granular per-selector control over dependency kind matching. - feat(#392): Add deprecation warning when using legacy template format (
${ }), and introduce new Handlebars-style template syntax ({{ }}). The legacy format is still supported but will be removed in a future major version. - feat(#384): Add deprecation warning when using legacy element selector syntax (string or tuple formats).
- feat: Validate and transform different settings and rules only once per different configuration object, and not per rule execution, to improve performance.
- refactor: Refactor the core of the plugin to support the new features and improvements, and to improve code organization, readability and maintainability. It is now fully typed with TypeScript.
- chore: Update dependencies and devDependencies to their latest versions.
- docs(#396): Improve TypeScript typings documentation, enabling better IDE support and autocompletion.
- refactor: Use
node:prefix for built-in modules.
Breaking Changes
- feat(#429): Change default value of
boundaries/dependency-nodessetting to["import", "export", "require", "dynamic-import"]. Previously onlyimportstatements were analyzed by default. To preserve previous behavior, set"boundaries/dependency-nodes": ["import"]explicitly in your configuration. - feat: Disable
no-privaterule by default in recommended configuration, as it is now deprecated and will be removed in a future major version. To preserve previous behavior, set"boundaries/no-private": [2, { "allowUncles": true }]explicitly in your configuration. - Remove
isExternalLibrarySelectorandisExternalLibrariesSelectortype guards. They are not needed anymore, as external rule is deprecated and external library selectors can be defined using the sameElementSelectorformat.
elements v2.0.0
Added
- feat: Add support for
capturedas an array in element selectors, where each element in the array represents an alternative (OR logic). The selector matches if any of the array elements matches. - feat: Support matching
nullvalues in selectors. - feat: Add support for
parentselector property to match against first parent (parents[0]) properties (type,category,elementPath, andcaptured).
Changed
- refactor: Improve typing for better maintainability.
- test: Improve test coverage and add more test cases for edge scenarios.
- chore: Update dependencies and devDependencies to their latest versions.
Breaking Changes
- feat: Remove
sourceandbaseSourceproperties from thetoandfromobjects in element descriptions and selectors. Move them to thedependencyobject instead, as they are properties of the dependency rather than the target element. This change may require updates to any custom rules or configurations that reference these properties in thetoobject. Refactor all types, tests, and documentation to reflect this change. - feat: Rename "baseSource" property to "module" to better reflect its purpose and avoid confusion with the "source" property. Update all types, tests, and documentation to reflect this change.
- feat: Support array of dependency metadata selectors in the
dependencyproperty of dependency selectors, allowing for more flexible matching of dependencies based on their metadata. Each selector in the array represents an alternative (OR logic), and the dependency matches if any of the selectors in the array matches its metadata. - feat: Remove external library selectors types and helpers.
- feat: Remove deprecated
dependencySelectorGlobalsoption from matching methods and types. - feat: Remove
getSelectorMatchingDescriptionmethod, as it was too generic and caused confusion. Instead, provide specific methods for matching element and dependency descriptions against their respective selectors (getElementSelectorMatchingDescriptionandgetDependencySelectorMatchingDescription) to improve clarity and usability.
website v6.0.0
Added
- feat(#401): Publish v6.0.0 documentation website with migration guides, updated rules reference, and new selector syntax documentation.
- feat: Add keywords to all pages to improve searchability and SEO.
Changed
- feat: Adapt docs to the new
object-basedselectors syntax. - feat: Add "Deprecated Rules" subsection to the sidebar, and move there the deprecated rules documentation.