-
Notifications
You must be signed in to change notification settings - Fork 43
/
stylelint.config.cjs
148 lines (142 loc) · 4.64 KB
/
stylelint.config.cjs
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
const camelCase = /^[a-z]+([A-Z][a-z]+)*$/
/**
* @type {import('stylelint').Config}
*/
module.exports = {
extends: [
'stylelint-config-standard-scss',
/** @see https://github.com/pascalduez/stylelint-config-css-modules */
'stylelint-config-css-modules',
/**
* @see https://github.com/ota-meshi/stylelint-config-standard-vue
*/
'stylelint-config-standard-vue/scss',
/**
* Orders properties beginning with properties that exist outside the styled box (e.g. `margin`), with subsequent properties moving inwards from that. This way, properties that affect placement of sibling elements are always at the top.
* @see https://github.com/chaucerbao/stylelint-config-concentric-order
*/
'stylelint-config-concentric-order'
],
plugins: [
/**
* This is the plugin that keeps us using stylelint 14.3 for now (and has a cascade effect on the versions of every other stylelint plugin). It makes it possible to require variables for properties *by the type of property value* (like length, color, etc).
*
* Other plugins I've found for requiring CSS variables usually need call out *individual properties* like `width`, `margin`, `background-color`, etc. Life's too short for that shit.
*
* @see https://github.com/Mavrin/stylelint-declaration-use-css-custom-properties
*/
// FIXME: submit a PR to update this plugin for stylelint 15
'@mavrin/stylelint-declaration-use-css-custom-properties'
],
rules: {
'mavrin/stylelint-declaration-use-css-custom-properties': {
/**
* @see https://csstree.github.io/docs/syntax/
*/
cssDefinitions: ['color', 'length', 'z-index', 'line-height'],
ignoreProperties: ['/^\\$/', '/^--/', '//^@'],
ignoreValues: [
'/^@/',
'/^\\$/',
'transparent',
'currentcolor',
'0',
'/[0-9]+(\\.[0-9]+)?em/',
'/#\\{.+?\\}/'
]
},
'scss/double-slash-comment-empty-line-before': null,
// silence complaints about floating points (which are a temp workaround anyways)
'number-max-precision': null,
'declaration-block-no-redundant-longhand-properties': null,
// useful as placeholders when prototyping SFC that will later get styled
'block-no-empty': null,
'function-name-case': ['lower', { ignoreFunctions: [camelCase] }],
'rule-empty-line-before': null,
// *theoretically* this would be good to use, but i don't have the patience to do it right now
'no-descending-specificity': null,
'string-quotes': ['single'],
'selector-class-pattern': [
/^((ironsworn__|tox-[a-z+]__)?[a-z][a-z-0-9]*[a-z0-9])|ProseMirror$/,
{
resolveNestedSelectors: true
}
],
'import-notation': null,
// FIXME workaround required for LESS to lint
'no-invalid-position-at-import-rule': null,
// FIXME workaround required for LESS to lint
'function-no-unknown': null,
// FIXME workaround required for LESS to lint
'no-duplicate-at-import-rules': null,
// FIXME workaround required for LESS to lint
'no-invalid-double-slash-comments': null,
/**
* Enforces consistent naming for CSS custom properties.
*
* `ironsworn` - Properties specific to this module. If you're adding a brand new property, it should probably have this.
* `starforged` - An alternative namespace for Starforged specific content. Avoid this and generalize to themes where possible.
* `isicon` - Properties that represent the relative URL of a custom icon.
* `font` - FVTT font properties.
* `color` - FVTT color properties.
* `form-field` - FVTT form-field properties.
* `fa` - FontAwesome properties.
*
* @example ```less
* --ironsworn-custom-property: sqrt(2);
* ```
*/
'custom-property-pattern':
'(ironsworn|starforged|isicon|font|color|fa|form-field)-.+'
},
overrides: [
{
files: ['**/*.vue', '**/*.scss'],
rules: {
'scss/operator-no-newline-after': null,
// prefer vanilla CSS variables (a.k.a. custom properties) instead
'scss/no-dollar-variables': [true],
'scss/dollar-variable-pattern': camelCase,
'scss/at-mixin-pattern': camelCase,
'at-rule-no-unknown': null,
'scss/at-rule-no-unknown': [
true,
{
ignoreAtRules: ['value']
}
],
'custom-property-empty-line-before': null,
'scss/dollar-variable-empty-line-before': null,
'scss/function-no-unknown': [
true,
{
ignoreFunctions: [
'v-bind',
'getIconVars',
'getIconClasses',
'setChannel',
'getChannel',
'luminance',
'lightest',
'darkest',
'contrast',
'mix',
'hcl',
'lch',
'oklch',
'scaleSteps',
'gamutize'
]
}
]
}
},
{
files: ['**/*.scss']
},
{
files: ['**/*.vue'],
customSyntax: 'postcss-html'
}
]
}