Skip to content

Latest commit

 

History

History
71 lines (54 loc) · 1.16 KB

File metadata and controls

71 lines (54 loc) · 1.16 KB

ember/template-require-form-method

Require form elements to have a method attribute.

Form elements should explicitly specify the HTTP method they use. This improves code clarity and helps catch potential issues.

Examples

This rule forbids the following:

<template>
  <form></form>
</template>
<template>
  <form method='DELETE'></form>
</template>

This rule allows the following:

<template>
  <form method='POST'></form>
</template>
<template>
  <form method='GET'></form>
</template>
<template>
  <form method='DIALOG'></form>
</template>
<template>
  <form method='{{dynamicMethod}}'></form>
</template>

Configuration

  • allowedMethods (default: ['POST', 'GET', 'DIALOG']) - Array of allowed form method values
// .eslintrc.js
module.exports = {
  rules: {
    'ember/template-require-form-method': [
      'error',
      {
        allowedMethods: ['POST', 'GET'],
      },
    ],
  },
};

References