@navikt/aksel-stylelint 8.11.0 → 8.12.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.
@@ -554,7 +554,7 @@
554
554
  }
555
555
 
556
556
  :root, :host {
557
- --ax-version: "8.11.0";
557
+ --ax-version: "8.12.0";
558
558
  --ax-space-0: 0rem;
559
559
  --ax-space-1: .0625rem;
560
560
  --ax-space-2: .125rem;
@@ -17,7 +17,7 @@ const ruleFunction = () => {
17
17
  }
18
18
  if (deprecation.deprecatePrefix &&
19
19
  !deprecation.classes.some((x) => className.value.startsWith(x))) {
20
- return;
20
+ continue;
21
21
  }
22
22
  stylelint.utils.report({
23
23
  message: messages.unexpected(className.value, deprecation.message),
@@ -38,6 +38,7 @@ const ruleFunction = () => {
38
38
  node,
39
39
  result: postcssResult,
40
40
  ruleName,
41
+ word: node.prop,
41
42
  });
42
43
  }
43
44
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/aksel-stylelint",
3
- "version": "8.11.0",
3
+ "version": "8.12.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=18.12.0"
@@ -30,7 +30,8 @@
30
30
  "./recommended": "./dist/recommended.js"
31
31
  },
32
32
  "files": [
33
- "/dist"
33
+ "/dist",
34
+ "!**/*.test.js"
34
35
  ],
35
36
  "scripts": {
36
37
  "test": "yarn build && node --import tsx --test ./dist/**/*.test.js",
@@ -42,8 +43,8 @@
42
43
  "dev": "yarn watch:lint"
43
44
  },
44
45
  "devDependencies": {
45
- "@navikt/ds-css": "^8.11.0",
46
- "@navikt/ds-tokens": "^8.11.0",
46
+ "@navikt/ds-css": "^8.12.0",
47
+ "@navikt/ds-tokens": "^8.12.0",
47
48
  "concurrently": "9.2.1",
48
49
  "postcss-selector-parser": "^7.1.0",
49
50
  "postcss-value-parser": "^4.2.0",
@@ -1,81 +0,0 @@
1
- import { testRule } from "stylelint-test-rule-node";
2
- import rule, { messages } from "./index.js";
3
- testRule({
4
- plugins: ["./dist/index.js"],
5
- ruleName: rule.ruleName,
6
- config: true,
7
- accept: [
8
- {
9
- code: ".foo { --ax-font-line-height-large: 1px; --ax-border-default: red; }",
10
- description: "existing '--ax-' tokens overridden",
11
- },
12
- {
13
- code: ".foo { --my-custom-color: var(--ax-warning-800); }",
14
- description: "existing '--ax-' token referenced",
15
- },
16
- ],
17
- reject: [
18
- {
19
- code: ".foo { --ax-does-not-exist: 1px }",
20
- description: "attempt to override nonexistent '--ax-' token",
21
- warnings: [
22
- {
23
- message: messages.propNotExist({ prop: "--ax-does-not-exist" }),
24
- line: 1,
25
- endLine: 1,
26
- column: 8,
27
- endColumn: 27,
28
- },
29
- ],
30
- },
31
- {
32
- code: ".foo { color: var(--ax-bar) }",
33
- description: "attempt to use nonexistent token",
34
- message: messages.valueNotExist({ prop: "color" }, "--ax-bar"),
35
- line: 1,
36
- endLine: 1,
37
- column: 19,
38
- endColumn: 27,
39
- },
40
- {
41
- code: ".foo { width: var(--ax-bar, --ax-baz) }",
42
- description: "attempt to use two nonexistent tokens in one var()",
43
- warnings: [
44
- {
45
- message: messages.valueNotExist({ prop: "width" }, "--ax-bar"),
46
- line: 1,
47
- endLine: 1,
48
- column: 19,
49
- endColumn: 27,
50
- },
51
- {
52
- message: messages.valueNotExist({ prop: "width" }, "--ax-baz"),
53
- line: 1,
54
- endLine: 1,
55
- column: 29,
56
- endColumn: 37,
57
- },
58
- ],
59
- },
60
- {
61
- code: ".foo { padding: var(--ax-bar) var(--ax-baz); }",
62
- description: "attempt to use two nonexistent tokens as separate vars",
63
- warnings: [
64
- {
65
- message: messages.valueNotExist({ prop: "padding" }, "--ax-bar"),
66
- line: 1,
67
- endLine: 1,
68
- column: 21,
69
- endColumn: 29,
70
- },
71
- {
72
- message: messages.valueNotExist({ prop: "padding" }, "--ax-baz"),
73
- line: 1,
74
- endLine: 1,
75
- column: 35,
76
- endColumn: 43,
77
- },
78
- ],
79
- },
80
- ],
81
- });
@@ -1,37 +0,0 @@
1
- import { testRule } from "stylelint-test-rule-node";
2
- import rule, { messages } from "./index.js";
3
- testRule({
4
- plugins: ["./dist/index.js"],
5
- ruleName: rule.ruleName,
6
- config: true,
7
- accept: [
8
- {
9
- code: ".foo { --my-custom-color: var(--ax-warning-800); }",
10
- description: "existing '--ax-' token referenced",
11
- },
12
- ],
13
- reject: [
14
- {
15
- code: ".foo { --ax-border-default: red }",
16
- description: "existing '--ax-' token overridden",
17
- message: messages.propOverrideGlobal({ prop: "--ax-border-default" }),
18
- line: 1,
19
- endLine: 1,
20
- column: 8,
21
- endColumn: 27,
22
- },
23
- {
24
- code: ".foo { --ax-does-not-exist: 1px }",
25
- description: "attempt to override nonexistent '--ax-' token",
26
- warnings: [
27
- {
28
- message: messages.propOverrideGlobal({ prop: "--ax-does-not-exist" }),
29
- line: 1,
30
- endLine: 1,
31
- column: 8,
32
- endColumn: 27,
33
- },
34
- ],
35
- },
36
- ],
37
- });
@@ -1,19 +0,0 @@
1
- import { testRule } from "stylelint-test-rule-node";
2
- import rule, { messages } from "./index.js";
3
- testRule({
4
- plugins: ["./dist/index.js"],
5
- ruleName: rule.ruleName,
6
- config: true,
7
- accept: [{ code: ".foo-aksel-bar {}", description: "allowed class name" }],
8
- reject: [
9
- {
10
- code: ".foo, \n .aksel-button \n .bar {}",
11
- description: "selector with disallowed class name .aksel-*",
12
- message: messages.unexpected("aksel-button"),
13
- line: 2,
14
- endLine: 2,
15
- column: 3,
16
- endColumn: 15,
17
- },
18
- ],
19
- });
@@ -1,43 +0,0 @@
1
- import { testRule } from "stylelint-test-rule-node";
2
- import { deprecations } from "../../deprecations.js";
3
- import rule, { messages } from "./index.js";
4
- testRule({
5
- plugins: ["./dist/index.js"],
6
- ruleName: rule.ruleName,
7
- config: true,
8
- accept: [
9
- {
10
- code: ".aksel-deprecated-example-foo, .aksel-foo, .baz {}",
11
- description: "allowed class names",
12
- },
13
- ],
14
- reject: [
15
- {
16
- code: ".foo, \n .aksel-deprecated-example \n .bar {}",
17
- description: "selector with deprecated class name 1",
18
- message: messages.unexpected("aksel-deprecated-example", deprecations[0].message),
19
- line: 2,
20
- endLine: 2,
21
- column: 3,
22
- endColumn: 27,
23
- },
24
- {
25
- code: ".foo .aksel-other-deprecated-example \n .bar {}",
26
- description: "selector with deprecated class name 2",
27
- message: messages.unexpected("aksel-other-deprecated-example", deprecations[0].message),
28
- line: 1,
29
- endLine: 1,
30
- column: 7,
31
- endColumn: 37,
32
- },
33
- {
34
- code: ".foo, \n .aksel-deprecated-prefix-example-foo:hover \n .bar {}",
35
- description: "selector with deprecated class name prefix",
36
- message: messages.unexpected("aksel-deprecated-prefix-example-foo", deprecations[1].message),
37
- line: 2,
38
- endLine: 2,
39
- column: 3,
40
- endColumn: 38,
41
- },
42
- ],
43
- });
@@ -1,77 +0,0 @@
1
- import { testRule } from "stylelint-test-rule-node";
2
- import rule, { messages } from "./index.js";
3
- testRule({
4
- plugins: ["./dist/index.js"],
5
- ruleName: rule.ruleName,
6
- config: true,
7
- accept: [
8
- {
9
- code: ".foo { --bar--__axc-baz: 1px }",
10
- description: "non-internal token defined",
11
- },
12
- {
13
- code: ".foo { font-size: var(--bar--__axc-baz) }",
14
- description: "non-internal token used",
15
- },
16
- ],
17
- reject: [
18
- {
19
- code: ".foo { --__axc-bar: 1px; }",
20
- description: "internal token overridden",
21
- message: messages.tokenOverridden("--__axc-bar"),
22
- line: 1,
23
- endLine: 1,
24
- column: 8,
25
- endColumn: 25,
26
- },
27
- {
28
- code: ".foo { color: var(--__axc-bar) }",
29
- description: "one internal token used",
30
- message: messages.tokenUsed("--__axc-bar", "color"),
31
- line: 1,
32
- endLine: 1,
33
- column: 19,
34
- endColumn: 30,
35
- },
36
- {
37
- code: ".foo { width: var(--__axc-bar, --__axc-baz) }",
38
- description: "two internal tokens used in one var()",
39
- warnings: [
40
- {
41
- message: messages.tokenUsed("--__axc-bar", "width"),
42
- line: 1,
43
- endLine: 1,
44
- column: 19,
45
- endColumn: 30,
46
- },
47
- {
48
- message: messages.tokenUsed("--__axc-baz", "width"),
49
- line: 1,
50
- endLine: 1,
51
- column: 32,
52
- endColumn: 43,
53
- },
54
- ],
55
- },
56
- {
57
- code: ".foo { padding: var(--__axc-bar) var(--__axc-baz); }",
58
- description: "two internal tokens used as separate vars",
59
- warnings: [
60
- {
61
- message: messages.tokenUsed("--__axc-bar", "padding"),
62
- line: 1,
63
- endLine: 1,
64
- column: 21,
65
- endColumn: 32,
66
- },
67
- {
68
- message: messages.tokenUsed("--__axc-baz", "padding"),
69
- line: 1,
70
- endLine: 1,
71
- column: 38,
72
- endColumn: 49,
73
- },
74
- ],
75
- },
76
- ],
77
- });
@@ -1,19 +0,0 @@
1
- import { testRule } from "stylelint-test-rule-node";
2
- import rule, { messages } from "./index.js";
3
- testRule({
4
- plugins: ["./dist/index.js"],
5
- ruleName: rule.ruleName,
6
- config: true,
7
- accept: [{ code: ".foo-navds-bar {}", description: "allowed class name" }],
8
- reject: [
9
- {
10
- code: ".foo, \n .navds-button \n .bar {}",
11
- description: "selector with disallowed class name .navds-*",
12
- message: messages.unexpected("navds-button"),
13
- line: 2,
14
- endLine: 2,
15
- column: 3,
16
- endColumn: 15,
17
- },
18
- ],
19
- });