1 | import fs from 'fs' |
||
2 | |||
3 | const mkdirSync = function mkdirSync(path) { |
||
0 ignored issues
–
show
|
|||
4 | try { |
||
5 | fs.mkdirSync(path) |
||
6 | } catch (e) { |
||
7 | if (e.code !== 'EEXIST') { |
||
8 | throw e |
||
9 | } |
||
10 | } |
||
11 | } |
||
12 | |||
13 | export default mkdirSync |
This check looks for variables that are declared in multiple lines. There may be several reasons for this.
In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.
If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.