Javascript 自定义ESLint插件不支持';不建议在编辑器中自动修复
我创建了一个定制的eslinter插件,它警告特定函数的使用。 它正在按预期工作,唯一的问题是我想建议一个自动修复,它将用另一个函数替换该函数。代码如下:Javascript 自定义ESLint插件不支持';不建议在编辑器中自动修复,javascript,eslint,lint,Javascript,Eslint,Lint,我创建了一个定制的eslinter插件,它警告特定函数的使用。 它正在按预期工作,唯一的问题是我想建议一个自动修复,它将用另一个函数替换该函数。代码如下: module.exports = { rules: { 'no-registration-type-tealium': { create( context ) { return { Identifier( node ) {
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有这个建议泡泡,我试图在这里添加建议,但它没有出现,有什么想法我会出错吗