Skip to content

feat: add fenced-code-meta rule#512

Merged
snitin315 merged 8 commits into
eslint:mainfrom
TKDev7:fenced-code-meta
Dec 27, 2025
Merged

feat: add fenced-code-meta rule#512
snitin315 merged 8 commits into
eslint:mainfrom
TKDev7:fenced-code-meta

Conversation

@TKDev7

@TKDev7 TKDev7 commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

Prerequisites checklist

What is the purpose of this pull request?

This pull request introduces a new rule, fenced-code-meta, that enforces a consistent policy for metadata in fenced code block info strings. It allows teams to require metadata when a language is specified or to disallow metadata entirely.

What changes did you make? (Give an overview)

  • Added a rule that validates the presence or absence of metadata based on the configured mode
  • Added documentation
  • Added tests

Related Issues

Fixes #477

Is there anything you'd like reviewers to focus on?

@eslintbot eslintbot added this to Triage Aug 25, 2025
@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Aug 25, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces a new ESLint rule fenced-code-meta that enforces consistent policies for metadata in fenced code block info strings. The rule can either require metadata when a language is specified ("always" mode) or disallow metadata entirely ("never" mode).

  • Added a new rule that validates the presence or absence of metadata in fenced code blocks
  • Comprehensive test coverage for both backtick and tilde fenced code blocks with various configurations
  • Complete documentation with examples and usage guidelines

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/rules/fenced-code-meta.js Implements the core rule logic for validating fenced code block metadata
tests/rules/fenced-code-meta.test.js Comprehensive test suite covering valid and invalid cases for both rule modes
docs/rules/fenced-code-meta.md User documentation with examples and configuration options
README.md Updates rule table and formatting improvements for ESLint disable comments

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/rules/fenced-code-meta.js Outdated
Comment thread src/rules/fenced-code-meta.js Outdated

@nzakas nzakas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. Overall it looks good. I think the Copilot comments bring up good points, so please take a look at those. Also, double-check the CI errors.

Comment thread README.md
@nzakas nzakas moved this from Needs Triage to Implementing in Triage Aug 26, 2025
nzakas
nzakas previously approved these changes Aug 27, 2025

@nzakas nzakas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Would like another review before merging.

@nzakas nzakas moved this from Implementing to Second Review Needed in Triage Aug 27, 2025
Comment thread tests/rules/fenced-code-meta.test.js Outdated
Comment thread docs/rules/fenced-code-meta.md Outdated
Comment thread docs/rules/fenced-code-meta.md Outdated
Comment thread tests/rules/fenced-code-meta.test.js
Comment thread docs/rules/fenced-code-meta.md Outdated
Comment thread src/rules/fenced-code-meta.js
Comment thread src/rules/fenced-code-meta.js
Comment thread src/rules/fenced-code-meta.js Outdated
@nzakas

nzakas commented Oct 7, 2025

Copy link
Copy Markdown
Member

@TKDev7 when you're available again, please take a look at the comments here.

@nzakas nzakas moved this from Second Review Needed to Implementing in Triage Oct 7, 2025
@TKDev7 TKDev7 requested a review from lumirlumir October 27, 2025 09:04
Comment thread docs/rules/fenced-code-meta.md Outdated
Comment thread tests/rules/fenced-code-meta.test.js
Comment thread src/rules/fenced-code-meta.js Outdated
Comment thread tests/rules/fenced-code-meta.test.js Outdated
Comment thread src/rules/fenced-code-meta.js Outdated

@lumirlumir lumirlumir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Would like @snitin315 and @nzakas to verify the changes before merging.

@lumirlumir lumirlumir moved this from Implementing to Second Review Needed in Triage Nov 2, 2025

@SwetaTanwar SwetaTanwar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@snitin315 snitin315 merged commit f30e1c9 into eslint:main Dec 27, 2025
24 checks passed
@github-project-automation github-project-automation Bot moved this from Second Review Needed to Complete in Triage Dec 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Rule Change: Add fenced-code-meta rule

7 participants