Repository: eslint/eslint
File: lib/config/flat-config-schema.js (JavaScript)

Code before:
/**
 * @fileoverview Flat config schema
 * @author Nicholas C. Zakas
 */

"use strict";

//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------

/*
 * Note: This can be removed in ESLint v9 because structuredClone is available globally
 * starting in Node.js v17.
 */
const { default: structuredClone } = require("@ungap/structured-clone");

//-----------------------------------------------------------------------------
// Type Definitions
//-----------------------------------------------------------------------------

/**
 * @typedef ObjectPropertySchema
 * @property {Function|string} merge The function or name of the function to call
 *      to merge multiple objects with this property.
 * @property {Function|string} validate The function or name of the function to call
 *      to validate the value of this property.
 */

//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------

const ruleSeverities = new Map([
    [0, 0], ["off", 0],
    [1, 1], ["warn", 1],
    [2, 2], ["error", 2]
]);

const globalVariablesValues = new Set([
    true, "true", "writable", "writeable",

Review comment (suggestion):
Looks like this causes problems for wdio, this is an error we're getting on CI browser test:

```
Error in "Linter with FlatConfigArray.verify().Rule Severity.rule should run as warning when set to 1 with a config array"
Error: Key "rules": Key "semi": structuredClone is not a function
    at http://localhost:40387/node_modules/@humanwhocodes/object-schema/src/object-schema.js:281:27
    at Array.reduce (<anonymous>)
    at _ObjectSchema.merge (http://localhost:40387/node_modules/@humanwhocodes/object-schema/src/object-schema.js:268:24)
    at http://localhost:40387/node_modules/@humanwhocodes/config-array/api.js:966:42
    at Array.reduce (<anonymous>)
    at FlatConfigArray.getConfig (http://localhost:40387/node_modules/@humanwhocodes/config-array/api.js:965:39)
    at Linter._verifyWithFlatConfigArray (http://localhost:40387/build/eslint.js:2:61[45](https://github.com/eslint/eslint/actions/runs/6577334057/job/17871071555#step:5:46)5)
    at Linter.verify (http://localhost:40387/build/eslint.js:2:56041)
    at Context.call (http://localhost:40387/home/runner/work/eslint/eslint/tests/lib/linter/linter.js:12136:41)
```

I'm getting the same errors locally, but it works (at least for me locally) when switched to this form:

```suggestion
const structuredClone = require("@ungap/structured-clone").default;
```



Code after:
/**
 * @fileoverview Flat config schema
 * @author Nicholas C. Zakas
 */

"use strict";

//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------

/*
 * Note: This can be removed in ESLint v9 because structuredClone is available globally
 * starting in Node.js v17.
 */
const structuredClone = require("@ungap/structured-clone").default;

//-----------------------------------------------------------------------------
// Type Definitions
//-----------------------------------------------------------------------------

/**
 * @typedef ObjectPropertySchema
 * @property {Function|string} merge The function or name of the function to call
 *      to merge multiple objects with this property.
 * @property {Function|string} validate The function or name of the function to call
 *      to validate the value of this property.
 */

//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------

const ruleSeverities = new Map([
    [0, 0], ["off", 0],
    [1, 1], ["warn", 1],
    [2, 2], ["error", 2]
]);

const globalVariablesValues = new Set([
    true, "true", "writable", "writeable",