Description
The plugin is relying on the old version of the eslint config to check whether the code is using esmodules or commonjs.
const isModule = context.parserOptions.sourceType === 'module';
should be something like
const isModule = context.parserOptions.sourceType === 'module' || context.languageOptions.sourceType === 'module';
There doesn't seem to be an easy workaround for this, as the old structure is invalid in the new version of eslint. (ie I can't just add parserOptions.sourceType
to my config. eslint won't run if I do).
There also seems to be an issue with imports being inserted inline. If I change the plugin code to use the new version of the config, so it uses esmodule imports, I end up with a few cases similar to this:
<Form onSubmit={import { describe, expect, it, jest } from '@jest/globals';jest.fn()}>{({formProps}) => <form {...formProps}>{children}</form>}</Form>
where the import is inserted directly where it's used, rather than at the top of the file.