diff --git a/packages/stencil-library/eslint-plugin/docs/dnn-modal-no-background-dismiss.md b/packages/stencil-library/eslint-plugin/docs/dnn-modal-no-background-dismiss.md index 51f0411dc..d61ac3d0e 100644 --- a/packages/stencil-library/eslint-plugin/docs/dnn-modal-no-background-dismiss.md +++ b/packages/stencil-library/eslint-plugin/docs/dnn-modal-no-background-dismiss.md @@ -1,18 +1,18 @@ -# dnn-modal backgroundDismiss obsolete +# dnn-modal backdropDismiss obsolete -**dnn-modal** `backgroundDismiss` is obsolete, use preventBackgroundDismiss instead. -Per html specifications any boolean attribute should have a false default values, this was not the case for this property and it was replaced with the opposite `preventBackgroundDismiss` property instead (so it has the same default UX without breaking html specs). +**dnn-modal** `backdropDismiss` is obsolete, use preventBackdropDismiss instead. +Per html specifications any boolean attribute should have a false default values, this was not the case for this property and it was replaced with the opposite `preventBackdropDismiss` property instead (so it has the same default UX without breaking html specs). Example before: ```html - +

Something

``` Example after: ```html - +

Something

``` \ No newline at end of file diff --git a/packages/stencil-library/eslint-plugin/src/rules/dnn-modal-no-background-dismiss.test.ts b/packages/stencil-library/eslint-plugin/src/rules/dnn-modal-no-background-dismiss.test.ts index b8224f5ae..e8b91cb40 100644 --- a/packages/stencil-library/eslint-plugin/src/rules/dnn-modal-no-background-dismiss.test.ts +++ b/packages/stencil-library/eslint-plugin/src/rules/dnn-modal-no-background-dismiss.test.ts @@ -25,28 +25,28 @@ ruleTester.run("dnn-modal-no-background-dismiss", rule, { languageOptions: jsxParserOptions, }, { - code: "", + code: "", languageOptions: jsxParserOptions, }, ], invalid: [ { - code: "", + code: "", languageOptions: jsxParserOptions, errors: [{ messageId: "dnnModalNoBackgroundDismiss" }], output: "", }, { - code: "", + code: "", languageOptions: jsxParserOptions, errors: [{ messageId: "dnnModalNoBackgroundDismiss" }], output: "", }, { - code: "", + code: "", languageOptions: jsxParserOptions, errors: [{ messageId: "dnnModalNoBackgroundDismiss" }], - output: "", + output: "", }, ], }); \ No newline at end of file diff --git a/packages/stencil-library/eslint-plugin/src/rules/dnn-modal-no-background-dismiss.ts b/packages/stencil-library/eslint-plugin/src/rules/dnn-modal-no-background-dismiss.ts index 9f80f8902..6ce2b3d02 100644 --- a/packages/stencil-library/eslint-plugin/src/rules/dnn-modal-no-background-dismiss.ts +++ b/packages/stencil-library/eslint-plugin/src/rules/dnn-modal-no-background-dismiss.ts @@ -12,7 +12,7 @@ export const rule = createRule({ type: "problem", fixable: "code", messages: { - dnnModalNoBackgroundDismiss: "Background dismiss is obsolete in dnn-modal, use preventBackgroundDismiss instead." + dnnModalNoBackgroundDismiss: "Background dismiss is obsolete in dnn-modal, use preventBackdropDismiss instead." }, schema: [], }, @@ -23,17 +23,17 @@ export const rule = createRule({ node.openingElement.name.type === "JSXIdentifier" && node.openingElement.name.name === "dnn-modal" ) { - const backgroundDismissAttr = node.openingElement.attributes.find(attr => + const backdropDismissAttr = node.openingElement.attributes.find(attr => attr.type === "JSXAttribute" && - attr.name.name === "backgroundDismiss" + attr.name.name === "backdropDismiss" ); - if (backgroundDismissAttr?.type === "JSXAttribute") { + if (backdropDismissAttr?.type === "JSXAttribute") { context.report({ - node: backgroundDismissAttr, + node: backdropDismissAttr, messageId: "dnnModalNoBackgroundDismiss", fix(fixer) { - const attrValue = backgroundDismissAttr.value; + const attrValue = backdropDismissAttr.value; const isImplicitTrue = !attrValue; const isExplicitTrue = attrValue && attrValue.type === "JSXExpressionContainer" && @@ -47,19 +47,19 @@ export const rule = createRule({ if (isImplicitTrue || isExplicitTrue) { // Remove attribute entirely - return fixer.remove(backgroundDismissAttr); + return fixer.remove(backdropDismissAttr); } if (isExplicitFalse) { // Replace with opposite meaning return fixer.replaceText( - backgroundDismissAttr, - "preventBackgroundDismiss" + backdropDismissAttr, + "preventBackdropDismiss" ); } // Default behavior: just remove it - return fixer.remove(backgroundDismissAttr); + return fixer.remove(backdropDismissAttr); }, }); }