@dialpad/eslint-plugin-dialtone 1.10.0 → 1.11.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
CHANGED
|
@@ -62,4 +62,12 @@ Then configure the rules you want to use under the rules section.
|
|
|
62
62
|
|
|
63
63
|
## Supported Rules
|
|
64
64
|
|
|
65
|
-
*
|
|
65
|
+
* [custom-implementation](docs/rules/custom-implementation.md)
|
|
66
|
+
* [deprecated-base-color-classes](docs/rules/deprecated-base-color-classes.md)
|
|
67
|
+
* [deprecated-component](docs/rules/deprecated-component.md)
|
|
68
|
+
* [deprecated-directive](docs/rules/deprecated-directive.md)
|
|
69
|
+
* [deprecated-flex-gap-classes](docs/rules/deprecated-flex-gap-classes.md)
|
|
70
|
+
* [deprecated-grid-gap-classes](docs/rules/deprecated-grid-gap-classes.md)
|
|
71
|
+
* [deprecated-icons](docs/rules/deprecated-icons.md)
|
|
72
|
+
* [deprecated-stack-alignment-classes](docs/rules/deprecated-stack-alignment-classes.md)
|
|
73
|
+
* [recommend-typography-style](docs/rules/recommend-typography-style.md)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Recommends using align/justify props instead of CSS utilities on Stack component
|
|
3
|
+
*/
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
//------------------------------------------------------------------------------
|
|
7
|
+
// Rule Definition
|
|
8
|
+
//------------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
meta: {
|
|
12
|
+
type: 'suggestion',
|
|
13
|
+
docs: {
|
|
14
|
+
description: "Recommend using align/justify props instead of CSS utilities on Stack component",
|
|
15
|
+
recommended: false,
|
|
16
|
+
url: 'https://github.com/dialpad/dialtone/blob/staging/packages/eslint-plugin-dialtone/docs/rules/deprecated-stack-alignment-classes.md',
|
|
17
|
+
},
|
|
18
|
+
fixable: null,
|
|
19
|
+
schema: [],
|
|
20
|
+
messages: {
|
|
21
|
+
useAlignProp: 'Use the `align` prop instead of `d-ai-*` utility classes on <dt-stack>. See: https://dialtone.dialpad.com/components/stack.html#align',
|
|
22
|
+
useJustifyProp: 'Use the `justify` prop instead of `d-jc-*` utility classes on <dt-stack>. See: https://dialtone.dialpad.com/components/stack.html#justify',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
create(context) {
|
|
27
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
28
|
+
return sourceCode.parserServices.defineTemplateBodyVisitor({
|
|
29
|
+
VElement(node) {
|
|
30
|
+
// Check if element is dt-stack or DtStack
|
|
31
|
+
const elementName = node.name || node.rawName;
|
|
32
|
+
if (elementName === 'dt-stack' || elementName === 'DtStack') {
|
|
33
|
+
// Find class attribute
|
|
34
|
+
const classAttr = node.startTag.attributes.find(
|
|
35
|
+
attr => attr.key && attr.key.name === 'class'
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (classAttr && classAttr.value && classAttr.value.value) {
|
|
39
|
+
const classes = classAttr.value.value;
|
|
40
|
+
|
|
41
|
+
// Check for d-ai-* classes (align-items utilities)
|
|
42
|
+
if (/d-ai-(normal|flex-start|center|flex-end|stretch|baseline)/.test(classes)) {
|
|
43
|
+
context.report({
|
|
44
|
+
node: classAttr,
|
|
45
|
+
messageId: 'useAlignProp',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Check for d-jc-* classes (justify-content utilities)
|
|
50
|
+
if (/d-jc-(flex-start|center|flex-end|space-around|space-between|space-evenly)/.test(classes)) {
|
|
51
|
+
context.report({
|
|
52
|
+
node: classAttr,
|
|
53
|
+
messageId: 'useJustifyProp',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dialpad/eslint-plugin-dialtone",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "dialtone eslint plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Dialpad",
|
|
@@ -20,11 +20,6 @@
|
|
|
20
20
|
"email": "francis.rupert@dialpad.com",
|
|
21
21
|
"url": "https://github.com/francisrupert"
|
|
22
22
|
},
|
|
23
|
-
{
|
|
24
|
-
"name": "Julio Ortega",
|
|
25
|
-
"email": "julio.ortega@dialpad.com",
|
|
26
|
-
"url": "https://github.com/juliodialpad"
|
|
27
|
-
},
|
|
28
23
|
{
|
|
29
24
|
"name": "Ignacio Ropolo",
|
|
30
25
|
"email": "ignacio.ropolo@dialpad.com",
|