ViewLint Logo

ViewLint

Configuration Files

Edit ViewLint Configuration

You can put your ViewLint configuration into a file. These include rules, plugins, custom Views, Scopes, and Options.

Configuration File

ViewLint looks for one of these files (starting from your current directory and walking upward):

  • viewlint.config.ts
  • viewlint.config.mjs
  • viewlint.config.js

You can also point to a specific file on the CLI:

viewlint --config path/to/viewlint.config.ts https://example.com

Export shape

Your config file exports an array of configuration objects. You can use the defineConfig from viewlint/config to have type hints and support deeply nested configuration arrays.

Here's an example configuration:

import { defineConfig } from "viewlint/config";
import rules from "@viewlint/rules";

export default defineConfig([
  {
    plugins: {
      rules,
    },
    extends: ["rules/recommended"],
  },
  {
    rules: {
      "text-contrast": "error"
    }
  }
]);

Configuration Objects

Here's a high-level overview of what you can edit. Click on the links to see in more detail how these features work.

  • extends: An array of strings, configuration objects, or configuration arrays that contain additional configuration to apply. Only available when using defineConfig.
  • rules: An object containing the configured rules.
  • plugins: An object containing a name-value mapping of plugin names to plugin objects.
  • views: An object containing a name-value mapping of view names to Views, representing preset, reusable views.
  • options: An object containing a name-value mapping of option names to Options, representing preset, reusable options.
  • scopes: An object containing a name-value mapping of scope names to Scope functions/arrays, representing preset, reusable scopes.

On this page