Ctrl + K
DocumentationLog inGet started

tessl/npm-eslint-plugin-regexp

tessl install tessl/npm-eslint-plugin-regexp@2.10.0

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

Agent Success

Agent success rate when using this tile

82%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.96x

Baseline

Agent success rate without this tile

85%

task.mdevals/scenario-8/

RegExp API Safety Linting

Create a minimal ESLint setup that enforces correct JavaScript RegExp API usage for boolean checks, detailed matches, and safe replacements. Provide fixtures and a script so linting clearly distinguishes good usage from bad usage.

Capabilities

Boolean versus detailed matching

  • Linting fails when code uses string matching methods for simple true/false checks instead of the regex boolean method, and passes when the boolean method is used. @test
  • Linting fails when code relies on string matching to retrieve match details instead of the regex execution method, and passes when the execution method is used. @test

Replacement safety

  • Linting fails when replacement strings contain literal dollar signs that are not escaped, and passes when the dollar signs are escaped to keep replacements literal. @test
  • Linting fails when replacements include unnecessary default match tokens instead of explicit content, and passes when those tokens are removed or replaced with clear named content. @test

Implementation

@generates

  • Provide a flat ESLint configuration that loads the regexp-focused linting plugin and enables rules covering the behaviors above at error severity.
  • Configure lint targets to cover src/examples/*.js.

Fixtures

  • Include src/examples/bad.js with one instance of each violation: boolean check via string matching, extracting details via string matching, unescaped $ in a replacement, and an unnecessary default replacement token.
  • Include src/examples/good.js with corrected versions of those four cases that lint cleanly.

Usage

  • Add an npm script test that runs ESLint against the fixtures and fails on violations in bad.js while good.js passes.

Dependencies { .dependencies }

eslint-plugin-regexp { .dependency }

Enforces regular expression best practices and safe usage in linted code.

eslint { .dependency }

Provides the linting engine used to apply the regular expression rules.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/eslint-plugin-regexp@2.10.x
tile.json