diff --git a/lib/rules/accordion-item-needs-header-and-panel.ts b/lib/rules/accordion-item-needs-header-and-panel.ts
index 97611cf..844c613 100644
--- a/lib/rules/accordion-item-needs-header-and-panel.ts
+++ b/lib/rules/accordion-item-needs-header-and-panel.ts
@@ -25,9 +25,11 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
create(context) {
return {
JSXOpeningElement(node: TSESTree.JSXOpeningElement) {
- if (node.name.type === AST_NODE_TYPES.JSXIdentifier && node.name.name !== "AccordionItem") {
- return;
- }
+ const isAccordionItem =
+ node.name.type === AST_NODE_TYPES.JSXIdentifier &&
+ node.name.name === "AccordionItem";
+
+ if (!isAccordionItem) return;
if (!(node.parent && node.parent.type === AST_NODE_TYPES.JSXElement)) {
return;
diff --git a/lib/rules/dialogbody-needs-title-content-and-actions.ts b/lib/rules/dialogbody-needs-title-content-and-actions.ts
index a9adaa1..c30e647 100644
--- a/lib/rules/dialogbody-needs-title-content-and-actions.ts
+++ b/lib/rules/dialogbody-needs-title-content-and-actions.ts
@@ -25,7 +25,11 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
create(context) {
return {
JSXOpeningElement(node: TSESTree.JSXOpeningElement) {
- if (node.name.type === AST_NODE_TYPES.JSXIdentifier && node.name.name !== "DialogBody") {
+ const isDialogBody =
+ node.name.type === AST_NODE_TYPES.JSXIdentifier &&
+ node.name.name === "DialogBody";
+
+ if (!isDialogBody) {
return;
}
diff --git a/package-lock.json b/package-lock.json
index 24ba706..ee2f1c1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@microsoft/eslint-plugin-fluentui-jsx-a11y",
- "version": "3.0.0-alpha.1",
+ "version": "3.0.0-alpha.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@microsoft/eslint-plugin-fluentui-jsx-a11y",
- "version": "3.0.0-alpha.1",
+ "version": "3.0.0-alpha.2",
"license": "MIT",
"dependencies": {
"eslint-plugin-header": "^3.1.1",
diff --git a/tests/lib/rules/accordion-item-needs-header-and-panel.test.ts b/tests/lib/rules/accordion-item-needs-header-and-panel.test.ts
index 2392eda..8354d1a 100644
--- a/tests/lib/rules/accordion-item-needs-header-and-panel.test.ts
+++ b/tests/lib/rules/accordion-item-needs-header-and-panel.test.ts
@@ -15,7 +15,8 @@ import rule from "../../../lib/rules/accordion-item-needs-header-and-panel";
ruleTester.run("accordion-item-needs-header-and-panel", rule as unknown as Rule.RuleModule, {
valid: [
- `Accordion Header 1Accordion Panel 1
`
+ `Accordion Header 1Accordion Panel 1
`,
+ ``
],
invalid: [
diff --git a/tests/lib/rules/dialogbody-needs-title-content-and-actions.test.ts b/tests/lib/rules/dialogbody-needs-title-content-and-actions.test.ts
index aaf71e3..54fbf80 100644
--- a/tests/lib/rules/dialogbody-needs-title-content-and-actions.test.ts
+++ b/tests/lib/rules/dialogbody-needs-title-content-and-actions.test.ts
@@ -22,7 +22,8 @@ ruleTester.run("dialogbody-needs-title-content-and-actions", rule as any as Rule
- `
+ `,
+ ``
],
invalid: [