or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cspell-integration.mdhelper-functions.mdindex.mdplugin-configuration.mdrule-system.md
tile.json

cspell-integration.mddocs/

CSpell Integration

Configuration options for the underlying CSpell spell checking engine.

Capabilities

CSpell Options Interface

Core configuration options for the CSpell spell checking engine.

/**
 * CSpell engine configuration options
 * Subset of CSpell settings available for ESLint plugin configuration
 */
interface CSpellOptions {
  /**
   * Allows words to be glued together
   * @default false
   */
  allowCompoundWords?: boolean;

  /**
   * Determines if spell checking is case sensitive
   * @default false
   */
  caseSensitive?: boolean;

  /**
   * List of dictionaries to enable
   * References dictionary names from dictionaryDefinitions or built-in dictionaries
   */
  dictionaries?: string[];

  /**
   * Enable or disable spell checking
   * @default true
   */
  enabled?: boolean;

  /**
   * List of words to always be considered incorrect.
   * Words found in flagWords override words.
   * Format: 'word' or 'word:suggestion' or 'word->suggestion, suggestions'
   */
  flagWords?: string[];

  /**
   * List of words to be ignored.
   * An ignored word will not show up as an error, even if it is also in flagWords.
   */
  ignoreWords?: string[];

  /**
   * List of regular expression patterns or pattern names to exclude from spell checking.
   */
  ignoreRegExpList?: string[];

  /**
   * List of regular expression patterns or defined pattern names to match for spell checking.
   * If this property is defined, only text matching the included patterns will be checked.
   */
  includeRegExpList?: string[];

  /**
   * Import cspell config files
   * List of configuration files to import and merge
   */
  import?: string[];

  /**
   * The language locale to use
   * Examples: 'en-US', 'en-GB', 'en-US,en-GB'
   */
  language?: string;

  /**
   * List of words to be considered correct
   */
  words?: string[];

  /**
   * Define custom dictionaries
   */
  dictionaryDefinitions?: DictionaryDefinition[];
}

Dictionary Definition

Configuration for custom dictionaries.

/**
 * Dictionary definition for custom word lists
 */
interface DictionaryDefinition {
  /** Name of the dictionary (used in dictionaries array) */
  name: string;
  
  /** Optional description of the dictionary */
  description?: string;
  
  /** Path to dictionary file (for file-based dictionaries) */
  path?: string;
  
  /** Inline word list (for inline dictionaries) */
  words?: string[];
  
  /** Words to flag as incorrect */
  flagWords?: string[];
  
  /** Words to ignore */
  ignoreWords?: string[];
  
  /** Suggested words */
  suggestWords?: string[];
  
  /**
   * Strip case and accents to allow for case insensitive searches
   * Note: this setting only applies to word lists, not trie dictionaries
   */
  supportNonStrictSearches?: boolean;
}

Usage Examples:

// Basic CSpell configuration
const options = {
  cspell: {
    language: 'en-US',
    words: ['customword', 'mycompany', 'specialterm'],
    ignoreWords: ['outdatedterm'],
    dictionaries: ['typescript', 'node', 'custom-dict']
  }
};

// Advanced CSpell configuration with custom dictionary
const options = {
  cspell: {
    language: 'en-US,en-GB',
    allowCompoundWords: true,
    caseSensitive: false,
    words: ['webapi', 'nodejs'],
    flagWords: ['badword:goodword', 'typo->correction'],
    ignoreRegExpList: [
      '/\\b[A-Z]{2,}\\b/g', // Ignore all caps words
      'Email'               // Ignore email patterns
    ],
    dictionaries: ['typescript', 'custom-dict'],
    dictionaryDefinitions: [
      {
        name: 'custom-dict',
        description: 'Company-specific terms',
        path: './dictionaries/company-terms.txt'
      },
      {
        name: 'inline-dict',
        description: 'Inline word list',
        words: ['inlineword1', 'inlineword2'],
        supportNonStrictSearches: true
      }
    ]
  }
};

Integration with Configuration Files

Using external CSpell configuration files.

/**
 * Configuration file integration
 * The configFile option in the main Options interface
 */
interface ConfigFileOptions {
  /**
   * Path to the cspell configuration file.
   * Relative paths will be relative to the current working directory.
   * @since 8.8.0
   */
  configFile?: string;

  /**
   * Specify the root path of the cspell configuration.
   * It is used to resolve imports found in cspell options.
   * Examples: import.meta.url or __filename
   */
  cspellOptionsRoot?: string | URL;
}

Configuration File Examples:

// Using external cspell.json file
const options = {
  configFile: './cspell.json',
  cspellOptionsRoot: import.meta.url
};

// Combining external config with inline options
const options = {
  configFile: './cspell.config.js',
  cspell: {
    // These options will be merged with the config file
    words: ['additionalword'],
    dictionaries: ['extra-dict']
  }
};

Regular Expression Patterns

Pattern matching configuration for fine-grained control.

Built-in Pattern Examples:

const options = {
  cspell: {
    // Ignore common programming patterns
    ignoreRegExpList: [
      'Email',           // Email addresses
      'Urls',           // URLs
      'HexDigits',      // Hexadecimal numbers
      'Base64',         // Base64 encoded strings
      'UUIDs'           // UUID strings
    ],
    
    // Only check specific patterns
    includeRegExpList: [
      'Comments',       // Only check comments
      'Strings'         // Only check string literals
    ]
  }
};

Language and Locale Configuration

Multi-language spell checking support.

Language Examples:

// Single language
const options = {
  cspell: {
    language: 'en-US'
  }
};

// Multiple languages
const options = {
  cspell: {
    language: 'en-US,fr-FR,de-DE'
  }
};

// Regional variants
const options = {
  cspell: {
    language: 'en-US,en-GB' // American and British English
  }
};

Import Configuration

Importing external CSpell configurations.

// Import multiple configuration files
const options = {
  cspell: {
    import: [
      './cspell-base.json',
      './cspell-company.json',
      '@cspell/dict-typescript/cspell-ext.json'
    ]
  }
};