一、配置setting.json
1 2 3 |
"editor.codeActionsOnSave": { "source.organizeImports": "always" } |
二、安装插件并配置.eslintrc
1 2 3 4 5 6 7 8 9 10 |
npm install --save-dev eslint-plugin-simple-import-sort module.exports = { // ... 其他配置 plugins: ['simple-import-sort'], rules: { 'simple-import-sort/imports': 'error', 'simple-import-sort/exports': 'error', }, }; |