@navikt/aksel-stylelint 3.0.0-beta.8 → 3.4.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 +51 -16
- package/package.json +8 -4
- package/dist/deprecations.js +0 -9
- package/dist/index.css +0 -4615
- package/dist/index.js +0 -8
- package/dist/internal-tokens.json +0 -48
- package/dist/recommended.js +0 -11
- package/dist/rules/aksel-design-token-exists/index.js +0 -70
- package/dist/rules/aksel-design-token-exists/index.test.js +0 -115
- package/dist/rules/aksel-design-token-exists/utils.js +0 -76
- package/dist/rules/aksel-design-token-no-component-reference/index.js +0 -49
- package/dist/rules/aksel-design-token-no-component-reference/index.test.js +0 -53
- package/dist/rules/aksel-design-token-no-global-override/index.js +0 -47
- package/dist/rules/aksel-design-token-no-global-override/index.test.js +0 -66
- package/dist/rules/aksel-no-class-override/index.js +0 -40
- package/dist/rules/aksel-no-class-override/index.test.js +0 -53
- package/dist/rules/aksel-no-class-override copy/index.js +0 -40
- package/dist/rules/aksel-no-class-override copy/index.test.js +0 -53
- package/dist/rules/aksel-no-deprecated-classes/index.js +0 -40
- package/dist/rules/aksel-no-deprecated-classes/index.test.js +0 -60
- package/dist/rules/aksel-no-internal-tokens/index.js +0 -54
- package/dist/rules/aksel-no-internal-tokens/index.test.js +0 -102
- package/dist/rules/index.js +0 -20
- package/dist/tokens.json +0 -379
- package/dist/utils.js +0 -115
package/README.md
CHANGED
|
@@ -29,24 +29,60 @@ It should be sufficient for most cases to extend the recommended defaults.
|
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## aksel
|
|
32
|
+
## aksel/design-token-exists
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
In addition it checks that you:
|
|
37
|
-
|
|
38
|
-
- don't **_reference_** a component level token. As they are only supposed to be overridden.
|
|
39
|
-
- don't **_override_** a global level token. As they are only supposed to be referenced.
|
|
34
|
+
Makes sure all referenced CSS-variables with prefix `--a-` or `--ac-` exists in Aksels token-collection. As a side-effect Aksel reserves these prefixes for its design-tokens.
|
|
40
35
|
|
|
41
36
|
❌ Incorrect:
|
|
42
37
|
|
|
43
38
|
```css
|
|
44
|
-
html
|
|
39
|
+
html {
|
|
45
40
|
--a-my-own-color-bg-hover: #f2f2f2;
|
|
46
41
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
47
|
-
background-color: var(--a-my-own-color-bg-hover
|
|
42
|
+
background-color: var(--a-my-own-color-bg-hover);
|
|
48
43
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
49
|
-
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
✅ Correct:
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
html {
|
|
51
|
+
background-color: var(--custom-tag-surface-default);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## aksel/design-token-no-global-override
|
|
56
|
+
|
|
57
|
+
Makes sure you don't override global level tokens with `--a-`-prefix. Global/Semantic tokens are supposed to be used as is, and not overridden. That is unless you are theming your solution to match a different sub-brands or brands. In those cases we encourage to make all the changes in a single 'config'-file, then disable the rule for that file only.
|
|
58
|
+
|
|
59
|
+
❌ Incorrect:
|
|
60
|
+
|
|
61
|
+
```css
|
|
62
|
+
div {
|
|
63
|
+
--a-surface-default: #f2f2f2;
|
|
64
|
+
^^^^^^^^^^^^^^^^^^^
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
✅ Correct:
|
|
69
|
+
|
|
70
|
+
```css
|
|
71
|
+
div {
|
|
72
|
+
background-color: var(--a-surface-default);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## aksel/design-token-no-component-reference
|
|
77
|
+
|
|
78
|
+
Makes sure you don't reference component level tokens with `--ac-`-prefix. Component level tokens are only supposed to be overridden, not referenced.
|
|
79
|
+
This is since they are by default not defined, leading to unknown side-effects when referenced incorrectly.
|
|
80
|
+
|
|
81
|
+
❌ Incorrect:
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
html {
|
|
85
|
+
stroke: var(--ac-button-loader-stroke);
|
|
50
86
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
51
87
|
}
|
|
52
88
|
```
|
|
@@ -54,15 +90,14 @@ html h1 {
|
|
|
54
90
|
✅ Correct:
|
|
55
91
|
|
|
56
92
|
```css
|
|
57
|
-
html
|
|
58
|
-
background-color: var(--a-surface-default, #ffffff);
|
|
93
|
+
html {
|
|
59
94
|
--ac-button-loader-stroke: lawngreen;
|
|
60
95
|
}
|
|
61
96
|
```
|
|
62
97
|
|
|
63
|
-
## aksel
|
|
98
|
+
## aksel/no-internal-tokens
|
|
64
99
|
|
|
65
|
-
Disallows use or override of internal Aksel design tokens. Internal tokens are not supposed to be used outside the design system, and
|
|
100
|
+
Disallows use or override of internal Aksel design tokens. Internal tokens are not supposed to be used outside the design system, and may be changed or removed without warning. Be aware that the rule simply checks the prefix of the token, and not if it actually exists in the design system. Even if it doesn't exist, using design system prefixes should be avoided.
|
|
66
101
|
|
|
67
102
|
❌ Incorrect:
|
|
68
103
|
|
|
@@ -92,7 +127,7 @@ a {
|
|
|
92
127
|
}
|
|
93
128
|
```
|
|
94
129
|
|
|
95
|
-
## aksel
|
|
130
|
+
## aksel/no-class-override
|
|
96
131
|
|
|
97
132
|
Warns when trying to override design system styling by using class selectors that starts with "navds-" or "navdsi-". Overriding styles in the design system is discouraged. We want to have consistent look and feel across applications. Even if it seems to work fine now, it might break on subsequent updates in the design system.
|
|
98
133
|
|
|
@@ -116,7 +151,7 @@ Warns when trying to override design system styling by using class selectors tha
|
|
|
116
151
|
}
|
|
117
152
|
```
|
|
118
153
|
|
|
119
|
-
## aksel
|
|
154
|
+
## aksel/no-deprecated-classes
|
|
120
155
|
|
|
121
156
|
Warns when you try to use deprecated class names.
|
|
122
157
|
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/aksel-stylelint",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"author": "Aksel | NAV",
|
|
5
|
-
"homepage": "https://aksel.nav.no/
|
|
5
|
+
"homepage": "https://aksel.nav.no/grunnleggende/kode/stylelint",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/navikt/aksel.git",
|
|
9
|
-
"directory": "@navikt/aksel-
|
|
9
|
+
"directory": "@navikt/aksel-stylelint"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
12
12
|
"aksel",
|
|
13
|
-
"stylelint"
|
|
13
|
+
"stylelint",
|
|
14
|
+
"config",
|
|
15
|
+
"linting"
|
|
14
16
|
],
|
|
15
17
|
"publishConfig": {
|
|
16
18
|
"access": "public"
|
|
@@ -34,6 +36,8 @@
|
|
|
34
36
|
"dev": "yarn watch:lint"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
39
|
+
"@navikt/ds-css": "^3.4.0",
|
|
40
|
+
"@navikt/ds-tokens": "^3.4.0",
|
|
37
41
|
"@types/jest": "^29.0.0",
|
|
38
42
|
"concurrently": "7.2.1",
|
|
39
43
|
"copyfiles": "2.4.1",
|
package/dist/deprecations.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deprecations = void 0;
|
|
4
|
-
exports.deprecations = [
|
|
5
|
-
{
|
|
6
|
-
classes: ["navdsi-deprecated-example", "navdsi-other-deprecated-example"],
|
|
7
|
-
message: "Removed in vX.X.X, see documentation [link] for more information",
|
|
8
|
-
},
|
|
9
|
-
];
|