stylelint
Version:
A mighty, modern CSS linter.
104 lines (70 loc) • 1.05 kB
Markdown
# selector-no-type
Disallow type selectors.
```css
a {}
/** ↑
* This type of selector */
```
## Options
### `true`
The following patterns are considered warnings:
```css
a {}
```
```css
a, .foo {}
```
```css
a > [foo] {}
```
The following patterns are *not* considered warnings:
```css
.foo {}
```
```css
[foo] {}
```
```css
#foo {}
```
```css
.bar > #foo {}
```
```css
#foo.bar {}
```
## Optional secondary options
### `ignore: ["compounded", "descendant"]`
#### `"compounded"`
Allow compounded type selectors -- i.e. type selectors chained with other selectors.
The following patterns are *not* considered warnings:
```css
a.foo {}
```
```css
a#bar {}
```
#### `"descendant"`
Allow descendant type selectors.
The following patterns are *not* considered warnings:
```css
.foo a {}
```
```css
#bar a.foo {}
```
### `ignoreTypes: ["/regex/", "string"]`
Given:
```js
["/^my-/", "custom"]
```
The following patterns are *not* considered warnings:
```css
custom {}
```
```css
my-type {}
```
```css
my-other-type {}
```