name-pattern
What it does
Section titled “What it does”Reports the name of a form control that does not match the option pattern, a regex that by default means camelCase, with a trailing [] allowed.
Why it matters
Section titled “Why it matters”The name is the key of the value on the server and in scripts, so a fixed style makes the keys predictable; a name in another style is often a typo that the server never reads.
To fix, rename the control and what reads its value, or change the pattern.
Example
Section titled “Example”...<p id="foo-bar"></p>...<input name="fooBar"><input name="foo_bar"><input name="foo[]">...Configuration
Section titled “Configuration”angular: lint: rules: name-pattern: level: warn # off (default), warn, error options: pattern: "^[a-z][a-zA-Z0-9]*(\\[\\])?$"html: lint: rules: name-pattern: level: warn # off (default), warn, error options: pattern: "^[a-z][a-zA-Z0-9]*(\\[\\])?$"svelte: lint: rules: name-pattern: level: warn # off (default), warn, error options: pattern: "^[a-z][a-zA-Z0-9]*(\\[\\])?$"vue: lint: rules: name-pattern: level: warn # off (default), warn, error options: pattern: "^[a-z][a-zA-Z0-9]*(\\[\\])?$"| Option | Type | Default | Description |
|---|---|---|---|
pattern |
string | "^[a-z][a-zA-Z0-9]*(\\[\\])?$" |
The regex the value must match. |
Suppress one line with sudsy-disable-next-line name-pattern in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| html-validate | name-pattern |
full |