Skip to content

Commit 40861fc

Browse files
committed
Merge remote-tracking branch 'origin/main' into users/aubreyquinn/swatchPicker
2 parents 21bc5e6 + ff2b8dd commit 40861fc

11 files changed

+98
-60
lines changed

.eslintrc.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ module.exports = {
99
"eslint:recommended",
1010
"plugin:eslint-plugin/recommended",
1111
"plugin:node/recommended",
12-
"prettier",
13-
"plugin:eslint-plugin/recommended"
12+
"plugin:prettier/recommended" // Prettier plugin must be last in the extensions
1413
],
1514
plugins: ["header"],
1615
env: {
@@ -45,6 +44,12 @@ module.exports = {
4544
"node/no-unsupported-features/es-syntax": "off",
4645
"node/no-extraneous-import": "off"
4746
}
47+
},
48+
{
49+
files: ["lib/index.ts"],
50+
rules: {
51+
"sort-keys": ["error", "asc", { caseSensitive: true, natural: false }]
52+
}
4853
}
4954
],
5055
rules: {

.prettierrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"arrowParens": "avoid",
3-
"bracketSpacing": true,
4-
"endOfLine": "crlf",
53
"bracketSameLine": true,
4+
"bracketSpacing": true,
5+
"endOfLine": "auto",
66
"printWidth": 140,
77
"semi": true,
88
"tabWidth": 4,

lib/index.ts

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,6 @@ import * as rules from "./rules";
1313

1414
// import all rules in lib/rules
1515
module.exports = {
16-
rules: {
17-
"accordion-header-needs-labelling": rules.accordionHeaderNeedsLabelling,
18-
"accordion-item-needs-header-and-panel": rules.accordionItemNeedsHeaderAndPanel,
19-
"avatar-needs-name": rules.avatarNeedsName,
20-
"avoid-using-aria-describedby-for-primary-labelling": rules.avoidUsingAriaDescribedByForPrimaryLabelling,
21-
"badge-needs-accessible-name": rules.badgeNeedsAccessibleName,
22-
"breadcrumb-needs-labelling": rules.breadcrumbNeedsLabelling,
23-
"checkbox-needs-labelling": rules.checkboxNeedsLabelling,
24-
"combobox-needs-labelling": rules.comboboxNeedsLabelling,
25-
"compound-button-needs-labelling": rules.compoundButtonNeedsLabelling,
26-
"counter-badge-needs-count": rules.counterBadgeNeedsCount,
27-
"dialogbody-needs-title-content-and-actions": rules.dialogbodyNeedsTitleContentAndActions,
28-
"dialogsurface-needs-aria": rules.dialogsurfaceNeedsAria,
29-
"dropdown-needs-labelling": rules.dropdownNeedsLabelling,
30-
"field-needs-labelling": rules.fieldNeedsLabelling,
31-
"image-button-missing-aria": rules.imageButtonMissingAria,
32-
"input-components-require-accessible-name": rules.inputComponentsRequireAccessibleName,
33-
"link-missing-labelling": rules.linkMissingLabelling,
34-
"menu-item-needs-labelling": rules.menuItemNeedsLabelling,
35-
"no-empty-buttons": rules.noEmptyButtons,
36-
"no-empty-components": rules.noEmptyComponents,
37-
"prefer-aria-over-title-attribute": rules.preferAriaOverTitleAttribute,
38-
"progressbar-needs-labelling": rules.progressbarNeedsLabelling,
39-
"radio-button-missing-label": rules.radioButtonMissingLabel,
40-
"radiogroup-missing-label": rules.radiogroupMissingLabel,
41-
"rating-needs-name": rules.ratingNeedsName,
42-
"spin-button-needs-labelling": rules.spinButtonNeedsLabelling,
43-
"spin-button-unrecommended-labelling": rules.spinButtonUnrecommendedLabelling,
44-
"spinner-needs-labelling": rules.spinnerNeedsLabelling,
45-
"swatchpicker-needs-labelling": rules.swatchpickerNeedsLabelling,
46-
"switch-needs-labelling": rules.switchNeedsLabelling,
47-
"tablist-and-tabs-need-labelling": rules.tablistAndTabsNeedLabelling,
48-
"toolbar-missing-aria": rules.toolbarMissingAria,
49-
"tooltip-not-recommended": rules.tooltipNotRecommended,
50-
"visual-label-better-than-aria-suggestion": rules.visualLabelBetterThanAriaSuggestion
51-
},
5216
configs: {
5317
recommended: {
5418
rules: {
@@ -88,6 +52,42 @@ module.exports = {
8852
"@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion": "warn"
8953
}
9054
}
55+
},
56+
rules: {
57+
"accordion-header-needs-labelling": rules.accordionHeaderNeedsLabelling,
58+
"accordion-item-needs-header-and-panel": rules.accordionItemNeedsHeaderAndPanel,
59+
"avatar-needs-name": rules.avatarNeedsName,
60+
"avoid-using-aria-describedby-for-primary-labelling": rules.avoidUsingAriaDescribedByForPrimaryLabelling,
61+
"badge-needs-accessible-name": rules.badgeNeedsAccessibleName,
62+
"breadcrumb-needs-labelling": rules.breadcrumbNeedsLabelling,
63+
"checkbox-needs-labelling": rules.checkboxNeedsLabelling,
64+
"combobox-needs-labelling": rules.comboboxNeedsLabelling,
65+
"compound-button-needs-labelling": rules.compoundButtonNeedsLabelling,
66+
"counter-badge-needs-count": rules.counterBadgeNeedsCount,
67+
"dialogbody-needs-title-content-and-actions": rules.dialogbodyNeedsTitleContentAndActions,
68+
"dialogsurface-needs-aria": rules.dialogsurfaceNeedsAria,
69+
"dropdown-needs-labelling": rules.dropdownNeedsLabelling,
70+
"field-needs-labelling": rules.fieldNeedsLabelling,
71+
"image-button-missing-aria": rules.imageButtonMissingAria,
72+
"input-components-require-accessible-name": rules.inputComponentsRequireAccessibleName,
73+
"link-missing-labelling": rules.linkMissingLabelling,
74+
"menu-item-needs-labelling": rules.menuItemNeedsLabelling,
75+
"no-empty-buttons": rules.noEmptyButtons,
76+
"no-empty-components": rules.noEmptyComponents,
77+
"prefer-aria-over-title-attribute": rules.preferAriaOverTitleAttribute,
78+
"progressbar-needs-labelling": rules.progressbarNeedsLabelling,
79+
"radio-button-missing-label": rules.radioButtonMissingLabel,
80+
"radiogroup-missing-label": rules.radiogroupMissingLabel,
81+
"rating-needs-name": rules.ratingNeedsName,
82+
"spin-button-needs-labelling": rules.spinButtonNeedsLabelling,
83+
"spin-button-unrecommended-labelling": rules.spinButtonUnrecommendedLabelling,
84+
"spinner-needs-labelling": rules.spinnerNeedsLabelling,
85+
"swatchpicker-needs-labelling": rules.swatchpickerNeedsLabelling,
86+
"switch-needs-labelling": rules.switchNeedsLabelling,
87+
"tablist-and-tabs-need-labelling": rules.tablistAndTabsNeedLabelling,
88+
"toolbar-missing-aria": rules.toolbarMissingAria,
89+
"tooltip-not-recommended": rules.tooltipNotRecommended,
90+
"visual-label-better-than-aria-suggestion": rules.visualLabelBetterThanAriaSuggestion
9191
}
9292
};
9393

lib/rules/accordion-item-needs-header-and-panel.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
2525
create(context) {
2626
return {
2727
JSXOpeningElement(node: TSESTree.JSXOpeningElement) {
28-
const isAccordionItem =
29-
node.name.type === AST_NODE_TYPES.JSXIdentifier &&
30-
node.name.name === "AccordionItem";
28+
const isAccordionItem = node.name.type === AST_NODE_TYPES.JSXIdentifier && node.name.name === "AccordionItem";
3129

3230
if (!isAccordionItem) return;
3331

lib/rules/counter-badge-needs-count.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,3 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
8989
});
9090

9191
export default rule;
92-

lib/rules/dialogbody-needs-title-content-and-actions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
2525
create(context) {
2626
return {
2727
JSXOpeningElement(node: TSESTree.JSXOpeningElement) {
28-
const isDialogBody =
29-
node.name.type === AST_NODE_TYPES.JSXIdentifier &&
30-
node.name.name === "DialogBody";
28+
const isDialogBody = node.name.type === AST_NODE_TYPES.JSXIdentifier && node.name.name === "DialogBody";
3129

3230
if (!isDialogBody) {
3331
return;

lib/rules/rating-needs-name.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
1414
meta: {
1515
// possible error messages for the rule
1616
messages: {
17-
missingAriaLabel: 'Accessibility - ratings must have an accessible name or an itemLabel that generates an aria label'
17+
missingAriaLabel: "Accessibility - ratings must have an accessible name or an itemLabel that generates an aria label"
1818
},
1919
// "problem" means the rule is identifying code that either will cause an error or may cause a confusing behavior: https://eslint.org/docs/latest/developer-guide/working-with-rules
2020
type: "problem",
2121
// docs for the rule
2222
docs: {
23-
description: "Accessibility: Ratings must have accessible labelling: name, aria-label, aria-labelledby or itemLabel which generates aria-label",
23+
description:
24+
"Accessibility: Ratings must have accessible labelling: name, aria-label, aria-labelledby or itemLabel which generates aria-label",
2425
recommended: "strict",
2526
url: "https://www.w3.org/TR/html-aria/" // URL to the documentation page for this rule
2627
},
@@ -32,9 +33,7 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
3233
// visitor functions for different types of nodes
3334
JSXOpeningElement(node: TSESTree.JSXOpeningElement) {
3435
// if it is not a listed component, return
35-
if (
36-
elementType(node as JSXOpeningElement) !== "Rating"
37-
) {
36+
if (elementType(node as JSXOpeningElement) !== "Rating") {
3837
return;
3938
}
4039

lib/rules/tooltip-not-recommended.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
import {ESLintUtils, TSESTree} from '@typescript-eslint/utils';
4+
import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
55
import { elementType } from "jsx-ast-utils";
66
import { hasToolTipParent } from "../util/hasTooltipParent";
7-
import { JSXOpeningElement } from 'estree-jsx';
7+
import { JSXOpeningElement } from "estree-jsx";
88

99
//------------------------------------------------------------------------------
1010
// Rule Definition
@@ -22,7 +22,7 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
2222
type: "suggestion", // `problem`, `suggestion`, or `layout`
2323
docs: {
2424
description: `Accessibility: Prefer text content or aria over a tooltip for these components ${allowedComponents.join(", ")}`,
25-
recommended: 'strict',
25+
recommended: "strict"
2626
},
2727
schema: [] // Add a schema if the rule has options
2828
},
@@ -50,6 +50,4 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
5050
}
5151
});
5252

53-
54-
55-
export default rule;
53+
export default rule;

package-lock.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"eslint-doc-generator": "^1.7.1",
7272
"eslint-plugin-eslint-plugin": "^5.0.8",
7373
"eslint-plugin-node": "^11.1.0",
74+
"eslint-plugin-prettier": "^4.2.5",
7475
"husky": "^9.1.6",
7576
"jest": "^29.7.0",
7677
"jscodeshift": "^17.0.0",

0 commit comments

Comments
 (0)