eslint HTML title

This commit is contained in:
Alex Gleason 2025-05-30 22:58:43 +02:00
parent 81f90b9985
commit 95de9fde27
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
4 changed files with 101 additions and 1 deletions

View File

@ -3,6 +3,8 @@ import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks"; import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh"; import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint"; import tseslint from "typescript-eslint";
import htmlEslint from "@html-eslint/eslint-plugin";
import htmlParser from "@html-eslint/parser";
import customRules from "./eslint-rules/index.js"; import customRules from "./eslint-rules/index.js";
export default tseslint.config( export default tseslint.config(
@ -28,5 +30,19 @@ export default tseslint.config(
"@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "off",
"custom/no-placeholder-comments": "error", "custom/no-placeholder-comments": "error",
}, },
},
{
files: ["**/*.html"],
plugins: {
"@html-eslint": htmlEslint,
},
languageOptions: {
parser: htmlParser,
},
rules: {
"@html-eslint/require-title": "error",
"@html-eslint/require-meta-charset": "error",
"@html-eslint/require-meta-viewport": "error",
},
} }
); );

View File

@ -3,7 +3,6 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>mkstack</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>

83
package-lock.json generated
View File

@ -63,6 +63,8 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.9.0", "@eslint/js": "^9.9.0",
"@html-eslint/eslint-plugin": "^0.41.0",
"@html-eslint/parser": "^0.41.0",
"@tailwindcss/typography": "^0.5.15", "@tailwindcss/typography": "^0.5.15",
"@testing-library/jest-dom": "^6.6.3", "@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0", "@testing-library/react": "^16.3.0",
@ -857,6 +859,80 @@
"react-hook-form": "^7.0.0" "react-hook-form": "^7.0.0"
} }
}, },
"node_modules/@html-eslint/eslint-plugin": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@html-eslint/eslint-plugin/-/eslint-plugin-0.41.0.tgz",
"integrity": "sha512-kZhOdLOx5xGogw9CE/uGKkoo8t7fNK9PxU6kosIvu9Yveir3r2VhGYC4II/2OEGQ+O4cPk2LxV1fCpYt7XFMtQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint/plugin-kit": "^0.3.1",
"@html-eslint/parser": "^0.41.0",
"@html-eslint/template-parser": "^0.41.0",
"@html-eslint/template-syntax-parser": "^0.41.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"peerDependencies": {
"eslint": "^8.0.0 || ^9.0.0"
}
},
"node_modules/@html-eslint/eslint-plugin/node_modules/@eslint/core": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz",
"integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@types/json-schema": "^7.0.15"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@html-eslint/eslint-plugin/node_modules/@eslint/plugin-kit": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.1.tgz",
"integrity": "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@eslint/core": "^0.14.0",
"levn": "^0.4.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@html-eslint/parser": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@html-eslint/parser/-/parser-0.41.0.tgz",
"integrity": "sha512-QQJeq2G11T/SGYcG09+XOajm+X8XX6bVVSouB3SVlGmm3exvJis0B6tBnb+5Rz2kC/q3C21z1ZuCc/AXcFKzIA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@html-eslint/template-syntax-parser": "^0.41.0",
"es-html-parser": "0.2.0"
}
},
"node_modules/@html-eslint/template-parser": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@html-eslint/template-parser/-/template-parser-0.41.0.tgz",
"integrity": "sha512-ntZNMh+G13lPvwSSkr2U0XqWWDFLSZPeidcztgVCjxthwgSMdefL4au/YicnlB+h1WNBw8Pk0bAjczJXEbp85g==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-html-parser": "0.2.0"
}
},
"node_modules/@html-eslint/template-syntax-parser": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@html-eslint/template-syntax-parser/-/template-syntax-parser-0.41.0.tgz",
"integrity": "sha512-dgiE30uXWCoD89chi6KdjYOF+143bImJ3GNl3j2iy6/ZM8enTqCQVHZ48+Esf6Tx2rLBBBdxx4Rb0fG11myHsw==",
"dev": true,
"license": "MIT"
},
"node_modules/@humanfs/core": { "node_modules/@humanfs/core": {
"version": "0.19.1", "version": "0.19.1",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
@ -4447,6 +4523,13 @@
"url": "https://github.com/fb55/entities?sponsor=1" "url": "https://github.com/fb55/entities?sponsor=1"
} }
}, },
"node_modules/es-html-parser": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/es-html-parser/-/es-html-parser-0.2.0.tgz",
"integrity": "sha512-snJ7uJC8Dkx/yT0eYZrWcY57rkPU6Zui6YphPynw8r52AWf57gjqMC0GWe7OxSDipwXowFpa3rqckEeAPTOz7w==",
"dev": true,
"license": "MIT"
},
"node_modules/es-module-lexer": { "node_modules/es-module-lexer": {
"version": "1.7.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz",

View File

@ -65,6 +65,8 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.9.0", "@eslint/js": "^9.9.0",
"@html-eslint/eslint-plugin": "^0.41.0",
"@html-eslint/parser": "^0.41.0",
"@tailwindcss/typography": "^0.5.15", "@tailwindcss/typography": "^0.5.15",
"@testing-library/jest-dom": "^6.6.3", "@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0", "@testing-library/react": "^16.3.0",