Skip to content

Plugin Authoring Example

Start a new plugin that exposes one rule.

Steps

  1. Scaffold the project:
    bash
    pnpm init
    pnpm add --save-dev @lapidist/design-lint typescript
  2. Create index.ts with a rule:
    ts
    export default {
      rules: [{ name: 'demo/no-raw-colors', create: () => ({}) }]
    };
  3. Test it:
    ts
    import { createLinter, createNodeEnvironment } from '@lapidist/design-lint';
    import plugin from './index.js';
    const config = { plugins: [plugin], rules: { 'demo/no-raw-colors': 'error' } };
    const linter = createLinter(config, createNodeEnvironment(config, {
      dsr: { socketPath: '/tmp/designlint-kernel.sock' },
    }));

Next steps

Read the plugins guide for a full tutorial.

Released under the MIT License.