value-keyword-layout-mappings
Specify flow-relative or physical layout mappings for value keywords.
a { float: left; }/** ↑ * This keyword */Use this rule to enforce a convention. Physical keywords like left and top are tied to the screen, while flow-relative keywords like inline-start and block-start follow the writing mode.
Choose:
"flow-relative"to support right-to-left and vertical writing modes"physical"if you support only one writing mode, or for older browsers
The fix option can automatically fix problems reported by this rule when both the primary option is "flow-relative" and the languageOptions.directionality configuration property is configured.
This rule supports 2 message arguments: the disallowed mapping and the keyword, or the physical keyword and its flow-relative equivalent.
Prior art:
Options
Section titled “Options”"flow-relative"
Section titled “"flow-relative"”Layout mappings for value keywords must always be flow-relative.
Given:
{ "value-keyword-layout-mappings": "flow-relative"}The following patterns are considered problems:
a { float: left; }a { text-align: right; }a { resize: horizontal; }The following patterns are not considered problems:
a { float: inline-start; }a { text-align: end; }a { resize: inline; }"physical"
Section titled “"physical"”Layout mappings for value keywords must always be physical.
Given:
{ "value-keyword-layout-mappings": "physical"}The following patterns are considered problems:
a { float: inline-start; }a { text-align: start; }a { resize: inline; }The following patterns are not considered problems:
a { float: left; }a { text-align: right; }a { resize: horizontal; }Optional secondary options
Section titled “Optional secondary options”ignoreProperties
Section titled “ignoreProperties”Ignore the specified properties.
{ "ignoreProperties": ["array", "of", "properties", "/regex/"] }Given:
{ "value-keyword-layout-mappings": [ "flow-relative", { "ignoreProperties": ["text-align", "/^offset-/"] } ]}The following patterns are not considered problems:
a { text-align: left; }a { offset-anchor: top left; }ignoreKeywords
Section titled “ignoreKeywords”Ignore the specified keywords.
{ "ignoreKeywords": ["array", "of", "keywords", "/regex/"] }Given:
{ "value-keyword-layout-mappings": [ "flow-relative", { "ignoreKeywords": ["left", "/^hor/"] } ]}The following patterns are not considered problems:
a { float: left; }a { resize: horizontal; }