@dnncommunity/dnn-elements 0.27.8-beta.1 → 0.27.8-beta.2
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.
|
@@ -11,7 +11,7 @@ export const rule = createRule({
|
|
|
11
11
|
type: "problem",
|
|
12
12
|
fixable: "code",
|
|
13
13
|
messages: {
|
|
14
|
-
dnnModalNoBackgroundDismiss: "Background dismiss is obsolete in dnn-modal, use
|
|
14
|
+
dnnModalNoBackgroundDismiss: "Background dismiss is obsolete in dnn-modal, use preventBackdropDismiss instead."
|
|
15
15
|
},
|
|
16
16
|
schema: [],
|
|
17
17
|
},
|
|
@@ -20,14 +20,14 @@ export const rule = createRule({
|
|
|
20
20
|
JSXElement(node) {
|
|
21
21
|
if (node.openingElement.name.type === "JSXIdentifier" &&
|
|
22
22
|
node.openingElement.name.name === "dnn-modal") {
|
|
23
|
-
const
|
|
24
|
-
attr.name.name === "
|
|
25
|
-
if ((
|
|
23
|
+
const backdropDismissAttr = node.openingElement.attributes.find(attr => attr.type === "JSXAttribute" &&
|
|
24
|
+
attr.name.name === "backdropDismiss");
|
|
25
|
+
if ((backdropDismissAttr === null || backdropDismissAttr === void 0 ? void 0 : backdropDismissAttr.type) === "JSXAttribute") {
|
|
26
26
|
context.report({
|
|
27
|
-
node:
|
|
27
|
+
node: backdropDismissAttr,
|
|
28
28
|
messageId: "dnnModalNoBackgroundDismiss",
|
|
29
29
|
fix(fixer) {
|
|
30
|
-
const attrValue =
|
|
30
|
+
const attrValue = backdropDismissAttr.value;
|
|
31
31
|
const isImplicitTrue = !attrValue;
|
|
32
32
|
const isExplicitTrue = attrValue &&
|
|
33
33
|
attrValue.type === "JSXExpressionContainer" &&
|
|
@@ -39,14 +39,14 @@ export const rule = createRule({
|
|
|
39
39
|
attrValue.expression.value === false;
|
|
40
40
|
if (isImplicitTrue || isExplicitTrue) {
|
|
41
41
|
// Remove attribute entirely
|
|
42
|
-
return fixer.remove(
|
|
42
|
+
return fixer.remove(backdropDismissAttr);
|
|
43
43
|
}
|
|
44
44
|
if (isExplicitFalse) {
|
|
45
45
|
// Replace with opposite meaning
|
|
46
|
-
return fixer.replaceText(
|
|
46
|
+
return fixer.replaceText(backdropDismissAttr, "preventBackdropDismiss");
|
|
47
47
|
}
|
|
48
48
|
// Default behavior: just remove it
|
|
49
|
-
return fixer.remove(
|
|
49
|
+
return fixer.remove(backdropDismissAttr);
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dnn-modal-no-background-dismiss.js","sourceRoot":"","sources":["../../src/rules/dnn-modal-no-background-dismiss.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;IAC3B,IAAI,EAAE,iCAAiC;IACvC,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACF,IAAI,EAAE;YACF,WAAW,EAAE,6CAA6C;YAC1D,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,mEAAmE;SAC3E;QACD,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE;YACN,2BAA2B,EAAE,
|
|
1
|
+
{"version":3,"file":"dnn-modal-no-background-dismiss.js","sourceRoot":"","sources":["../../src/rules/dnn-modal-no-background-dismiss.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;IAC3B,IAAI,EAAE,iCAAiC;IACvC,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACF,IAAI,EAAE;YACF,WAAW,EAAE,6CAA6C;YAC1D,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,mEAAmE;SAC3E;QACD,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE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CAC7C,CAAC;gCAED,IAAI,eAAe,EAAE,CAAC;oCAClB,gCAAgC;oCAChC,OAAO,KAAK,CAAC,WAAW,CACpB,mBAAmB,EACnB,wBAAwB,CAC3B,CAAC;gCACN,CAAC;gCAED,mCAAmC;gCACnC,OAAO,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;4BAC7C,CAAC;yBACJ,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import { createRule } from \"../utils.js\";\r\n\r\nexport const rule = createRule({\r\n name: \"dnn-modal-no-background-dismiss\",\r\n defaultOptions: [],\r\n meta: {\r\n docs: {\r\n description: \"Background dismiss is obsolete in dnn-modal\",\r\n recommended: true,\r\n url: \"https://github.com/DNNCommunity/dnn-elements/releases/tag/v0.24.0\",\r\n },\r\n type: \"problem\",\r\n fixable: \"code\",\r\n messages: {\r\n dnnModalNoBackgroundDismiss: \"Background dismiss is obsolete in dnn-modal, use preventBackdropDismiss instead.\"\r\n },\r\n schema: [],\r\n },\r\n create(context) {\r\n return {\r\n JSXElement(node) {\r\n if (\r\n node.openingElement.name.type === \"JSXIdentifier\" &&\r\n node.openingElement.name.name === \"dnn-modal\"\r\n ) {\r\n const backdropDismissAttr = node.openingElement.attributes.find(attr =>\r\n attr.type === \"JSXAttribute\" &&\r\n attr.name.name === \"backdropDismiss\"\r\n );\r\n\r\n if (backdropDismissAttr?.type === \"JSXAttribute\") {\r\n context.report({\r\n node: backdropDismissAttr,\r\n messageId: \"dnnModalNoBackgroundDismiss\",\r\n fix(fixer) {\r\n const attrValue = backdropDismissAttr.value;\r\n const isImplicitTrue = !attrValue;\r\n const isExplicitTrue = attrValue &&\r\n attrValue.type === \"JSXExpressionContainer\" &&\r\n attrValue.expression.type === \"Literal\" &&\r\n attrValue.expression.value === true;\r\n\r\n const isExplicitFalse = attrValue &&\r\n attrValue.type === \"JSXExpressionContainer\" &&\r\n attrValue.expression.type === \"Literal\" &&\r\n attrValue.expression.value === false;\r\n\r\n if (isImplicitTrue || isExplicitTrue) {\r\n // Remove attribute entirely\r\n return fixer.remove(backdropDismissAttr);\r\n }\r\n\r\n if (isExplicitFalse) {\r\n // Replace with opposite meaning\r\n return fixer.replaceText(\r\n backdropDismissAttr,\r\n \"preventBackdropDismiss\"\r\n );\r\n }\r\n\r\n // Default behavior: just remove it\r\n return fixer.remove(backdropDismissAttr);\r\n },\r\n });\r\n }\r\n }\r\n }\r\n };\r\n },\r\n});\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnncommunity/dnn-elements",
|
|
3
|
-
"version": "0.27.8-beta.
|
|
3
|
+
"version": "0.27.8-beta.2",
|
|
4
4
|
"description": "Dnn themed custom elements.",
|
|
5
5
|
"repository": "https://github.com/dnncommunity/dnn-elements",
|
|
6
6
|
"homepage": "https://dnncommunity.github.io/dnn-elements",
|