@cichol/stylelint-config 5.3.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 ADDED
@@ -0,0 +1,54 @@
1
+ # `@cichol/stylelint-config`
2
+
3
+ A Stylelint configuration for personal projects.
4
+
5
+ [![Build Status][github actions badge]][github actions][![Coverage Status][coverage badge]][coverage][![License][license badge]](LICENSE)[![Package Version][npm package version badge]][npm package]
6
+
7
+ ## Table of Contents
8
+
9
+ - [`@cichol/stylelint-config`](#cicholstylelint-config)
10
+ - [Table of Contents](#table-of-contents)
11
+ - [Requisites](#requisites)
12
+ - [Installation](#installation)
13
+ - [Usage](#usage)
14
+ - [Contained presets and plugins](#contained-presets-and-plugins)
15
+ - [License](#license)
16
+
17
+ ## Requisites
18
+
19
+ - Stylelint `^16.24.0`
20
+
21
+ ## Installation
22
+
23
+ ```sh
24
+ $ npm install --save-dev @cichol/stylelint-config
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```javascript
30
+ export default {
31
+ extends: '@cichol/stylelint-config'
32
+ }
33
+ ```
34
+
35
+ ## Contained presets and plugins
36
+
37
+ - Presets
38
+ - [stylelint-config-sass-guidelines][stylelint-config-sass-guidelines]
39
+ - Plugins
40
+ - [stylelint-order][stylelint-order]
41
+
42
+ ## License
43
+
44
+ [MIT Licensed](../../LICENSE).
45
+
46
+ [github actions badge]: https://img.shields.io/github/actions/workflow/status/morrighan/packages/default.yml?branch=develop&style=flat-square
47
+ [github actions]: https://github.com/morrighan/packages/actions
48
+ [coverage badge]: https://img.shields.io/codecov/c/github/morrighan/packages?style=flat-square
49
+ [coverage]: https://app.codecov.io/gh/morrighan/packages/tree/develop/packages%2Fstylelint-config
50
+ [license badge]: https://img.shields.io/github/license/morrighan/packages.svg?style=flat-square
51
+ [npm package version badge]: https://img.shields.io/npm/v/@cichol/stylelint-config.svg?style=flat-square
52
+ [npm package]: https://www.npmjs.com/package/@cichol/stylelint-config
53
+ [stylelint-config-sass-guidelines]: https://www.npmjs.com/package/stylelint-config-sass-guidelines
54
+ [stylelint-order]: https://www.npmjs.com/package/stylelint-order
@@ -0,0 +1,18 @@
1
+ // Local helpers.
2
+ import _ from './generator.js'
3
+
4
+ // Base fragments.
5
+ export const ITSELF = null
6
+ export const TOP_RIGHT_BOTTOM_LEFT = _([ 'top', 'right', 'bottom', 'left' ])
7
+
8
+ // Complex fragments.
9
+ export const RANGE_BOUNDABLE = _([ 'min', ITSELF, 'max' ])
10
+ export const AXIAL = _([ 'block', 'inline', 'x', 'y' ])
11
+ export const LOGICAL = _([ 'block', 'inline' ], [ ITSELF, 'start', 'end' ])
12
+ export const DIRECTIONAL = _([ LOGICAL, TOP_RIGHT_BOTTOM_LEFT ])
13
+
14
+ export const DIAGONAL = _([
15
+ _('top', [ 'left', 'right' ]),
16
+ _('bottom', [ 'right', 'left' ]),
17
+ _([ 'start', 'end' ], [ 'start', 'end' ]),
18
+ ])
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @param {(string | (string | (string | null)[] | null)[])[]} fragments
3
+ * @returns {string[]}
4
+ */
5
+ export default function _(...fragments) {
6
+ if (fragments.length === 1 && typeof fragments[0] === 'string') return fragments[0]
7
+
8
+ /** @type {(string | null)[][]} */
9
+ const initial = [ [] ]
10
+
11
+ return fragments
12
+ .map(fragment => (
13
+ Array.isArray(fragment) ? fragment.flat(Number.POSITIVE_INFINITY) : [ fragment ]
14
+ ))
15
+ .reduce((current, next) => {
16
+ /** @type {(string | null)[][]} */
17
+ const result = []
18
+
19
+ for (const existing of current) {
20
+ for (const item of next) {
21
+ result.push([ ...existing, item ])
22
+ }
23
+ }
24
+
25
+ return result
26
+ }, initial)
27
+ .map(combination => (
28
+ combination.filter(part => !!part).join('-')
29
+ ))
30
+ }
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import * as Stylelint from 'stylelint'
2
+
3
+ export const PROPERTIES_ORDER: readonly string[]
4
+
5
+ export default {} as Stylelint.Config
package/index.js ADDED
@@ -0,0 +1,18 @@
1
+ // Pre-sorted CSS properties list.
2
+ import PROPERTIES_LIST from './properties/index.js'
3
+
4
+ /** @type {import('stylelint').Config} */
5
+ export default {
6
+ extends: 'stylelint-config-sass-guidelines',
7
+ plugins: [ 'stylelint-order', 'stylelint-scss' ],
8
+
9
+ rules: {
10
+ '@stylistic/indentation': 'tab',
11
+ 'max-nesting-depth': 7,
12
+ 'order/properties-order': PROPERTIES_LIST,
13
+ 'order/properties-alphabetical-order': null,
14
+ 'selector-max-compound-selectors': 4,
15
+ 'selector-max-id': 1,
16
+ 'scss/at-function-pattern': /^[-_]?\w+(?:-\w+)*$/,
17
+ },
18
+ }
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@cichol/stylelint-config",
3
+ "version": "5.3.0",
4
+ "description": "An universal Stylelint configuration for personal projects.",
5
+ "homepage": "https://github.com/morrighan/packages",
6
+ "bugs": {
7
+ "url": "https://github.com/morrighan/packages/issues"
8
+ },
9
+ "license": "MIT",
10
+ "author": {
11
+ "name": "Yongbin Min",
12
+ "email": "contact@cichol.com",
13
+ "url": "https://www.cichol.com/"
14
+ },
15
+ "type": "module",
16
+ "main": "index.js",
17
+ "types": "index.d.ts",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/morrighan/packages.git",
21
+ "directory": "packages/stylelint-config"
22
+ },
23
+ "dependencies": {
24
+ "stylelint-config-sass-guidelines": "^12.1.0",
25
+ "stylelint-order": "^7.0.0"
26
+ },
27
+ "peerDependencies": {
28
+ "stylelint": "^16.24.0"
29
+ },
30
+ "engines": {
31
+ "node": "^20.19.5 || ^22.20.0",
32
+ "npm": "^11.6.1"
33
+ },
34
+ "publishConfig": {
35
+ "registry": "https://registry.npmjs.org/",
36
+ "access": "public"
37
+ }
38
+ }
@@ -0,0 +1,25 @@
1
+ // Local helpers.
2
+ import _ from '../helpers/generator.js'
3
+ import { ITSELF, DIRECTIONAL } from '../helpers/fragments.js'
4
+
5
+ export default _([
6
+ _('pointer-events'),
7
+ _('touch-action'),
8
+ _('will-change'),
9
+ _('cursor'),
10
+ _('caption-side'),
11
+ _('content'),
12
+ _('quotes'),
13
+ _('counter', [ 'set', 'increment', 'reset' ]),
14
+ _('resize'),
15
+ _('user-select'),
16
+ _('overflow-anchor'),
17
+ _('nav', [ 'index', 'up', 'right', 'down', 'left' ]),
18
+ _('scroll-behavior'),
19
+ _('scrollbar', [ 'color', 'width', 'gutter' ]),
20
+ _('scroll', [ 'margin', 'padding' ], [ ITSELF, DIRECTIONAL ]),
21
+ _('scroll-snap', [ 'type', 'align', 'stop' ]),
22
+ _('content-visibility'),
23
+ _('contain-intrinsic', [ 'size', 'width', 'height', 'inline-size', 'block-size' ]),
24
+ _('speak', [ ITSELF, 'as' ]),
25
+ ])
@@ -0,0 +1,17 @@
1
+ // Local helpers.
2
+ import _ from '../helpers/generator.js'
3
+ import { ITSELF, LOGICAL, TOP_RIGHT_BOTTOM_LEFT } from '../helpers/fragments.js'
4
+
5
+ export default _([
6
+ _('isolation'),
7
+ _('position'),
8
+ _('z-index'),
9
+ _('inset', [ ITSELF, LOGICAL ]),
10
+ _(TOP_RIGHT_BOTTOM_LEFT),
11
+ _('zoom'),
12
+ _('transform', [ 'origin', 'box', 'style', ITSELF ]),
13
+ _('translate'),
14
+ _('rotate'),
15
+ _('scale'),
16
+ _('offset', [ 'path', 'distance', 'rotate' ]),
17
+ ])
@@ -0,0 +1,40 @@
1
+ // Local helpers.
2
+ import _ from '../helpers/generator.js'
3
+ import { ITSELF, AXIAL } from '../helpers/fragments.js'
4
+
5
+ export default _([
6
+ _('container', [ ITSELF, 'name', 'type' ]),
7
+ _('size'),
8
+ _('direction'),
9
+ _('unicode-bidi'),
10
+ _([ 'clear', 'float' ]),
11
+ _('contain'),
12
+ _('overflow', [ ITSELF, AXIAL, 'clip-margin' ]),
13
+ _('overscroll-behavior', [ ITSELF, AXIAL ]),
14
+ _('display'),
15
+ _('table-layout'),
16
+ _('border', [ 'spacing', 'collapse' ]),
17
+ _('empty-cells'),
18
+ _('columns'),
19
+ _('column', [ 'count', 'width', 'fill', _('rule', [ 'width', 'style', 'color' ]), 'span' ]),
20
+ _([ 'widows', 'orphans' ]),
21
+
22
+ _('grid', [
23
+ ITSELF,
24
+ _('area'),
25
+ _('auto', [ 'rows', 'columns', 'flow' ]),
26
+ _('column', [ ITSELF, 'start', 'gap', 'end' ]),
27
+ _('gap'),
28
+ _('row', [ ITSELF, 'start', 'gap', 'end' ]),
29
+ _('template', [ ITSELF, 'areas', 'rows', 'columns' ]),
30
+ ]),
31
+
32
+ _('flex', [ ITSELF, 'flow', 'basis', 'direction', 'grow', 'shrink', 'wrap' ]),
33
+ _('box-orient'),
34
+ _('line-clamp'),
35
+ _([ ITSELF, 'row', 'column' ], 'gap'),
36
+ _([ 'place', 'align', 'justify' ], [ 'content', 'items', 'self' ]),
37
+ _('order'),
38
+ _('break', [ 'inside', 'before', 'after' ]),
39
+ _('shape', [ 'outside', 'image-threshold', 'margin' ]),
40
+ ])
@@ -0,0 +1,19 @@
1
+ // Local helpers.
2
+ import _ from '../helpers/generator.js'
3
+ import { ITSELF, RANGE_BOUNDABLE, DIRECTIONAL, DIAGONAL } from '../helpers/fragments.js'
4
+
5
+ export default _([
6
+ _('box-sizing'),
7
+ _('aspect-ratio'),
8
+ _(RANGE_BOUNDABLE, 'block-size'),
9
+ _(RANGE_BOUNDABLE, 'inline-size'),
10
+ _(RANGE_BOUNDABLE, 'width'),
11
+ _(RANGE_BOUNDABLE, 'height'),
12
+ _([ 'margin', 'padding' ], [ ITSELF, DIRECTIONAL ]),
13
+
14
+ _('border', [
15
+ _([ ITSELF, DIRECTIONAL ], [ ITSELF, 'width', 'style', 'color' ]),
16
+ _([ ITSELF, DIAGONAL ], 'radius'),
17
+ _('image', [ ITSELF, 'source', 'slice', 'width', 'outset', 'repeat' ]),
18
+ ]),
19
+ ])
@@ -0,0 +1,64 @@
1
+ // Local helpers.
2
+ import _ from '../helpers/generator.js'
3
+ import { ITSELF } from '../helpers/fragments.js'
4
+
5
+ export default _([
6
+ _('writing-mode'),
7
+
8
+ _('font', [
9
+ ITSELF,
10
+ _('display'),
11
+ _('style'),
12
+ _('variant', [ ITSELF, 'ligatures', 'caps', 'alternates', 'numeric', 'east-asian', 'position' ]),
13
+ _('weight'),
14
+ _('size'),
15
+ _('family'),
16
+ _([ 'feature', 'variation' ], 'settings'),
17
+ _('optical-sizing'),
18
+ _('kerning'),
19
+ _('size-adjust'),
20
+ _('stretch'),
21
+ _('effect'),
22
+ _('emphasize', [ ITSELF, 'position', 'style' ]),
23
+ _('smooth'),
24
+ ]),
25
+
26
+ _([ ITSELF, '-webkit', '-moz-osx' ], 'font-smoothing'),
27
+ _('ruby-position'),
28
+ _('line-height'),
29
+ _('hyphens'),
30
+ _('color'),
31
+
32
+ _('text', [
33
+ _('align', [ ITSELF, 'last' ]),
34
+ _('emphasis', [ ITSELF, 'color', 'style', 'position' ]),
35
+ _('decoration', [ ITSELF, 'color', 'line', 'style', 'thickness', 'skip-ink' ]),
36
+ _('underline', [ 'position', 'offset' ]),
37
+ _('indent'),
38
+ _('justify'),
39
+ _('outline'),
40
+ _('overflow', [ ITSELF, 'ellipsis', 'mode' ]),
41
+ _('shadow'),
42
+ _('transform'),
43
+ _('wrap'),
44
+ _('size-adjust'),
45
+ _('combine-upright'),
46
+ _('orientation'),
47
+ _('rendering'),
48
+ ]),
49
+
50
+ _('-webkit-text', [ 'fill', 'stroke' ], 'color'),
51
+ _('letter-spacing'),
52
+ _('word', [ 'break', 'spacing', 'wrap' ]),
53
+ _('line-break'),
54
+ _('overflow-wrap'),
55
+ _('tab-size'),
56
+ _('white-space'),
57
+ _('vertical-align'),
58
+ _('paint-order'),
59
+ _('hanging-punctuation'),
60
+ _('list-style', [ ITSELF, 'position', 'type', 'image' ]),
61
+ _('src'),
62
+ _('unicode-range'),
63
+ _([ 'ascent', 'descent', 'line-gap' ], 'override'),
64
+ ])
@@ -0,0 +1,37 @@
1
+ // Local helpers.
2
+ import _ from '../helpers/generator.js'
3
+ import { ITSELF, AXIAL } from '../helpers/fragments.js'
4
+
5
+ export default _([
6
+ _('appearance'),
7
+ _('visibility'),
8
+ _('color-scheme'),
9
+ _('forced-color-adjust'),
10
+ _('accent-color'),
11
+ _('perspective', [ 'origin', ITSELF ]),
12
+ _('backface-visibility'),
13
+ _('opacity'),
14
+ _('object', [ 'fit', 'position' ]),
15
+ _('image-orientation'),
16
+
17
+ _('background', [
18
+ ITSELF,
19
+ _('color'),
20
+ _('image'),
21
+ _('repeat', [ ITSELF, AXIAL ]),
22
+ _('attachment'),
23
+ _('position', [ ITSELF, AXIAL ]),
24
+ _('clip'),
25
+ _('origin'),
26
+ _('size'),
27
+ _('blend-mode'),
28
+ ]),
29
+
30
+ _('clip', [ ITSELF, 'path' ]),
31
+ _([ ITSELF, 'backdrop' ], 'filter'),
32
+ _([ '-webkit', ITSELF ], 'box-decoration-break'),
33
+ _('outline', [ ITSELF, 'width', 'style', 'color', 'offset' ]),
34
+ _('box-shadow'),
35
+ _('mix-blend-mode'),
36
+ _('caret-color'),
37
+ ])
@@ -0,0 +1,22 @@
1
+ // Local helpers.
2
+ import _ from '../helpers/generator.js'
3
+ import { ITSELF } from '../helpers/fragments.js'
4
+
5
+ export default _([
6
+ _('alignment-baseline'),
7
+ _('baseline-shift'),
8
+ _('dominant-baseline'),
9
+ _('text-anchor'),
10
+ _([ 'cx', 'cy', 'd', 'r', 'rx', 'ry' ]),
11
+ _('fill', [ ITSELF, 'opacity', 'rule' ]),
12
+ _([ 'flood', 'stop' ], [ 'color', 'opacity' ]),
13
+ _('stroke', [ ITSELF, 'dasharray', 'dashoffset', 'linecap', 'linejoin', 'miterlimit', 'opacity', 'width' ]),
14
+ _('vector-effect'),
15
+ _('color', [ _('interpolation', [ ITSELF, 'filters' ]), 'profile', 'rendering' ]),
16
+ _('image-rendering'),
17
+ _('lighting-color'),
18
+ _('marker', [ 'start', 'mid', 'end' ]),
19
+ _('mask', [ ITSELF, 'type' ]),
20
+ _('shape-rendering'),
21
+ _('clip-rule'),
22
+ ])
@@ -0,0 +1,12 @@
1
+ // Local helpers.
2
+ import _ from '../helpers/generator.js'
3
+ import { ITSELF } from '../helpers/fragments.js'
4
+
5
+ export default _([
6
+ _('transition', [ ITSELF, 'delay', 'timing-function', 'duration', 'property' ]),
7
+ _('animation', [ ITSELF, 'name', 'duration', 'play-state', 'timing-function', 'fill-mode', 'delay', 'iteration-count', 'direction', 'timeline' ]),
8
+ _('timeline-scope'),
9
+ _('scroll-timeline', [ ITSELF, 'name', 'axis' ]),
10
+ _('view-timeline', [ ITSELF, 'name', 'axis', 'inset' ]),
11
+ _('view-transition-name'),
12
+ ])
@@ -0,0 +1,18 @@
1
+ export default await Promise.all([
2
+ 'composes',
3
+ 'all',
4
+ import('./01-interaction.js'),
5
+ import('./02-positioning.js'),
6
+ import('./03-layout.js'),
7
+ import('./04-box-model.js'),
8
+ import('./05-typography.js'),
9
+ import('./06-appearance.js'),
10
+ import('./07-svg-relevant.js'),
11
+ import('./08-transition.js'),
12
+ ].map(fragments => (
13
+ typeof fragments === 'string'
14
+ ? Promise.resolve(fragments)
15
+ : fragments.then(({ default: properties }) => properties)
16
+ ))).then(properties => (
17
+ properties.flat()
18
+ ))