How destefanis/design-lint works
1. The UI layer – located under the src/app directory. This is where the React components and styling reside, responsible for displaying the plugin’s interface (components like App.tsx, Banner.tsx, Modal.tsx, etc.) and handling user interactions.
2. The Plugin Logic & Linting Engine – located under the src/plugin directory. This area houses the core functionality that interacts with the Figma API (controller.ts) and runs the linting functions (e.g., lintingFunctions.ts). It handles assessing design node properties and orchestrating the error detection and reporting.
Main Components
• Figma Plugin Interface (UI)
• React UI Components (src/app/components)
• Styling (src/app/styles)
• Entry point (index.html and index.tsx)
• Plugin Controller & Linting Engine
• Main Figma API gateway and controller logic (src/plugin/controller.ts)
• Linting functions and custom rules (src/plugin/lintingFunctions.ts, lintingFunctionsforVariables.ts, remoteStyleFunctions.ts, styles.ts)
• Configuration & Build Tools
• Manifest file (manifest.json)
• Build configuration files (webpack.config.js, tsconfig.json, tslint.json)
Component Relationships and Data Flow
• Figma Environment: The plugin runs within Figma and interacts with its API (nodes, properties, selection, etc.).
• Plugin Controller:
• Acts as the bridge between Figma’s API and the React-based UI.
• Receives selected layers (nodes) from Figma, applies linting functions based on each node’s type, and collects errors.
• Passes the error information to the UI.
• UI Layer:
• Polls for changes (as indicated in the README) and refreshes on error resolution.
• Displays error details, provides navigation (selecting errors, ignore actions), and may pass user interactions back to the controller.
Architectural Patterns and Design Principles
• Separation of Concerns:
• The design separates the user interface, linting logic, and Figma API interactions.
• Modular Design:
• Linting functions are organized by node type (text, frame, rectangle, etc.) and are easily replaceable or extendable.
• Reactive and Event-Driven:
• The UI updates automatically as fixes are applied, with the controller polling for design changes.
• Extensibility:
• The README and file structure indicate that developers can easily add custom linting rules.
Relevant Technologies and Frameworks
• React – for the UI.
• TypeScript – ensuring type safety across both UI and plugin logic.
• Webpack – for bundling the project.
• TSLint and Prettier – for code quality and formatting.
• Figma Plugin API – integration layer with Figma designs.
Being Detailed Without Overcomplicating
• Related files (like the entire UI component collection or plugin logic functions) under a common banner if needed.