@taiga-ui/stylelint-config 0.1.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file. See
4
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 0.1.1 (2023-08-14)
7
+
8
+ ### Features
9
+
10
+ - add linters ([b35e525](https://github.com/taiga-family/taiga-ui/commit/b35e5252a2bac063696f0fd1b5accc1ac0d34a66))
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @taiga-ui/stylelint-config
2
+
3
+ Common Stylelint configuration for taiga-ui projects
4
+
5
+ ## Usage
6
+
7
+ 1. Install from npm
8
+
9
+ ```bash
10
+ npm i --save-dev @taiga-ui/stylelint-config
11
+ ```
12
+
13
+ 1. Create `stylelint.config.js` at project root
14
+
15
+ ```json
16
+ {
17
+ "extends": ["@taiga-ui/stylelint-config"]
18
+ }
19
+ ```
20
+
21
+ More information about available at
22
+ [stylelint documentation](https://github.com/stylelint/stylelint/blob/main/docs/user-guide/configure.md)
23
+
24
+ ### Available presets
25
+
26
+ - **prettier**
27
+
28
+ ```js
29
+ {
30
+ "extends": ["@taiga-ui/stylelint-config/prettier"]
31
+ }
32
+ ```
33
+
34
+ - **less** - includes prettier config
35
+
36
+ ```json
37
+ {
38
+ "extends": ["@taiga-ui/stylelint-config/less"]
39
+ }
40
+ ```
41
+
42
+ - **angular** - includes prettier config
43
+
44
+ ```json
45
+ {
46
+ "extends": ["@taiga-ui/stylelint-config/angular"]
47
+ }
48
+ ```
49
+
50
+ - **angular-less** - combine angular and less configs
51
+
52
+ ```json
53
+ {
54
+ "extends": ["@taiga-ui/stylelint-config/angular-less"]
55
+ }
56
+ ```
@@ -0,0 +1,11 @@
1
+ const angularConfig = require('./angular');
2
+ const lessConfig = require('./less');
3
+
4
+ module.exports = {
5
+ ...angularConfig,
6
+ customSyntax: lessConfig.customSyntax,
7
+ rules: {
8
+ ...angularConfig.rules,
9
+ ...lessConfig.rules,
10
+ },
11
+ };
package/angular.js ADDED
@@ -0,0 +1,82 @@
1
+ module.exports = {
2
+ extends: ['./stylelint.config.js', 'stylelint-config-prettier'],
3
+ plugins: ['stylelint-order', 'stylelint-no-px'],
4
+ rules: {
5
+ 'order/properties-order': [
6
+ [
7
+ 'all',
8
+ 'content',
9
+ 'position',
10
+ {
11
+ order: 'flexible',
12
+ properties: ['top', 'left', 'right', 'bottom'],
13
+ },
14
+ 'z-index',
15
+ 'display',
16
+ ],
17
+ {
18
+ unspecified: 'bottom',
19
+ },
20
+ ],
21
+ 'order/order': [
22
+ 'less-mixins',
23
+ 'custom-properties',
24
+ 'dollar-variables',
25
+ 'declarations',
26
+ 'rules',
27
+ 'at-rules',
28
+ ],
29
+ indentation: null,
30
+ 'color-named': null,
31
+ 'at-rule-no-unknown': null,
32
+ 'max-line-length': null,
33
+ 'number-leading-zero': null,
34
+ 'selector-class-pattern': null,
35
+ 'number-max-precision': null,
36
+ 'property-no-vendor-prefix': null,
37
+ 'keyframes-name-pattern': null,
38
+ 'value-keyword-case': null,
39
+ 'media-feature-name-no-vendor-prefix': null,
40
+ 'color-function-notation': 'legacy',
41
+ 'alpha-value-notation': 'number',
42
+ 'selector-max-specificity': [
43
+ '0,5,0',
44
+ {
45
+ ignoreSelectors: [':host-context', ':first-child'],
46
+ },
47
+ ],
48
+ 'selector-type-no-unknown': [
49
+ true,
50
+ {
51
+ ignore: ['custom-elements'],
52
+ ignoreTypes: ['/^/deep/'],
53
+ },
54
+ ],
55
+ 'selector-pseudo-element-no-unknown': [
56
+ true,
57
+ {
58
+ ignorePseudoElements: ['ng-deep'],
59
+ },
60
+ ],
61
+ 'meowtec/no-px': [
62
+ true,
63
+ {
64
+ ignore: [
65
+ // for cases with borders,
66
+ // box-shadows and other special cases
67
+ '-5px',
68
+ '-4px',
69
+ '-3px',
70
+ '-2px',
71
+ '-1px',
72
+ '0px',
73
+ '1px',
74
+ '2px',
75
+ '3px',
76
+ '4px',
77
+ '5px',
78
+ ],
79
+ },
80
+ ],
81
+ },
82
+ };
package/less.js ADDED
@@ -0,0 +1,64 @@
1
+ // cspell:disable
2
+ module.exports = {
3
+ customSyntax: 'postcss-less', // support less parser out-of-the-box
4
+ extends: ['./stylelint.config.js', 'stylelint-config-prettier'],
5
+ rules: {
6
+ 'function-no-unknown': [
7
+ true,
8
+ {
9
+ ignoreFunctions: [
10
+ // all less functions
11
+ 'if',
12
+ 'boolean',
13
+ 'escape',
14
+ 'e',
15
+ '%',
16
+ 'replace',
17
+ 'length',
18
+ 'extract',
19
+ 'range',
20
+ 'each',
21
+ 'ceil',
22
+ 'floor',
23
+ 'percentage',
24
+ 'round',
25
+ 'sqrt',
26
+ 'abs',
27
+ 'sin',
28
+ 'asin',
29
+ 'cos',
30
+ 'acos',
31
+ 'tan',
32
+ 'atan',
33
+ 'pi',
34
+ 'pow',
35
+ 'mod',
36
+ 'min',
37
+ 'max',
38
+ 'isnumber',
39
+ 'isstring',
40
+ 'iscolor',
41
+ 'iskeyword',
42
+ 'isurl',
43
+ 'ispixel',
44
+ 'isem',
45
+ 'ispercentage',
46
+ 'isunit',
47
+ 'isruleset',
48
+ 'isdefined',
49
+ 'color',
50
+ 'image-size',
51
+ 'image-width',
52
+ 'image-height',
53
+ 'convert',
54
+ 'data-uri',
55
+ 'default',
56
+ 'unit',
57
+ 'get-unit',
58
+ 'svg-gradient',
59
+ 'fade',
60
+ ],
61
+ },
62
+ ],
63
+ },
64
+ };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@taiga-ui/stylelint-config",
3
+ "version": "0.1.1",
4
+ "description": "Taiga UI stylelint config",
5
+ "keywords": [
6
+ "stylelint",
7
+ "prettier"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/taiga-family/taiga-ui.git"
12
+ },
13
+ "license": "Apache-2.0",
14
+ "main": "stylelint.config.js",
15
+ "dependencies": {
16
+ "postcss": "8.4.27",
17
+ "postcss-less": "6.0.0",
18
+ "stylelint-config-prettier": "9.0.3",
19
+ "stylelint-config-standard": "25.0.0",
20
+ "stylelint-no-px": "1.0.1",
21
+ "stylelint-order": "5.0.0"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ }
26
+ }
package/prettier.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: ['./stylelint.config.js', 'stylelint-config-prettier'],
3
+ };
package/project.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "stylelint-config",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "projects/stylelint-config",
5
+ "projectType": "library",
6
+ "prefix": "tui",
7
+ "targets": {
8
+ "publish": {
9
+ "executor": "nx:run-commands",
10
+ "options": {
11
+ "command": "npm publish ./projects/stylelint-config --access=public --ignore-scripts || echo \"already published\""
12
+ }
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,94 @@
1
+ module.exports = {
2
+ extends: 'stylelint-config-standard',
3
+ plugins: ['stylelint-order'],
4
+ rules: {
5
+ 'at-rule-name-space-after': 'always',
6
+ 'block-opening-brace-newline-after': 'always',
7
+ 'color-named': 'never',
8
+ 'declaration-block-no-redundant-longhand-properties': null,
9
+ 'declaration-empty-line-before': 'never',
10
+ indentation: [
11
+ 4,
12
+ {
13
+ indentInsideParens: 'once-at-root-twice-in-block',
14
+ severity: 'error',
15
+ },
16
+ ],
17
+ 'max-empty-lines': 2,
18
+ 'max-line-length': [
19
+ 80,
20
+ {
21
+ ignore: ['non-comments'],
22
+ },
23
+ ],
24
+ 'no-descending-specificity': null,
25
+ 'no-duplicate-selectors': true,
26
+ 'number-leading-zero': 'never',
27
+ 'rule-empty-line-before': [
28
+ 'always',
29
+ {
30
+ except: ['first-nested'],
31
+ ignore: ['after-comment'],
32
+ },
33
+ ],
34
+ 'selector-attribute-quotes': 'always',
35
+ 'selector-max-specificity': '0,5,0',
36
+ 'selector-pseudo-element-colon-notation': 'single',
37
+ 'selector-type-no-unknown': [
38
+ true,
39
+ {
40
+ ignoreTypes: ['/^/deep/'],
41
+ },
42
+ ],
43
+ 'string-quotes': 'single',
44
+ 'value-keyword-case': 'lower',
45
+ 'value-no-vendor-prefix': true,
46
+ 'order/order': [
47
+ 'at-variables',
48
+ 'less-mixins',
49
+ 'declarations',
50
+ {
51
+ type: 'rule',
52
+ selector: '^&\\s\\+\\s\\S',
53
+ },
54
+ {
55
+ type: 'rule',
56
+ selector: '^&:\\w',
57
+ },
58
+ {
59
+ type: 'rule',
60
+ selector: '^&\\[\\w+\\]',
61
+ },
62
+ {
63
+ type: 'rule',
64
+ selector: '^&_[^\\W_]',
65
+ },
66
+ {
67
+ type: 'rule',
68
+ selector: '^&__\\w',
69
+ },
70
+ 'rules',
71
+ {
72
+ type: 'at-rule',
73
+ name: 'media',
74
+ hasBlock: true,
75
+ },
76
+ ],
77
+ 'order/properties-order': [
78
+ [
79
+ 'all',
80
+ 'content',
81
+ 'position',
82
+ {
83
+ order: 'flexible',
84
+ properties: ['top', 'left', 'right', 'bottom'],
85
+ },
86
+ 'z-index',
87
+ 'display',
88
+ ],
89
+ {
90
+ unspecified: 'bottom',
91
+ },
92
+ ],
93
+ },
94
+ };