From 38337b591621e7ab2287c30b520e59abf4b411a1 Mon Sep 17 00:00:00 2001 From: Todd Schiller Date: Mon, 22 Jun 2026 07:34:16 -0400 Subject: [PATCH] Ratchet unicorn/no-global-object-property-assignment to error (off in tests) Fourth ratchet from #279. All flagged sites were in test files, which legitimately assign onto globals to install mocks. Rather than keep the rule a blanket warning, enforce it as error for production code and disable it only in the test-files override block. - eslint.config.js: drop from the warn list (reverts to recommended error); add "off" to the `src/**/__tests__/**` block. No production code currently violates it (verified, including the __test-mocks__ tree, which the rule doesn't flag). Refs #279 Co-Authored-By: Claude Opus 4.8 (1M context) --- extension/eslint.config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extension/eslint.config.js b/extension/eslint.config.js index c7c7040..c2df2ba 100644 --- a/extension/eslint.config.js +++ b/extension/eslint.config.js @@ -209,7 +209,9 @@ export default tseslint.config( "unicorn/require-array-sort-compare": "warn", "unicorn/prefer-uint8array-base64": "warn", "unicorn/no-declarations-before-early-exit": "warn", - "unicorn/no-global-object-property-assignment": "warn", + // no-global-object-property-assignment stays at its recommended `error` + // for production code; it's disabled only for tests (which legitimately + // assign globals to set up mocks) in the test-files block below. "unicorn/prefer-minimal-ternary": "warn", "unicorn/prefer-iterator-to-array": "warn", "unicorn/no-incorrect-query-selector": "warn", @@ -251,6 +253,9 @@ export default tseslint.config( // Tests legitimately use literal nulls and many small `for` loops. "unicorn/no-useless-undefined": "off", "unicorn/consistent-function-scoping": "off", + // Tests assign onto global objects to install mocks / stubs; the rule + // stays an error everywhere else. + "unicorn/no-global-object-property-assignment": "off", // Jest matchers and mock patterns routinely pass methods by reference. "@typescript-eslint/unbound-method": "off",