| 175 | // --------------------------------------------------------------------------- |
| 176 | // Checks if the module uses mixins or accesses deprecated APIs. |
| 177 | const checkDeprecatedAPICalls = classPath => |
| 178 | DEPRECATED_APIS.reduce( |
| 179 | (acc, name) => |
| 180 | acc + j(classPath) |
| 181 | .find(j.Identifier, {name}) |
| 182 | .filter(path => { |
| 183 | // Do not consider history.replaceState() deprecated |
| 184 | let correctContext = true; |
| 185 | |
| 186 | if ( |
| 187 | name === 'replaceState' && |
| 188 | path.parentPath && |
| 189 | path.parentPath.value && |
| 190 | path.parentPath.value.object && |
| 191 | path.parentPath.value.object.name && |
| 192 | path.parentPath.value.object.name === 'history' |
| 193 | ) { |
| 194 | correctContext = false; |
| 195 | } |
| 196 | |
| 197 | return correctContext; |
| 198 | }) |
| 199 | .size(), |
| 200 | 0 |
| 201 | ) > 0; |
| 202 | |
| 203 | const hasNoCallsToDeprecatedAPIs = classPath => { |
| 204 | if (checkDeprecatedAPICalls(classPath)) { |
no outgoing calls
no test coverage detected
searching dependent graphs…