ESLint plugin leveraging ast-grep for pattern-based syntax restriction. Current stable version: 1.0.0. Released under MIT license. Key differentiator: uses ast-grep's powerful pattern matching instead of ESLint's built-in AST selectors, enabling more flexible and concise rule definitions. Requires ESLint >=9.0.0 and @ast-grep/napi >=0.30.0. Provides a single rule `no-restricted-syntax` that accepts string patterns or objects with custom messages. Adheres to ESLint's flat config and is ESM-only.
npm install eslint-plugin-ast-grepVerified import paths — ran on the pinned version, not inferred.
Basic ESLint flat config using the plugin to ban console.log and console.warn via ast-grep patterns.
Upgrade ESLint to >=9.0.0 and migrate to flat config.
Use `import` syntax; if in CommonJS project, use dynamic import or switch to ESM.
Replace ESLint selectors with ast-grep pattern syntax.
Run 'npm install -D eslint-plugin-ast-grep'.
Migrate to eslint.config.js flat config (see docs).