@@ -12510,6 +12510,48 @@ describe("Linter with FlatConfigArray", () => {
1251012510
1251112511 describe("when evaluating code containing /*global */ and /*globals */ blocks", () => {
1251212512
12513+ /**
12514+ * Asserts the global variables in the provided code using the specified language options and data.
12515+ * @param {string} code The code to verify.
12516+ * @param {Object} languageOptions The language options to use.
12517+ * @param {Object} [data={}] Additional data for the assertion.
12518+ * @returns {void}
12519+ */
12520+ function assertGlobalVariable(code, languageOptions, data = {}) {
12521+ let spy;
12522+
12523+ const config = {
12524+ plugins: {
12525+ test: {
12526+ rules: {
12527+ checker: {
12528+ create(context) {
12529+ spy = sinon.spy(node => {
12530+ const scope = context.sourceCode.getScope(node);
12531+ const g = getVariable(scope, data.name);
12532+
12533+ assert.strictEqual(g.name, data.name);
12534+ assert.strictEqual(g.writeable, data.writeable);
12535+ });
12536+
12537+ return { Program: spy };
12538+ }
12539+ }
12540+ }
12541+ }
12542+ },
12543+ rules: { "test/checker": "error" }
12544+ };
12545+
12546+ if (languageOptions !== void 0) {
12547+ config.languageOptions = languageOptions;
12548+ }
12549+
12550+ linter.verify(code, config);
12551+ assert(spy && spy.calledOnce);
12552+
12553+ }
12554+
1251312555 it("variables should be available in global scope", () => {
1251412556 const code = `
1251512557 /*global a b:true c:false d:readable e:writeable Math:off */
@@ -12570,6 +12612,15 @@ describe("Linter with FlatConfigArray", () => {
1257012612 linter.verify(code, config);
1257112613 assert(spy && spy.calledOnce);
1257212614 });
12615+
12616+ // https://github.com/eslint/eslint/issues/18363
12617+ it("not throw when defining a global named __defineSetter__", () => {
12618+ assertGlobalVariable("/*global __defineSetter__ */", {}, { name: "__defineSetter__", writeable: false });
12619+ assertGlobalVariable("/*global __defineSetter__ */", void 0, { name: "__defineSetter__", writeable: false });
12620+ assertGlobalVariable("/*global __defineSetter__ */", { globals: { __defineSetter__: "off" } }, { name: "__defineSetter__", writeable: false });
12621+ assertGlobalVariable("/*global __defineSetter__ */", { globals: { __defineSetter__: "writeable" } }, { name: "__defineSetter__", writeable: false });
12622+ assertGlobalVariable("/*global __defineSetter__:writeable */", {}, { name: "__defineSetter__", writeable: true });
12623+ });
1257312624 });
1257412625
1257512626 describe("when evaluating code containing a /*global */ block with sloppy whitespace", () => {