Cybersecurity-Projects/PROJECTS/advanced/encrypted-p2p-chat/frontend/eslint.config.js

157 lines
4.3 KiB
JavaScript

// ===================
// © AngelaMos | 2025
// eslint.config.js
// ===================
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import solid from "eslint-plugin-solid/configs/typescript";
import jsxA11y from "eslint-plugin-jsx-a11y";
import prettierConfig from "eslint-config-prettier";
import globals from "globals";
export default tseslint.config(
{
ignores: [
"dist",
"node_modules",
"*.config.js",
"*.config.ts",
"*.min.js",
],
},
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
files: ["**/*.{ts,tsx}"],
...solid,
plugins: {
...solid.plugins,
"jsx-a11y": jsxA11y,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: ["./tsconfig.json"],
tsconfigRootDir: import.meta.dirname,
ecmaFeatures: { jsx: true },
},
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
...solid.rules,
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
},
],
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/array-type": ["error", { default: "array" }],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/strict-boolean-expressions": [
"error",
{
allowString: false,
allowNumber: false,
allowNullableObject: false,
allowNullableString: true,
allowAny: true,
},
],
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: {
attributes: false,
},
},
],
"solid/reactivity": "warn",
"solid/no-destructure": "warn",
"solid/jsx-no-undef": "error",
"solid/no-react-specific-props": "error",
"solid/prefer-for": "warn",
"solid/self-closing-comp": "error",
"solid/style-prop": "error",
"solid/no-innerhtml": "error",
"solid/no-unknown-namespaces": "error",
"solid/event-handlers": [
"error",
{
ignoreCase: false,
warnOnSpread: true,
},
],
"solid/imports": "error",
"solid/no-proxy-apis": "off",
"jsx-a11y/alt-text": "error",
"jsx-a11y/anchor-has-content": "error",
"jsx-a11y/click-events-have-key-events": "error",
"jsx-a11y/no-static-element-interactions": "error",
"jsx-a11y/no-noninteractive-element-interactions": "warn",
"jsx-a11y/aria-props": "error",
"jsx-a11y/aria-role": "error",
"jsx-a11y/role-has-required-aria-props": "error",
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-debugger": "error",
"no-alert": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-template": "error",
"object-shorthand": "error",
"no-nested-ternary": "error",
"max-depth": ["error", 6],
"max-lines": [
"error",
{ max: 2000, skipBlankLines: true, skipComments: true },
],
complexity: ["error", 55],
},
},
{
files: ["src/index.tsx"],
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
},
},
prettierConfig
);