Skip to content

Commit cb7fbb8

Browse files
fix: eslint 9.27.0 support
1 parent 4084756 commit cb7fbb8

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/verifyWithFlatConfigPatch.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,12 @@ function createVerifyWithFlatConfigPatch(eslintModule, verifyWithFlatConfig) {
7979
const localMessages = verifyWithFlatConfig.call(
8080
this,
8181
sourceCodes.get(codePart) || String(codePart),
82-
{
83-
...providedConfig,
84-
rules: Object.assign(
85-
{ [`${PREPARE_PLUGIN_NAME}/${PREPARE_RULE_NAME}`]: "error" },
86-
!ignoreRules && providedConfig.rules
87-
),
88-
},
82+
createNewConfig(providedConfig, {
83+
rules: {
84+
[`${PREPARE_PLUGIN_NAME}/${PREPARE_RULE_NAME}`]: "error",
85+
...(!ignoreRules && providedConfig.rules),
86+
},
87+
}),
8988
ignoreRules
9089
? {
9190
...providedOptions,
@@ -160,13 +159,20 @@ function verifyExternalHtmlPlugin(eslintModule, config, callOriginalVerify) {
160159

161160
return [
162161
callOriginalVerify(),
163-
{
164-
...config,
162+
createNewConfig(config, {
165163
languageOptions: {
166164
...config.languageOptions,
167165
parser: eslintModule.require("espree"),
168166
},
169167
rules,
170-
},
168+
}),
171169
]
172170
}
171+
172+
/**
173+
* Creates a clone of the provided config object so it can be modified without affecting the
174+
* original.
175+
*/
176+
function createNewConfig(originalConfig, overrides) {
177+
return Object.setPrototypeOf(overrides, originalConfig)
178+
}

0 commit comments

Comments
 (0)