Closed azl397985856 closed 4 years ago
const move = dir => {
if (dir === 'left') {
// move left
}
}
move('leftt') // passing 'leftt' instead of 'left'
Magic string can be evil too. 所以感觉是不是也应该有一个 no-magic-string rule 呢。
至于其他 literal,boolean, undefined, null 都只有一两个值就没必要了,object, array 之类的,也很少会有人这样子用吧。
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
为什么eslint 有一个 rule 是 no-magic-number. 而没有类似的比如 no-magic-string?或者更广泛一点,为什么没有no-magic-literal?