@dialpad/stylelint-plugin-dialtone 1.3.0 → 1.3.1-next.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/lib/index.js CHANGED
@@ -1,7 +1,15 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- const noMixins = require("./rules/no-mixins");
4
- const recommendFontStyleTokens = require("./rules/recommend-font-style-tokens");
5
- const useDialtoneTokens = require("./rules/use-dialtone-tokens");
3
+ const noBaseColorTokens = require('./rules/no-base-color-tokens');
4
+ const noDeprecatedSpaceTokens = require('./rules/no-deprecated-space-tokens');
5
+ const noMixins = require('./rules/no-mixins');
6
+ const recommendFontStyleTokens = require('./rules/recommend-font-style-tokens');
7
+ const useDialtoneTokens = require('./rules/use-dialtone-tokens');
6
8
 
7
- module.exports = [noMixins, recommendFontStyleTokens, useDialtoneTokens];
9
+ module.exports = [
10
+ noBaseColorTokens,
11
+ noDeprecatedSpaceTokens,
12
+ noMixins,
13
+ recommendFontStyleTokens,
14
+ useDialtoneTokens,
15
+ ];
@@ -0,0 +1,52 @@
1
+ const stylelint = require('stylelint');
2
+
3
+ const {
4
+ createPlugin,
5
+ utils: { report, ruleMessages, validateOptions },
6
+ } = stylelint;
7
+
8
+ const ruleName = '@dialpad/stylelint-plugin-dialtone/no-deprecated-space-tokens';
9
+
10
+ const messages = ruleMessages(ruleName, {
11
+ deprecated: (spaceToken, sizeToken) =>
12
+ `"${spaceToken}" is deprecated. Use "${sizeToken}" instead. Run "npx dialtone-migration-helper" to migrate automatically.`,
13
+ });
14
+
15
+ const meta = {
16
+ url: 'https://github.com/dialpad/dialtone/blob/staging/packages/stylelint-plugin-dialtone/docs/rules/no-deprecated-space-tokens.md',
17
+ };
18
+
19
+ /** @type {import('stylelint').Rule} */
20
+ const ruleFunction = (primary) => {
21
+ return (root, result) => {
22
+ const validOptions = validateOptions(result, ruleName, {
23
+ actual: primary,
24
+ });
25
+
26
+ if (!validOptions) return;
27
+
28
+ root.walkDecls((declaration) => {
29
+ // Match var(--dt-space-*) pattern
30
+ const spaceTokenMatch = declaration.value.match(/var\(--dt-space-[^)]+\)/g);
31
+ if (!spaceTokenMatch) return;
32
+
33
+ spaceTokenMatch.forEach((match) => {
34
+ const spaceToken = match.replace('var(', '').replace(')', '');
35
+ const sizeToken = spaceToken.replace('--dt-space-', '--dt-size-');
36
+
37
+ report({
38
+ result,
39
+ ruleName,
40
+ node: declaration,
41
+ message: messages.deprecated(spaceToken, sizeToken),
42
+ });
43
+ });
44
+ });
45
+ };
46
+ };
47
+
48
+ ruleFunction.ruleName = ruleName;
49
+ ruleFunction.messages = messages;
50
+ ruleFunction.meta = meta;
51
+
52
+ module.exports = createPlugin(ruleName, ruleFunction);
@@ -1,4 +1,4 @@
1
- const stylelint = require("stylelint");
1
+ const stylelint = require('stylelint');
2
2
 
3
3
  const {
4
4
  createPlugin,
@@ -12,7 +12,7 @@ const messages = ruleMessages(ruleName, {
12
12
  });
13
13
 
14
14
  const meta = {
15
- url: "https://github.com/dialpad/dialtone/blob/staging/packages/stylelint-plugin-dialtone/docs/rules/no-mixins.md",
15
+ url: 'https://github.com/dialpad/dialtone/blob/staging/packages/stylelint-plugin-dialtone/docs/rules/no-mixins.md',
16
16
  };
17
17
 
18
18
  /** @type {import('stylelint').Rule} */
@@ -1,4 +1,4 @@
1
- const stylelint = require("stylelint");
1
+ const stylelint = require('stylelint');
2
2
 
3
3
  const {
4
4
  createPlugin,
@@ -16,7 +16,7 @@ const messages = ruleMessages(ruleName, {
16
16
  });
17
17
 
18
18
  const meta = {
19
- url: "https://github.com/dialpad/dialtone/blob/staging/packages/stylelint-plugin-dialtone/docs/rules/recommend-font-style-tokens.md",
19
+ url: 'https://github.com/dialpad/dialtone/blob/staging/packages/stylelint-plugin-dialtone/docs/rules/recommend-font-style-tokens.md',
20
20
  };
21
21
 
22
22
  /** @type {import('stylelint').Rule} */
@@ -1,4 +1,4 @@
1
- const stylelint = require("stylelint");
1
+ const stylelint = require('stylelint');
2
2
 
3
3
  const {
4
4
  createPlugin,
@@ -20,7 +20,7 @@ const pxToRem = (value) => {
20
20
  }
21
21
 
22
22
  const meta = {
23
- url: "https://github.com/dialpad/dialtone/blob/staging/packages/stylelint-plugin-dialtone/docs/rules/use-dialtone-tokens.md",
23
+ url: 'https://github.com/dialpad/dialtone/blob/staging/packages/stylelint-plugin-dialtone/docs/rules/use-dialtone-tokens.md',
24
24
  };
25
25
 
26
26
  /** @type {import('stylelint').Rule} */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialpad/stylelint-plugin-dialtone",
3
- "version": "1.3.0",
3
+ "version": "1.3.1-next.1",
4
4
  "description": "dialtone stylelint plugin",
5
5
  "keywords": [
6
6
  "Dialpad",
@@ -18,11 +18,6 @@
18
18
  "email": "francis.rupert@dialpad.com",
19
19
  "url": "https://github.com/francisrupert"
20
20
  },
21
- {
22
- "name": "Julio Ortega",
23
- "email": "julio.ortega@dialpad.com",
24
- "url": "https://github.com/juliodialpad"
25
- },
26
21
  {
27
22
  "name": "Ignacio Ropolo",
28
23
  "email": "ignacio.ropolo@dialpad.com",
@@ -38,19 +33,26 @@
38
33
  "email": "dialtone@dialpad.com"
39
34
  },
40
35
  "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/dialpad/dialtone.git",
39
+ "directory": "packages/stylelint-plugin-dialtone"
40
+ },
41
41
  "main": "./lib/index.js",
42
42
  "files": [
43
43
  "lib"
44
44
  ],
45
45
  "exports": "./lib/index.js",
46
46
  "devDependencies": {
47
- "stylelint-test-rule-node": "^0.2.1"
47
+ "eslint-plugin-n": "^17.0.0",
48
+ "stylelint-test-rule-node": "^0.2.1",
49
+ "vue-eslint-parser": "^10.0.0"
48
50
  },
49
51
  "engines": {
50
52
  "node": ">= 18.0.0"
51
53
  },
52
54
  "peerDependencies": {
53
- "stylelint": "^14.0.0 || ^15.0.0"
55
+ "stylelint": "^14.0.0 || ^15.0.0 || ^16.0.0"
54
56
  },
55
57
  "nx": {
56
58
  "includedScripts": [