forked from ag-grid/ag-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.stylelintrc.js
66 lines (65 loc) · 2.66 KB
/
.stylelintrc.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module.exports = {
extends: 'stylelint-config-standard',
rules: {
'comment-empty-line-before': [
'always',
{
except: ['first-nested'],
ignoreComments: ['/rtl:.*/'],
},
],
// NOTE: the intention here is that all our CSS rules have a single
// class name in the selector that identifies the component. Whenever
// we need to target "the instance of a child component inside a parent"
// use `:where(.ag-parent) .ag-child` to reduce the specificity.
//
// We allow state selectors like :focus and .ag-disabled on top of this,
// because we want them to be slightly more specific. If for example a
// component .ag-foo has a default color and a focus color, we want
// `.ag-foo { color: black }` to set the default colour without also
// removing the focus effect.
'selector-max-specificity': [
'0,1,0',
{
// add selectors here only if they refer to states, rather than components
ignoreSelectors: [
'/^:/',
'[disabled]',
':not(:disabled)',
'[readonly]',
'.ag-animating',
'.ag-disabled',
'.ag-selected',
'.ag-not-selected',
'.ag-checked',
'.ag-cell-inline-editing',
'.ag-row-hover',
'.ag-row-selected',
'.ag-picker-has-focus',
'.ag-sticky-label',
'.ag-header-cell-wrap-text',
'.ag-tab-selected',
'.ag-column-select-column-readonly',
'.ag-column-select-column-group-readonly',
'.ag-active-item',
'.ag-layout-print',
'.ag-layout-normal',
'.ag-layout-auto-height',
],
},
],
// NOTE: In general we want to avoid targeting grid elements using
// [class^='ag-'] as customer applications can have elements with that
// prefix too. Sometimes it is unavoidable, e.g. for global style
// resets, in which case scope the selector so it is only applied within
// the grid root.
'selector-disallowed-list': [
['/.*class\\^=.*/'],
{
message:
'Avoid selectors that target partial classnames unless absolutely necessary - see note in .stylelintrc.js',
severity: 'error',
},
],
},
};