-
Notifications
You must be signed in to change notification settings - Fork 662
Expand file tree
/
Copy pathstylelint.config.mjs
More file actions
38 lines (38 loc) · 1.44 KB
/
stylelint.config.mjs
File metadata and controls
38 lines (38 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* @type {import('stylelint').Configuration}
*/
export default {
extends: ['@primer/stylelint-config'],
rules: {
// We want to allow type selectors like `svg`
'selector-max-type': 1,
'selector-class-pattern': [
'^(focus-visible|[A-Z][a-zA-Z0-9]+(__[a-z]+(-[a-z]+)*)?(--[a-z]+(-[a-z]+)*)?)$',
{
resolveNestedSelectors: true,
message: '"%s" selector should be written in PascalCase or BEM format (e.g. block__element--modifier)',
},
],
'layer-name-pattern': '^[a-z][a-zA-Z0-9.-]*$',
// :has() can cause severe perf issues in Safari (quadratic style invalidation).
// See github/github-ui#17224 for audit. Existing usages are audited and scoped.
// New usages must be explicitly approved and marked with a stylelint-disable comment.
'selector-pseudo-class-disallowed-list': [
['has'],
{
severity: 'error',
message:
':has() selectors can cause severe Safari performance issues (github/github-ui#17224). Verify the selector is scoped (CSS Modules) and does not match broadly, then add a scoped stylelint disable (e.g. "stylelint-disable-next-line" or a minimal "stylelint-disable"/"stylelint-enable" block), not a file-level disable.',
},
],
},
overrides: [
{
files: ['examples/**/*.css'],
rules: {
// Examples may intentionally leave css files blank as placeholders
'no-empty-source': null,
},
},
],
}