自定义ESLint插件不建议在编辑器中自动修复

问题描述

我创建了一个自定义eslinter插件,该插件警告特定功能的使用。 它正在按预期工作,唯一的问题是我想建议一个自动修复程序,它将用另一个函数替换函数。这是代码

module.exports = {
    rules: {
        'no-registration-type-tealium': {
            create( context ) {
                return {
                    Identifier( node ) {
                        if ( 'CallExpression' === node.parent.type && 'registrationTypetealium' === node.name ) {
                            context.report( {
                                node,message: 'Do not use `registrationTypetealium`,use `loadtealium` instead.',suggest: [
                                    {
                                        desc: 'Replace with `loadtealium`',fix: ( fixer ) => {
                                            return fixer.replaceText( node,'loadtealium' );
                                        },},],} );
                        }
                    },};
            },};

我使用带有建议气泡的VSCode,我试图在此处添加建议,但没有显示出来,我有什么想法要出错吗?

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)