Blog>
Snippets

Defining Custom Rules with TanStack Config

Demonstrate creating custom configuration rules to extend the base configuration for a more tailored setup.
import { defineConfig } from 'tanstack-config';

// Extend the base config
export const customConfig = defineConfig({
  // Base configuration values
  base: true,
  // Custom rules
  customRules: {
    // Define a new rule 'myCustomRule'
    myCustomRule: {
      // Rule configuration
      option1: 'value1',
      option2: 42
    }
  }
});
This code imports the `defineConfig` function from 'tanstack-config' to create a new custom configuration. It defines a base configuration and extends it with custom rules, including a newly defined rule named 'myCustomRule' with its specific options.