* @param {CompilerNode} node
(node)
| 138 | * @param {CompilerNode} node |
| 139 | */ |
| 140 | VariableDeclarator(node) { |
| 141 | if (!shouldBeDestructure(node)) { |
| 142 | return; |
| 143 | } |
| 144 | |
| 145 | const {init} = node; |
| 146 | if (context.getCommentsInside(node).length > 0) { |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | context.report({ |
| 151 | node, |
| 152 | message: 'Use object destructuring', |
| 153 | fix(fixer) { |
| 154 | const sourceCode = context.getSourceCode(); |
| 155 | const {object, property} = init; |
| 156 | const {name} = property; |
| 157 | const base = sourceCode.getText(object); |
| 158 | return fixer.replaceText(node, `{${name}} = ${base}`); |
| 159 | }, |
| 160 | }); |
| 161 | }, |
| 162 | |
| 163 | /** |
| 164 | * @param {CompilerNode} node |
nothing calls this directly
no test coverage detected