2.1.3 • Published 20 days ago

@mrhenry/stylelint-mrhenry-attribute-selector-no-unknown v2.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
20 days ago

@mrhenry/stylelint-mrhenry-attribute-selector-no-unknown

version

Disallow unknown attribute selectors.

/* valid, the `name` attribute is allowed on button elements. */
button[name] {}

/* valid, the `name` attribute is not a global attribute, but used without a type selector. */
[name] {}

/* invalid, the `href` attribute is not allowed on button elements. */
button[href] {}
/* valid, the `data-foo` attribute has a `data-*` prefix. */
[data-foo] {}

/* invalid, `foo` attribute doesn't exist. */
[foo] {}

Warns when attribute selectors are used that are not allowed on the given element.

While it is valid and allowed to use any attribute name on any element, it is not recommended to do so.

It is preferable to use the data-* attribute for custom attributes.

Usage

npm install --save-dev @mrhenry/stylelint-mrhenry-attribute-selector-no-unknown

// stylelint.config.js
module.exports = {
	plugins: [
		"@mrhenry/stylelint-mrhenry-attribute-selector-no-unknown",
	],
	rules: {
		"@mrhenry/stylelint-mrhenry-attribute-selector-no-unknown": true,
	},
}
2.1.3

20 days ago

2.1.2

3 months ago

2.1.1

3 months ago

2.1.0

10 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago