`eslint config` { ... "rules": { "react/self-closing-comp": "error" } } `vscode settings` { ... "eslint.autoFixOnSave": true, "eslint.run": "onSave" } 参考:[StackOverflow](https://link.segmentfault.com/?enc=GLzjzzPxMDit3nvOwAmsmQ%3D%3D.c5ulytL2SUzSgqxiSgUTl9pH%2B7E81CTtXw7kXh9J5DVYwmk%2FV55SRaBYXgdCxmdH)