diff --git a/.eslintrc.js b/.eslintrc.js
index b0bfe6c..6d67a94 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -9,8 +9,7 @@ module.exports = {
"eslint:recommended",
"plugin:eslint-plugin/recommended",
"plugin:node/recommended",
- "prettier",
- "plugin:eslint-plugin/recommended"
+ "plugin:prettier/recommended" // Prettier plugin must be last in the extensions
],
plugins: ["header"],
env: {
@@ -59,4 +58,3 @@ module.exports = {
},
ignorePatterns: ["node_modules", "dist/", "scripts"]
};
-
diff --git a/.prettierrc.json b/.prettierrc.json
index 881afde..4228ffa 100644
--- a/.prettierrc.json
+++ b/.prettierrc.json
@@ -1,8 +1,8 @@
{
"arrowParens": "avoid",
- "bracketSpacing": true,
- "endOfLine": "crlf",
"bracketSameLine": true,
+ "bracketSpacing": true,
+ "endOfLine": "auto",
"printWidth": 140,
"semi": true,
"tabWidth": 4,
diff --git a/lib/index.ts b/lib/index.ts
index b8b00ce..67f9823 100644
--- a/lib/index.ts
+++ b/lib/index.ts
@@ -93,4 +93,3 @@ module.exports = {
module.exports.processors = {
// add your processors here
};
-
diff --git a/lib/rules/accordion-item-needs-header-and-panel.ts b/lib/rules/accordion-item-needs-header-and-panel.ts
index 844c613..690e799 100644
--- a/lib/rules/accordion-item-needs-header-and-panel.ts
+++ b/lib/rules/accordion-item-needs-header-and-panel.ts
@@ -25,9 +25,7 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
create(context) {
return {
JSXOpeningElement(node: TSESTree.JSXOpeningElement) {
- const isAccordionItem =
- node.name.type === AST_NODE_TYPES.JSXIdentifier &&
- node.name.name === "AccordionItem";
+ const isAccordionItem = node.name.type === AST_NODE_TYPES.JSXIdentifier && node.name.name === "AccordionItem";
if (!isAccordionItem) return;
diff --git a/lib/rules/counter-badge-needs-count.ts b/lib/rules/counter-badge-needs-count.ts
index 849b62d..a933016 100644
--- a/lib/rules/counter-badge-needs-count.ts
+++ b/lib/rules/counter-badge-needs-count.ts
@@ -89,4 +89,3 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
});
export default rule;
-
diff --git a/lib/rules/dialogbody-needs-title-content-and-actions.ts b/lib/rules/dialogbody-needs-title-content-and-actions.ts
index c30e647..fdf467b 100644
--- a/lib/rules/dialogbody-needs-title-content-and-actions.ts
+++ b/lib/rules/dialogbody-needs-title-content-and-actions.ts
@@ -25,9 +25,7 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
create(context) {
return {
JSXOpeningElement(node: TSESTree.JSXOpeningElement) {
- const isDialogBody =
- 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/lib/rules/rating-needs-name.ts b/lib/rules/rating-needs-name.ts
index 1592e33..6309662 100644
--- a/lib/rules/rating-needs-name.ts
+++ b/lib/rules/rating-needs-name.ts
@@ -14,13 +14,14 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
meta: {
// possible error messages for the rule
messages: {
- missingAriaLabel: 'Accessibility - ratings must have an accessible name or an itemLabel that generates an aria label'
+ missingAriaLabel: "Accessibility - ratings must have an accessible name or an itemLabel that generates an aria label"
},
// "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
type: "problem",
// docs for the rule
docs: {
- description: "Accessibility: Ratings must have accessible labelling: name, aria-label, aria-labelledby or itemLabel which generates aria-label",
+ description:
+ "Accessibility: Ratings must have accessible labelling: name, aria-label, aria-labelledby or itemLabel which generates aria-label",
recommended: "strict",
url: "https://www.w3.org/TR/html-aria/" // URL to the documentation page for this rule
},
@@ -32,9 +33,7 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
// visitor functions for different types of nodes
JSXOpeningElement(node: TSESTree.JSXOpeningElement) {
// if it is not a listed component, return
- if (
- elementType(node as JSXOpeningElement) !== "Rating"
- ) {
+ if (elementType(node as JSXOpeningElement) !== "Rating") {
return;
}
diff --git a/lib/rules/tooltip-not-recommended.ts b/lib/rules/tooltip-not-recommended.ts
index b2111c9..17d098b 100644
--- a/lib/rules/tooltip-not-recommended.ts
+++ b/lib/rules/tooltip-not-recommended.ts
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
-import {ESLintUtils, TSESTree} from '@typescript-eslint/utils';
+import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
import { elementType } from "jsx-ast-utils";
import { hasToolTipParent } from "../util/hasTooltipParent";
-import { JSXOpeningElement } from 'estree-jsx';
+import { JSXOpeningElement } from "estree-jsx";
//------------------------------------------------------------------------------
// Rule Definition
@@ -22,7 +22,7 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
type: "suggestion", // `problem`, `suggestion`, or `layout`
docs: {
description: `Accessibility: Prefer text content or aria over a tooltip for these components ${allowedComponents.join(", ")}`,
- recommended: 'strict',
+ recommended: "strict"
},
schema: [] // Add a schema if the rule has options
},
@@ -50,6 +50,4 @@ const rule = ESLintUtils.RuleCreator.withoutDocs({
}
});
-
-
-export default rule;
\ No newline at end of file
+export default rule;
diff --git a/package-lock.json b/package-lock.json
index 019f469..c1f1a7b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -29,6 +29,7 @@
"eslint-doc-generator": "^1.7.1",
"eslint-plugin-eslint-plugin": "^5.0.8",
"eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-prettier": "^4.2.5",
"husky": "^9.1.6",
"jest": "^29.7.0",
"jscodeshift": "^17.0.0",
@@ -3529,6 +3530,27 @@
"semver": "bin/semver.js"
}
},
+ "node_modules/eslint-plugin-prettier": {
+ "version": "4.2.5",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.5.tgz",
+ "integrity": "sha512-9Ni+xgemM2IWLq6aXEpP2+V/V30GeA/46Ar629vcMqVPodFFWC9skHu/D1phvuqtS8bJCFnNf01/qcmqYEwNfg==",
+ "dev": true,
+ "dependencies": {
+ "prettier-linter-helpers": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "eslint": ">=7.28.0",
+ "prettier": ">=2.0.0"
+ },
+ "peerDependenciesMeta": {
+ "eslint-config-prettier": {
+ "optional": true
+ }
+ }
+ },
"node_modules/eslint-scope": {
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
@@ -3825,6 +3847,12 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
+ "node_modules/fast-diff": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz",
+ "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==",
+ "dev": true
+ },
"node_modules/fast-glob": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
@@ -6487,6 +6515,18 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
+ "node_modules/prettier-linter-helpers": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+ "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
+ "dev": true,
+ "dependencies": {
+ "fast-diff": "^1.1.2"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
"node_modules/pretty-format": {
"version": "29.7.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
diff --git a/package.json b/package.json
index 762edc4..a7452bf 100644
--- a/package.json
+++ b/package.json
@@ -71,6 +71,7 @@
"eslint-doc-generator": "^1.7.1",
"eslint-plugin-eslint-plugin": "^5.0.8",
"eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-prettier": "^4.2.5",
"husky": "^9.1.6",
"jest": "^29.7.0",
"jscodeshift": "^17.0.0",
diff --git a/tests/lib/rules/rating-needs-name.test.ts b/tests/lib/rules/rating-needs-name.test.ts
index abb58c3..07a9be2 100644
--- a/tests/lib/rules/rating-needs-name.test.ts
+++ b/tests/lib/rules/rating-needs-name.test.ts
@@ -18,11 +18,11 @@ import rule from "../../../lib/rules/rating-needs-name";
ruleTester.run("rating-needs-name", rule as unknown as Rule.RuleModule, {
valid: [
// give me some code that won't trigger a warning
- '',
+ "",
'',
'',
'<>>',
- '',
+ "",
'',
'',
'<>>'