|
| 1 | +{ |
| 2 | + "$schema": "./node_modules/oxlint/configuration_schema.json", |
| 3 | + "plugins": ["typescript", "react", "import", "jsdoc"], |
| 4 | + "jsPlugins": [ |
| 5 | + { |
| 6 | + "name": "sdk", |
| 7 | + "specifier": "@sentry-internal/eslint-plugin-sdk" |
| 8 | + } |
| 9 | + ], |
| 10 | + "categories": {}, |
| 11 | + "rules": { |
| 12 | + "no-unused-vars": [ |
| 13 | + "warn", |
| 14 | + { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" } |
| 15 | + ], |
| 16 | + |
| 17 | + // === Base rules (ported from @sentry-internal/eslint-config-sdk) === |
| 18 | + "no-console": "error", |
| 19 | + "no-alert": "error", |
| 20 | + "no-param-reassign": "error", |
| 21 | + "prefer-template": "error", |
| 22 | + "no-bitwise": "error", |
| 23 | + "complexity": "error", |
| 24 | + "no-unused-expressions": ["error", { "allowShortCircuit": true }], |
| 25 | + "guard-for-in": "error", |
| 26 | + "array-callback-return": ["error", { "allowImplicit": true }], |
| 27 | + "quotes": ["error", "single", { "avoidEscape": true }], |
| 28 | + "no-return-await": "error", |
| 29 | + "max-lines": ["error", { "max": 300, "skipComments": true, "skipBlankLines": true }], |
| 30 | + |
| 31 | + // === Import rules === |
| 32 | + "import/namespace": "off", |
| 33 | + "import/no-unresolved": "off", |
| 34 | + |
| 35 | + // === Rules turned off (not needed or causing false positives) === |
| 36 | + "no-control-regex": "off", |
| 37 | + "jsdoc/check-tag-names": "off", |
| 38 | + "jsdoc/require-yields": "off", |
| 39 | + "no-shadow": "off", |
| 40 | + "no-unsafe-optional-chaining": "off", |
| 41 | + // Not in original ESLint config — auto-enabled by --type-aware, produces false positives on mocked functions |
| 42 | + "typescript/await-thenable": "off", |
| 43 | + |
| 44 | + // === Custom SDK rules (via JS plugin) === |
| 45 | + "sdk/no-eq-empty": "error" |
| 46 | + }, |
| 47 | + "overrides": [ |
| 48 | + { |
| 49 | + "files": ["**/*.ts", "**/*.tsx", "**/*.d.ts"], |
| 50 | + "rules": { |
| 51 | + "typescript/ban-ts-comment": "error", |
| 52 | + "typescript/consistent-type-imports": "error", |
| 53 | + "typescript/no-unnecessary-type-assertion": "error", |
| 54 | + "typescript/prefer-for-of": "error", |
| 55 | + "typescript/explicit-function-return-type": ["error", { "allowExpressions": true }], |
| 56 | + "typescript/no-floating-promises": ["error", { "ignoreVoid": false }], |
| 57 | + "typescript/no-dynamic-delete": "error", |
| 58 | + "typescript/unified-signatures": "error", |
| 59 | + "typescript/no-unsafe-member-access": "error", |
| 60 | + "typescript/unbound-method": "error", |
| 61 | + "typescript/no-explicit-any": "warn", |
| 62 | + "typescript/no-empty-function": "off", |
| 63 | + "typescript/no-empty-object-type": "off", |
| 64 | + "typescript/no-require-imports": "off", |
| 65 | + "typescript/prefer-optional-chain": "error", |
| 66 | + "typescript/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "caughtErrors": "none" }], |
| 67 | + "typescript/no-redundant-type-constituents": "off", |
| 68 | + "typescript/restrict-template-expressions": "off", |
| 69 | + "typescript/no-base-to-string": "off" |
| 70 | + } |
| 71 | + }, |
| 72 | + { |
| 73 | + "files": ["**/*.js", "**/*.mjs", "**/*.cjs"], |
| 74 | + "rules": { |
| 75 | + "typescript/ban-ts-comment": "off", |
| 76 | + "typescript/consistent-type-imports": "off", |
| 77 | + "typescript/prefer-optional-chain": "off", |
| 78 | + "typescript/no-unnecessary-type-assertion": "off", |
| 79 | + "typescript/prefer-for-of": "off", |
| 80 | + "typescript/no-floating-promises": "off", |
| 81 | + "typescript/no-dynamic-delete": "off", |
| 82 | + "typescript/no-unsafe-member-access": "off", |
| 83 | + "typescript/unbound-method": "off", |
| 84 | + "typescript/no-explicit-any": "off", |
| 85 | + "typescript/explicit-function-return-type": "off" |
| 86 | + } |
| 87 | + }, |
| 88 | + { |
| 89 | + "files": [ |
| 90 | + "**/*.test.ts", |
| 91 | + "**/*.test.tsx", |
| 92 | + "**/*.test.js", |
| 93 | + "**/*.test.jsx", |
| 94 | + "test/**/*.ts", |
| 95 | + "test/**/*.js" |
| 96 | + ], |
| 97 | + "rules": { |
| 98 | + "typescript/explicit-function-return-type": "off", |
| 99 | + "typescript/no-empty-function": "off", |
| 100 | + "typescript/no-explicit-any": "off", |
| 101 | + "typescript/no-unsafe-member-access": "off", |
| 102 | + "typescript/no-floating-promises": "off", |
| 103 | + "typescript/no-non-null-assertion": "off", |
| 104 | + "typescript/unbound-method": "off", |
| 105 | + "no-unused-expressions": "off", |
| 106 | + "typescript/no-unused-expressions": "off", |
| 107 | + "max-lines": "off", |
| 108 | + "complexity": "off", |
| 109 | + "import/first": "off", |
| 110 | + "typescript/prefer-optional-chain": "off", |
| 111 | + "typescript/no-misused-spread": "off", |
| 112 | + "sdk/no-focused-tests": "error", |
| 113 | + "sdk/no-skipped-tests": "error" |
| 114 | + } |
| 115 | + }, |
| 116 | + { |
| 117 | + "files": ["**/*.tsx"], |
| 118 | + "rules": { |
| 119 | + "jsdoc/require-jsdoc": "off" |
| 120 | + } |
| 121 | + }, |
| 122 | + { |
| 123 | + "files": ["scripts/*"], |
| 124 | + "rules": { |
| 125 | + "no-console": "off" |
| 126 | + } |
| 127 | + }, |
| 128 | + { |
| 129 | + "files": ["**/src/**"], |
| 130 | + "rules": { |
| 131 | + "no-restricted-globals": ["error", "window", "document", "location", "navigator"], |
| 132 | + // Bundle size isn't a concern for React Native |
| 133 | + "sdk/no-class-field-initializers": "off", |
| 134 | + // TODO: Re-enable once oxlint supports inline disable for jsPlugin rules |
| 135 | + // Only 2 intentional uses exist (debugsymbolicator.ts, sentryMetroSerializer.ts) |
| 136 | + "sdk/no-regexp-constructor": "off" |
| 137 | + } |
| 138 | + } |
| 139 | + ], |
| 140 | + "ignorePatterns": [ |
| 141 | + "dist/**", |
| 142 | + "dangerfile.js", |
| 143 | + "RNSentryAndroidTester/**", |
| 144 | + "test/react-native/versions/**", |
| 145 | + "coverage/**", |
| 146 | + "test/typescript/**", |
| 147 | + "metro.d.ts", |
| 148 | + "plugin/build/**", |
| 149 | + "expo.d.ts", |
| 150 | + "playground.js", |
| 151 | + "playground.d.ts", |
| 152 | + "node_modules/**" |
| 153 | + ] |
| 154 | +} |
0 commit comments