CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-eslint-plugin-regexp

ESLint plugin for finding RegExp mistakes and RegExp style guide violations.

82

0.96x
Overview
Eval results
Files

task.mdevals/scenario-8/

Regex Style Normalizer

A small utility that builds an ESLint configuration and lint runner focused on normalizing regular expression style: character classes, quantifiers, flags, and escape sequences.

Capabilities

Configures regex style linting

  • Creates a ready-to-use ESLint configuration (legacy or flat) that enables the regex style normalization dependency and turns on style normalization for character classes, quantifiers, flags, and escape sequences at error severity. @test

Lints provided sources

  • lintRegexStyles lints supplied JS/TS source strings with that configuration, returning rule ids, messages, and locations for every regex style normalization issue; sources without regex style problems return an empty list. @test

Applies autofix when requested

  • With fix: true, linting rewrites [0-9] into \\d, converts a{1,} into a+, reorders /abc/ig flags into canonical order, and reports an escape-style violation for a literal containing an unescaped control character. @test

Summarizes results

  • lintRegexStyles returns {id, errors, fixedText?} per input, preserving the order of the provided sources. @test

Implementation

@generates

API

export type RegexStyleConfigFormat = "flat" | "legacy";

export interface LintRequest {
  id: string;
  sourceText: string;
  fix?: boolean;
}

export interface LintResult {
  id: string;
  errors: {
    ruleId: string;
    message: string;
    line: number;
    column: number;
  }[];
  fixedText?: string;
}

/**
 * Build an ESLint configuration that enforces regex style normalization
 * for character classes, quantifiers, flags, and escape sequences.
 */
export function buildRegexStyleConfig(format?: RegexStyleConfigFormat): any;

/**
 * Lint one or more source snippets using the regex style configuration.
 * Applies autofix when requested and returns structured results.
 */
export async function lintRegexStyles(
  requests: LintRequest[],
  format?: RegexStyleConfigFormat
): Promise<LintResult[]>;

Dependencies { .dependencies }

eslint { .dependency }

Provides programmatic linting support.

eslint-plugin-regexp { .dependency }

Enforces regex-oriented lint rules, including style normalization.

Install with Tessl CLI

npx tessl i tessl/npm-eslint-plugin-regexp

tile.json