Skip to content

Conversation

coliff
Copy link
Member

@coliff coliff commented Sep 2, 2025

This pull request introduces a new linting rule to enforce that all <form> elements have a method attribute with a valid value ("get", "post", or "dialog"). The rule is integrated into the core ruleset, tested with various scenarios, and documented for users.

New rule: Require valid method attribute on <form> elements

  • Added new rule implementation in form-method-require.ts to check for the presence and validity of the method attribute on <form> elements.
  • Registered the new rule in the core rules index (index.ts) and updated the ruleset interface (types.ts) to support configuration. [1] [2]

Testing and documentation

  • Created a comprehensive test suite for the new rule covering valid, invalid, and edge cases in form-method-require.spec.js.
  • Added user documentation describing the rule, configuration options, examples, and rationale in form-method-require.mdx. (page hidden for now)

Other changes

  • Minor formatting adjustments in .editorconfig for consistency.

@coliff coliff requested a review from thedaviddias as a code owner September 2, 2025 05:40
@github-actions github-actions bot added the test label Sep 2, 2025
Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Copy link

cloudflare-workers-and-pages bot commented Sep 2, 2025

Deploying htmlhint with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6077eb1
Status: ✅  Deploy successful!
Preview URL: https://27a2ca79.htmlhint.pages.dev
Branch Preview URL: https://dev-coliff-add-form-method-r.htmlhint.pages.dev

View logs

@coliff coliff requested a review from Copilot September 2, 2025 05:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new HTMLHint linting rule form-method-require that enforces all <form> elements to have a valid method attribute. The rule improves form security by preventing sensitive data exposure through default GET methods.

Key changes:

  • Implements a new rule to validate form method attributes with accepted values "get", "post", or "dialog"
  • Integrates the rule into the core HTMLHint system with proper type definitions and exports
  • Provides comprehensive test coverage and user documentation

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/core/rules/form-method-require.ts Core rule implementation checking for method attribute presence and validity
src/core/rules/index.ts Exports the new rule for integration into the rule system
src/core/types.ts Adds rule configuration option to the Ruleset interface
test/rules/form-method-require.spec.js Comprehensive test suite covering valid/invalid scenarios
website/src/content/docs/rules/form-method-require.mdx User documentation with examples and rationale
.editorconfig Minor formatting cleanup removing blank lines

@coliff coliff merged commit 15ef3df into main Sep 2, 2025
16 of 20 checks passed
@coliff coliff deleted the dev/coliff/add-form-method-require branch September 2, 2025 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant