eslint-plugin
                                
                                 eslint-plugin copied to clipboard
                                
                                    eslint-plugin copied to clipboard
                            
                            
                            
                        no-unused-expressions
文档:https://eslint.org/docs/rules/no-unused-expressions
直接移除 node。
但如果子节点中包含 MemberExpression,则不修复。因为会有以下情况:
var obj = Object.defineProperty({}, 'prop', {
  get() { /* 产生副作用 */ }
})
obj.prop
当然也不排除这个 fix 过于激进,所以也可以考虑不实现这个 fix。
严格来说,全局变量也有这种情况(比较少见):
var obj = Object.defineProperty(window, 'prop', {
  get() { /* 产生副作用 */ }
});
prop; // window.prop
那就考虑采用「白名单」的方式,例如只修复 BinaryExpression 等。
一般get函数是没有副作用的,所以移除掉的话也算合理。
what if cb && cb();?
The hasSideEffect function will be improved in the future to detect more cases.
Once the improvement completed, some rules besides no-unused-expressions can be done.