npm eslint-plugin-boundaries 6.0.0
Object-based elements selector syntax

latest releases: 7.4.4, 7.4.3, 7.4.2...
8 months ago

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 from and to dependency selector objects in the boundaries/dependencies rule, enabling matching based on dependency relationship, origin, source, internal path, and more.
  • feat(#387): Add optional category field to element descriptors to enable multi-dimensional architectural classification.
  • feat(#386): Support a name property in the additional-dependency-nodes setting on each node definition, allowing to identify custom dependency nodes by name in rules and messages.
  • feat: Add checkAllOrigins, checkUnknownLocals and checkInternals options to dependencies (old element-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/debug setting 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-types rule to boundaries/dependencies. The legacy name is still supported with a deprecation warning.
  • feat(#393): Deprecate rule-level importKind option in favor of selector-level dependency.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-nodes setting to ["import", "export", "require", "dynamic-import"]. Previously only import statements were analyzed by default. To preserve previous behavior, set "boundaries/dependency-nodes": ["import"] explicitly in your configuration.
  • feat: Disable no-private rule 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 isExternalLibrarySelector and isExternalLibrariesSelector type guards. They are not needed anymore, as external rule is deprecated and external library selectors can be defined using the same ElementSelector format.

elements v2.0.0

Added

  • feat: Add support for captured as 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 null values in selectors.
  • feat: Add support for parent selector property to match against first parent (parents[0]) properties (type, category, elementPath, and captured).

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 source and baseSource properties from the to and from objects in element descriptions and selectors. Move them to the dependency object 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 the to object. 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 dependency property 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 dependencySelectorGlobals option from matching methods and types.
  • feat: Remove getSelectorMatchingDescription method, as it was too generic and caused confusion. Instead, provide specific methods for matching element and dependency descriptions against their respective selectors (getElementSelectorMatchingDescription and getDependencySelectorMatchingDescription) 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-based selectors syntax.
  • feat: Add "Deprecated Rules" subsection to the sidebar, and move there the deprecated rules documentation.

Don't miss a new eslint-plugin-boundaries release

NewReleases is sending notifications on new releases.