|
| 1 | +import { fixupPluginRules } from "@eslint/compat" |
| 2 | +import { FlatCompat } from "@eslint/eslintrc" |
| 3 | +import js from "@eslint/js" |
| 4 | +import tsParser from "@typescript-eslint/parser" |
| 5 | +import codegen from "eslint-plugin-codegen" |
| 6 | +import deprecation from "eslint-plugin-deprecation" |
| 7 | +import _import from "eslint-plugin-import" |
| 8 | +import simpleImportSort from "eslint-plugin-simple-import-sort" |
| 9 | +import sortDestructureKeys from "eslint-plugin-sort-destructure-keys" |
| 10 | +import path from "node:path" |
| 11 | +import { fileURLToPath } from "node:url" |
| 12 | + |
| 13 | +const __filename = fileURLToPath(import.meta.url) |
| 14 | +const __dirname = path.dirname(__filename) |
| 15 | +const compat = new FlatCompat({ |
| 16 | + baseDirectory: __dirname, |
| 17 | + recommendedConfig: js.configs.recommended, |
| 18 | + allConfig: js.configs.all |
| 19 | +}) |
| 20 | + |
| 21 | +export default [ |
| 22 | + { |
| 23 | + ignores: ["**/dist", "**/build", "**/docs", "**/*.md"] |
| 24 | + }, |
| 25 | + ...compat.extends( |
| 26 | + "eslint:recommended", |
| 27 | + "plugin:@typescript-eslint/eslint-recommended", |
| 28 | + "plugin:@typescript-eslint/recommended", |
| 29 | + "plugin:@effect/recommended" |
| 30 | + ), |
| 31 | + { |
| 32 | + plugins: { |
| 33 | + deprecation, |
| 34 | + import: fixupPluginRules(_import), |
| 35 | + "sort-destructure-keys": sortDestructureKeys, |
| 36 | + "simple-import-sort": simpleImportSort, |
| 37 | + codegen |
| 38 | + }, |
| 39 | + |
| 40 | + languageOptions: { |
| 41 | + parser: tsParser, |
| 42 | + ecmaVersion: 2018, |
| 43 | + sourceType: "module" |
| 44 | + }, |
| 45 | + |
| 46 | + settings: { |
| 47 | + "import/parsers": { |
| 48 | + "@typescript-eslint/parser": [".ts", ".tsx"] |
| 49 | + }, |
| 50 | + |
| 51 | + "import/resolver": { |
| 52 | + typescript: { |
| 53 | + alwaysTryTypes: true |
| 54 | + } |
| 55 | + } |
| 56 | + }, |
| 57 | + |
| 58 | + rules: { |
| 59 | + "codegen/codegen": "error", |
| 60 | + "no-fallthrough": "off", |
| 61 | + "no-irregular-whitespace": "off", |
| 62 | + "object-shorthand": "error", |
| 63 | + "prefer-destructuring": "off", |
| 64 | + "sort-imports": "off", |
| 65 | + |
| 66 | + "no-restricted-syntax": [ |
| 67 | + "error", |
| 68 | + { |
| 69 | + selector: "CallExpression[callee.property.name='push'] > SpreadElement.arguments", |
| 70 | + message: "Do not use spread arguments in Array.push" |
| 71 | + } |
| 72 | + ], |
| 73 | + |
| 74 | + "no-unused-vars": "off", |
| 75 | + "prefer-rest-params": "off", |
| 76 | + "prefer-spread": "off", |
| 77 | + "import/first": "error", |
| 78 | + "import/newline-after-import": "error", |
| 79 | + "import/no-duplicates": "error", |
| 80 | + "import/no-unresolved": "off", |
| 81 | + "import/order": "off", |
| 82 | + "simple-import-sort/imports": "off", |
| 83 | + "sort-destructure-keys/sort-destructure-keys": "error", |
| 84 | + "deprecation/deprecation": "off", |
| 85 | + |
| 86 | + "@typescript-eslint/array-type": [ |
| 87 | + "warn", |
| 88 | + { |
| 89 | + default: "generic", |
| 90 | + readonly: "generic" |
| 91 | + } |
| 92 | + ], |
| 93 | + |
| 94 | + "@typescript-eslint/member-delimiter-style": 0, |
| 95 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 96 | + "@typescript-eslint/ban-types": "off", |
| 97 | + "@typescript-eslint/no-explicit-any": "off", |
| 98 | + "@typescript-eslint/no-empty-interface": "off", |
| 99 | + "@typescript-eslint/consistent-type-imports": "warn", |
| 100 | + |
| 101 | + "@typescript-eslint/no-unused-vars": [ |
| 102 | + "error", |
| 103 | + { |
| 104 | + argsIgnorePattern: "^_", |
| 105 | + varsIgnorePattern: "^_" |
| 106 | + } |
| 107 | + ], |
| 108 | + |
| 109 | + "@typescript-eslint/ban-ts-comment": "off", |
| 110 | + "@typescript-eslint/camelcase": "off", |
| 111 | + "@typescript-eslint/explicit-function-return-type": "off", |
| 112 | + "@typescript-eslint/explicit-module-boundary-types": "off", |
| 113 | + "@typescript-eslint/interface-name-prefix": "off", |
| 114 | + "@typescript-eslint/no-array-constructor": "off", |
| 115 | + "@typescript-eslint/no-use-before-define": "off", |
| 116 | + "@typescript-eslint/no-namespace": "off", |
| 117 | + |
| 118 | + "@effect/dprint": [ |
| 119 | + "error", |
| 120 | + { |
| 121 | + config: { |
| 122 | + indentWidth: 2, |
| 123 | + lineWidth: 120, |
| 124 | + semiColons: "asi", |
| 125 | + quoteStyle: "alwaysDouble", |
| 126 | + trailingCommas: "never", |
| 127 | + operatorPosition: "maintain", |
| 128 | + "arrowFunction.useParentheses": "force" |
| 129 | + } |
| 130 | + } |
| 131 | + ] |
| 132 | + } |
| 133 | + }, |
| 134 | + { |
| 135 | + files: ["packages/*/src/**/*", "packages/*/test/**/*"], |
| 136 | + rules: { |
| 137 | + "no-console": "error" |
| 138 | + } |
| 139 | + } |
| 140 | +] |
0 commit comments