@shayanthenerd/eslint-config
Version:
A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style
53 lines (51 loc) • 2.25 kB
JavaScript
import { isEnabled } from "../utils/isEnabled.js";
import { defaultOptions } from "../utils/options/defaultOptions.js";
//#region src/rules/html.ts
function getHTMLRules(options) {
const { html, stylistic } = options.configs;
const { useBaseline, idNamingConvention } = isEnabled(html) ? html : defaultOptions.configs.html;
const { indent, useTabs, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHTMLElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
const htmlRules = {
"better-tailwindcss/no-duplicate-classes": "off",
"@html-eslint/no-target-blank": "error",
"@html-eslint/no-duplicate-class": "warn",
"@html-eslint/require-button-type": "error",
"@html-eslint/no-script-style-type": "error",
"@html-eslint/require-meta-charset": "error",
"@html-eslint/quotes": [
"warn",
"double",
{ enforceTemplatedAttrValue: true }
],
"@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
"@html-eslint/require-closing-tags": ["error", {
selfClosingCustomPatterns: ["-"],
selfClosing: selfCloseVoidHTMLElements
}],
"@html-eslint/require-meta-description": "error",
"@html-eslint/require-open-graph-protocol": "error",
"@html-eslint/no-abstract-roles": "error",
"@html-eslint/no-accesskey-attrs": "error",
"@html-eslint/require-frame-title": "error",
"@html-eslint/no-aria-hidden-body": "error",
"@html-eslint/no-positive-tabindex": "error",
"@html-eslint/require-meta-viewport": "error",
"@html-eslint/no-skip-heading-levels": "error",
"@html-eslint/lowercase": "warn",
"@html-eslint/no-trailing-spaces": "warn",
"@html-eslint/indent": ["warn", useTabs ? "tab" : indent],
"@html-eslint/id-naming-convention": ["warn", idNamingConvention],
"@html-eslint/element-newline": ["warn", { inline: ["$inline"] }],
"@html-eslint/attrs-newline": ["warn", { ifAttrsMoreThan: maxAttributesPerLine }],
"@html-eslint/no-multiple-empty-lines": ["warn", { max: maxConsecutiveEmptyLines }],
"@html-eslint/no-extra-spacing-attrs": ["warn", {
disallowTabs: true,
disallowMissing: true,
disallowInAssignment: true,
enforceBeforeSelfClose: true
}]
};
return htmlRules;
}
//#endregion
export { getHTMLRules };