stylelint-attribute-case-sensitivity
v2.1.2
Published
Allow or disallow case-sensitivity for attribute selectors
Readme
stylelint-attribute-case-sensitivity
Summary
CSS Selectors Level 4 defines identifiers for attribute selectors' case-sensitivity.
This function sets whether to allow or disallow each of the three patterns: no identifier, i identifier, and s identifier.
/* default case-sensitivity */
input[type='text'] {
}
/* case-insensitively */
input[type='text' i] {
}
/* case-sensitively */
input[type='text' s] {
}Usage
/** @type {import('stylelint').Config} */
export default {
plugins: ['stylelint-attribute-case-sensitivity'],
rules: {
'plugin/attribute-case-sensitivity': [
true,
{
default: ['class', 'for', 'id', 'name', 'tabindex', /^data-/v],
i: ['hreflang', 'lang', 'method', 'rel', 'type'],
s: [],
},
],
},
};Rule options
| name | type | description |
| --------- | ---------------------- | ------------------------------------------------------- |
| default | (string \| RegExp)[] | List of attribute names that enforce no identifier |
| i | (string \| RegExp)[] | List of attribute names that enforce the identifier i |
| s | (string \| RegExp)[] | List of attribute names that enforce the identifier s |
* If any property is omitted, its default value is set.
* If you wish to add attributes to the default values, please submit an issue.
