@dialpad/eslint-plugin-dialtone 1.7.2 → 1.8.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.
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @fileoverview Detects usage of d-flg* deprecated utility classes which will be removed in the future.
3
+ * @author Tico Ortega
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ module.exports = {
12
+ meta: {
13
+ type: 'suggestion', // `problem`, `suggestion`, or `layout`
14
+ docs: {
15
+ description: "Usage of d-flg* utility classes are deprecated and will be removed in the future.",
16
+ recommended: false,
17
+ url: 'https://github.com/dialpad/dialtone/blob/staging/packages/eslint-plugin-dialtone/docs/rules/deprecated-flex-gap-classes.md', // URL to the documentation page for this rule
18
+ },
19
+ fixable: null, // Or `code` or `whitespace`
20
+ schema: [], // Add a schema if the rule has options
21
+ messages: {
22
+ recommendFlexGapStyle: `Usage of d-flg* utility classes are deprecated and will be removed in the future.
23
+ Checkout the available replacements here: https://dialtone.dialpad.com/utilities/flex/gap.html`,
24
+ }, // Add messageId and message
25
+ },
26
+
27
+ create(context) {
28
+ const sourceCode = context.sourceCode ?? context.getSourceCode();
29
+ return sourceCode.parserServices.defineTemplateBodyVisitor({
30
+ // Visitor functions for Vue templates
31
+ VAttribute(node) {
32
+ if (node.key.name === 'class') {
33
+ const classes = node.value.value;
34
+ if (classes.match(/d-flg\d{1,2}/)) {
35
+ context.report({
36
+ node: node,
37
+ messageId: 'recommendFlexGapStyle',
38
+ });
39
+ }
40
+ }
41
+ }
42
+ });
43
+ }
44
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @fileoverview Detects usage of d-gg*, d-grg*, d-gcg* deprecated utility classes which will be removed in the future.
3
+ * @author Tico Ortega
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ module.exports = {
12
+ meta: {
13
+ type: 'suggestion', // `problem`, `suggestion`, or `layout`
14
+ docs: {
15
+ description: "Usage of d-gg*, d-grg*, d-gcg* utility classes are deprecated and will be removed in the future.",
16
+ recommended: false,
17
+ url: 'https://github.com/dialpad/dialtone/blob/staging/packages/eslint-plugin-dialtone/docs/rules/deprecated-grid-gap-classes.md', // URL to the documentation page for this rule
18
+ },
19
+ fixable: null, // Or `code` or `whitespace`
20
+ schema: [], // Add a schema if the rule has options
21
+ messages: {
22
+ recommendGridGapStyle: `Usage of d-gg*, d-grg*, d-gcg* utility classes are deprecated and will be removed in the future.
23
+ Checkout the available replacements here: https://dialtone.dialpad.com/utilities/grid/gap.html`,
24
+ }, // Add messageId and message
25
+ },
26
+
27
+ create(context) {
28
+ const sourceCode = context.sourceCode ?? context.getSourceCode();
29
+ return sourceCode.parserServices.defineTemplateBodyVisitor({
30
+ // Visitor functions for Vue templates
31
+ VAttribute(node) {
32
+ if (node.key.name === 'class') {
33
+ const classes = node.value.value.split(' ');
34
+ const gapClasses = ['d-gg', 'd-grg', 'd-gcg'];
35
+ const gapClassesFound = classes.filter((className) =>
36
+ gapClasses.some((gapClass) => className.startsWith(gapClass))
37
+ );
38
+ if (gapClassesFound.length > 0) {
39
+ context.report({
40
+ node: node,
41
+ messageId: 'recommendGridGapStyle',
42
+ });
43
+ }
44
+ }
45
+ }
46
+ });
47
+ }
48
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialpad/eslint-plugin-dialtone",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "description": "dialtone eslint plugin",
5
5
  "keywords": [
6
6
  "Dialpad",