Closed ehmicky closed 1 month ago
The problem is that fp/no-mutating-methods
specifies schema
as a top-level property instead of a property of the meta
object:
Top-level schema
property in object-style rules was never officially supported, I believe, but was working in ESLint v8 by chance because it was picked up by code that was supposed to handle schema
property of function-style rules.
I think we could update @eslint/compat
to copy top-level schema
into meta.schema
. @nzakas what do you think?
I think we could update
@eslint/compat
to copy top-levelschema
intometa.schema
. @nzakas what do you think?
That seems like the easiest solution to me. :+1:
I can work on this.
Thanks @mdjermanovic!
I was having the same problem with eslint-plugin-filenames
, and it turns out it also incorrectly sets module.exports.schema
.
I am not familiar with old plugins, but eslint-plugin-filenames
seems quite different:
create
function directly, instead of an object with a create
functionmeta
propertyschema
property, even when the rule has some options@ehmicky yes, that was the original format of rules that we deprecated and removed in v9.
Which packages are affected?
@eslint/compat
@eslint/config-array
@eslint/core
@eslint/migrate-config
@eslint/object-schema
@eslint/plugin-kit
Environment
Node version: 23.1.0 npm version: 10.9.0 ESLint version: 9.13.0 Operating System: Ubuntu 24.04
What did you do?
What did you expect to happen?
The
fixupPluginRules()
from@eslint/compat
should fix thefp/no-mutating-methods
rule.What actually happened?
It crashed it instead.
Link to Minimal Reproducible Example
https://github.com/ehmicky/eslint-rewrite-bug
Participation
Additional comments
eslint-plugin-fp
is unmaintained, so I cannot expect an upgrade to ESLint 9, and need to rely on@eslint/compat
instead.However, their rule seems to be correct: https://github.com/jfmengels/eslint-plugin-fp/blob/205861e874a4db8caedfbe2cc8af599d8d45b475/rules/no-mutating-methods.js#L70-L80. The above configuration worked fine with ESLint 8.
Please note that: