Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ module.exports = {
{
files: ["tests/**/*.js"],
env: { mocha: true }
},
{
files: ["tests/**/*.ts"],
env: { jest: true }
},
{
files: ["**/*.ts"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
parserOptions: {
ecmaVersion: 2021,
sourceType: "module",
project: "./tsconfig.json"
},
rules: {
// Disable Node.js rules that conflict with TypeScript
"node/no-missing-import": "off",
"node/no-unsupported-features/es-syntax": "off",
"node/no-extraneous-import": "off"
}
}
],
rules: {
Expand Down
3 changes: 3 additions & 0 deletions lib/applicableComponents/labelBasedComponents.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

const labelBasedComponents = ["Label", "label"];
const elementsUsedAsLabels = ["div", "span", "p", "h1", "h2", "h3", "h4", "h5", "h6"];

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/field-needs-labelling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"use strict";

const { hasNonEmptyProp } = require("../util/hasNonEmptyProp");
import { hasNonEmptyProp } from "../util/hasNonEmptyProp";
const elementType = require("jsx-ast-utils").elementType;
import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";

Expand Down
3 changes: 3 additions & 0 deletions lib/rules/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export { default as accordionHeaderNeedsLabelling } from "./accordion-header-needs-labelling";
export { default as accordionItemNeedsHeaderAndPanel } from "./accordion-item-needs-header-and-panel";
export { default as avatarNeedsName } from "./avatar-needs-name";
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/rules/utils/hasFieldParent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ const createMockContext = (ancestors: TSESTree.Node[]): TSESLint.RuleContext<str
report: jest.fn(),
getAncestors: () => ancestors,
getSourceCode: jest.fn(),
// eslint-disable-next-line no-unused-vars
getDeclaredVariables: function (node: TSESTree.Node): readonly TSESLint.Scope.Variable[] {
throw new Error("Function not implemented.");
},
// eslint-disable-next-line no-unused-vars
markVariableAsUsed: function (name: string): boolean {
throw new Error("Function not implemented.");
}
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/rules/utils/hasLabelledChilImage.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Import necessary dependencies and mock functions
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import {
hasLabelledChildImage,
isImageHidden,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"rootDir": ".",
"allowJs": true
},
"include": ["lib"],
"include": ["lib", "tests/lib"],
"exclude": ["node_modules", "dist"]
}
Loading