A tool for parsing traffic on the jetstream and applying a moderation workstream based on regexp based rules

Add ESLint configuration

This commit introduces an ESLint configuration file to the project. It
includes recommended rules and best practices for TypeScript projects.
The configuration also sets up various plugins and specifies ignores to
prevent linting of certain files.

Changed files
+115
+115
eslint.config.mjs
··· 1 + import eslint from "@eslint/js"; 2 + import tseslint from "typescript-eslint"; 3 + import stylistic from "@stylistic/eslint-plugin"; 4 + import prettier from "eslint-config-prettier"; 5 + import importPlugin from "eslint-plugin-import"; 6 + 7 + export default tseslint.config( 8 + eslint.configs.recommended, 9 + ...tseslint.configs.strictTypeChecked, 10 + ...tseslint.configs.stylisticTypeChecked, 11 + prettier, 12 + { 13 + languageOptions: { 14 + parserOptions: { 15 + project: "./tsconfig.json", 16 + tsconfigRootDir: import.meta.dirname, 17 + }, 18 + }, 19 + }, 20 + { 21 + plugins: { 22 + "@stylistic": stylistic, 23 + import: importPlugin, 24 + }, 25 + rules: { 26 + // TypeScript specific rules 27 + "@typescript-eslint/no-unused-vars": [ 28 + "error", 29 + { argsIgnorePattern: "^_" }, 30 + ], 31 + "@typescript-eslint/no-explicit-any": "error", 32 + "@typescript-eslint/no-unsafe-assignment": "error", 33 + "@typescript-eslint/no-unsafe-member-access": "error", 34 + "@typescript-eslint/no-unsafe-call": "error", 35 + "@typescript-eslint/no-unsafe-return": "error", 36 + "@typescript-eslint/no-unsafe-argument": "error", 37 + "@typescript-eslint/prefer-nullish-coalescing": "error", 38 + "@typescript-eslint/prefer-optional-chain": "error", 39 + "@typescript-eslint/no-non-null-assertion": "error", 40 + "@typescript-eslint/consistent-type-imports": "error", 41 + "@typescript-eslint/consistent-type-exports": "error", 42 + "@typescript-eslint/no-import-type-side-effects": "error", 43 + 44 + // General code quality 45 + "no-console": "warn", 46 + "no-debugger": "error", 47 + "no-var": "error", 48 + "prefer-const": "error", 49 + "prefer-template": "error", 50 + "object-shorthand": "error", 51 + "prefer-destructuring": ["error", { object: true, array: false }], 52 + 53 + // Import rules 54 + "import/order": [ 55 + "error", 56 + { 57 + groups: [ 58 + "builtin", 59 + "external", 60 + "internal", 61 + "parent", 62 + "sibling", 63 + "index", 64 + ], 65 + "newlines-between": "always", 66 + alphabetize: { order: "asc", caseInsensitive: true }, 67 + }, 68 + ], 69 + "import/no-duplicates": "error", 70 + "import/no-unresolved": "off", // TypeScript handles this 71 + 72 + // Security-focused rules 73 + "no-eval": "error", 74 + "no-implied-eval": "error", 75 + "no-new-func": "error", 76 + "no-script-url": "error", 77 + 78 + // Error handling 79 + "no-empty-pattern": "error", 80 + "no-fallthrough": "error", 81 + "no-unreachable": "error", 82 + "no-unreachable-loop": "error", 83 + 84 + // Style preferences 85 + "@stylistic/indent": ["error", 2], 86 + "@stylistic/quotes": ["error", "single"], 87 + "@stylistic/semi": ["error", "always"], 88 + //"@stylistic/comma-dangle": ["error", "es5"], 89 + "@stylistic/object-curly-spacing": ["error", "always"], 90 + "@stylistic/array-bracket-spacing": ["error", "never"], 91 + "@stylistic/space-before-function-paren": [ 92 + "error", 93 + { 94 + anonymous: "always", 95 + named: "never", 96 + asyncArrow: "always", 97 + }, 98 + ], 99 + }, 100 + }, 101 + { 102 + files: ["**/*.js", "**/*.mjs"], 103 + ...tseslint.configs.disableTypeChecked, 104 + }, 105 + { 106 + ignores: [ 107 + "node_modules/", 108 + "dist/", 109 + "build/", 110 + "*.config.js", 111 + "*.config.mjs", 112 + "coverage/", 113 + ], 114 + }, 115 + );