@dmkishi/stylelint-config 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/index.mjs +77 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@dmkishi/stylelint-config
|
|
2
|
+
================================================================================
|
|
3
|
+
DM Kishi's custom [Stylelint](https://stylelint.io) config. It extends the
|
|
4
|
+
following configs with some customizations:
|
|
5
|
+
|
|
6
|
+
- [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard)
|
|
7
|
+
- [stylelint-config-clean-order](https://github.com/kutsan/stylelint-config-clean-order)
|
|
8
|
+
|
|
9
|
+
Install
|
|
10
|
+
--------------------------------------------------------------------------------
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add --save-dev stylelint @dmkishi/stylelint-config
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### stylelint.config.mjs
|
|
16
|
+
```js
|
|
17
|
+
export default {
|
|
18
|
+
extends: ['@dmkishi/stylelint-config'],
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Develop
|
|
23
|
+
--------------------------------------------------------------------------------
|
|
24
|
+
### Validation
|
|
25
|
+
The validation script `pnpm validate` resolves the full config against a fixture
|
|
26
|
+
(proving `extends` and plugin resolution work) and lints the fixture, which must
|
|
27
|
+
pass clean.
|
|
28
|
+
|
|
29
|
+
Changelog
|
|
30
|
+
--------------------------------------------------------------------------------
|
|
31
|
+
### v0.0.0 (2026-7-10)
|
|
32
|
+
- Initial release.
|
package/index.mjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { propertyGroups } from 'stylelint-config-clean-order';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @type {import('stylelint').Config}
|
|
5
|
+
*/
|
|
6
|
+
export default {
|
|
7
|
+
extends: [
|
|
8
|
+
'stylelint-config-standard',
|
|
9
|
+
'stylelint-config-clean-order',
|
|
10
|
+
],
|
|
11
|
+
rules: {
|
|
12
|
+
/**
|
|
13
|
+
* Require an empty line before custom properties, except for the first one
|
|
14
|
+
* in a block, and ignore the rule between consecutive custom properties so
|
|
15
|
+
* variables can be grouped together without blank lines between them.
|
|
16
|
+
*/
|
|
17
|
+
'custom-property-empty-line-before': ['always', {
|
|
18
|
+
except: [
|
|
19
|
+
'first-nested',
|
|
20
|
+
],
|
|
21
|
+
ignore: [
|
|
22
|
+
'after-custom-property',
|
|
23
|
+
],
|
|
24
|
+
}],
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Disable stylelint-config-standard's class naming convention so any style
|
|
28
|
+
* (BEM, camelCase, CSS Modules, etc.) is allowed.
|
|
29
|
+
*/
|
|
30
|
+
'selector-class-pattern': null,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Override stylelint-config-clean-order's `order/order`: place `@media`
|
|
34
|
+
* blocks right after the element's own declarations (instead of last, after
|
|
35
|
+
* nested rules), so media overrides stay grouped with what they override.
|
|
36
|
+
*/
|
|
37
|
+
'order/order': [
|
|
38
|
+
[
|
|
39
|
+
{ type: 'at-rule', name: 'import' },
|
|
40
|
+
{ type: 'at-rule', name: 'forward' },
|
|
41
|
+
{ type: 'at-rule', name: 'use' },
|
|
42
|
+
'dollar-variables',
|
|
43
|
+
'at-variables',
|
|
44
|
+
'custom-properties',
|
|
45
|
+
{ type: 'at-rule', name: 'custom-media' },
|
|
46
|
+
{ type: 'at-rule', name: 'function' },
|
|
47
|
+
{ type: 'at-rule', name: 'mixin' },
|
|
48
|
+
{ type: 'at-rule', name: 'extend' },
|
|
49
|
+
'declarations',
|
|
50
|
+
{ type: 'at-rule', name: 'media', hasBlock: true },
|
|
51
|
+
{ type: 'rule', selector: /^&::[\w-]+/, hasBlock: true },
|
|
52
|
+
'rules',
|
|
53
|
+
],
|
|
54
|
+
{
|
|
55
|
+
severity: 'warning',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Disable the empty-line enforcement that stylelint-config-clean-order adds,
|
|
61
|
+
* i.e. blank lines are left to the author's discretion.
|
|
62
|
+
*/
|
|
63
|
+
'declaration-empty-line-before': null,
|
|
64
|
+
'at-rule-empty-line-before': null,
|
|
65
|
+
'order/properties-order': [
|
|
66
|
+
propertyGroups.map((properties) => ({
|
|
67
|
+
noEmptyLineBetween: true,
|
|
68
|
+
emptyLineBefore: 'never', // Don't add empty lines between order groups.
|
|
69
|
+
properties,
|
|
70
|
+
})),
|
|
71
|
+
{
|
|
72
|
+
severity: 'warning',
|
|
73
|
+
unspecified: 'bottomAlphabetical',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dmkishi/stylelint-config",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "DM Kishi's custom stylelint config",
|
|
5
|
+
"homepage": "https://github.com/dmkishi/dmkishi-stylelint-config",
|
|
6
|
+
"author": "DM Kishi <dm.kishi@gmail.com>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.mjs"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"stylelint-config-clean-order": "^10.0.0",
|
|
19
|
+
"stylelint-config-standard": "^40.0.0",
|
|
20
|
+
"stylelint-order": "^8.1.1"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"stylelint": "^17.0.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"husky": "^9.1.7",
|
|
27
|
+
"stylelint": "^17.14.0"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"validate": "stylelint --config index.mjs --print-config test/fixture.css > /dev/null && stylelint --config index.mjs test/fixture.css"
|
|
31
|
+
}
|
|
32
|
+
}
|