mkstack/eslint.config.js

75 lines
2.0 KiB
JavaScript
Raw Normal View History

2025-04-16 21:43:54 -05:00
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
2025-05-30 22:58:43 +02:00
import htmlEslint from "@html-eslint/eslint-plugin";
import htmlParser from "@html-eslint/parser";
import customRules from "./eslint-rules/index.js";
2025-04-16 21:43:54 -05:00
export default tseslint.config(
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
linterOptions: {
noInlineConfig: true, // Prevents all eslint-disable comments
reportUnusedDisableDirectives: "error", // Reports unused disable directives as errors
},
2025-04-16 21:43:54 -05:00
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
"custom": customRules,
2025-04-16 21:43:54 -05:00
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
2025-06-01 17:28:25 -05:00
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true,
},
],
"custom/no-placeholder-comments": "error",
2025-05-30 23:46:15 +02:00
"no-warning-comments": [
"error",
{ terms: ["fixme"] },
],
2025-04-16 21:43:54 -05:00
},
2025-05-30 22:58:43 +02:00
},
{
files: ["**/*.html"],
plugins: {
"@html-eslint": htmlEslint,
2025-05-30 23:02:12 +02:00
"custom": customRules,
2025-05-30 22:58:43 +02:00
},
languageOptions: {
parser: htmlParser,
},
rules: {
"@html-eslint/require-title": "error",
"@html-eslint/require-meta-charset": "error",
"@html-eslint/require-meta-description": "error",
2025-05-30 22:58:43 +02:00
"@html-eslint/require-meta-viewport": "error",
"@html-eslint/require-open-graph-protocol": [
"error",
[
"og:type",
"og:title",
"og:description",
],
],
2025-05-30 23:02:12 +02:00
"custom/require-webmanifest": "error",
2025-05-30 22:58:43 +02:00
},
2025-04-16 21:43:54 -05:00
}
);