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-1/

Regex Correctness Lint Reporter

Build a module that lints JavaScript or TypeScript source for regex correctness issues, focusing on invalid syntax, duplicate constructs, and empty structures. The module should expose functions that run the linter against in-memory source strings or filesystem paths and return normalized issue data.

Capabilities

Detects invalid regex patterns

  • Linting a source containing new RegExp("[") reports at least one issue; the message mentions the invalid pattern and the ruleId reflects a regex-focused lint rule. @test

Detects duplicate constructs

  • Linting a source containing /foo|foo/ returns an issue that captures the duplicate branch and includes its pattern text. @test

Detects empty constructs

  • Linting a source containing /()/ reports an issue pinpointing the empty construct with its location. @test

Normalized issue output

  • Returned issues are sorted by filename then position; each issue includes filename, ruleId, message, pattern, line, and column values. @test

Implementation

@generates

API

export interface SourceInput {
  filename: string;
  code: string;
}

export interface RegexIssue {
  filename: string;
  ruleId: string;
  message: string;
  pattern: string;
  line: number;
  column: number;
}

export async function lintRegexSources(inputs: SourceInput[]): Promise<RegexIssue[]>;

export async function lintPaths(globs: string[]): Promise<RegexIssue[]>;

Dependencies { .dependencies }

eslint-plugin-regexp { .dependency }

Provides regex-focused linting for invalid syntax, duplicate elements, and empty constructs.

eslint { .dependency }

Used to execute the linting engine.

Install with Tessl CLI

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

tile.json