amatiasq / amatiasq/vsc-sort-imports
Vue SFC only work with TypeScript parser (and babel-vue), and also abnormally
- Ngôn ngữ chính
- TypeScript
- Star
- 59
- Fork
- 20
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
## Versions
macOS Catalina 10.15.6
VSCode version
- 1.49.0
- e790b931385d72cf5669fcefc51cdf65990efa5d
- x64
`amatiasq.sort-imports` version v6.2.2
## Current results
The sorting result looks like this.
```vue
import Vue from 'vue'
import HelloWorld from './components/HelloWorld.vue'
export default Vue.extend({
```
Why the space below `<script>` tag?
- Seems to be Vetur's problem -- https://github.com/vuejs/vetur/issues/730
## Other attempts
Currently `package.json` needs this.
```json
{
"devDependencies": {
"import-sort-parser-typescript": "^6.0.0"
},
"importSort": {
".js, .jsx, .ts, .tsx, .vue": {
"parser": "typescript",
"style": "module"
}
}
}
```
`import-sort-parser-babel-vue` and `parser: "babel-vue"` also works.
#### No parser
```json
{
"importSort": {
".js, .jsx, .ts, .tsx, .vue": {
"style": "module"
}
}
}
```
- Cannot read property 'parseImports' of undefined
#### `"parser": "babylon"`
- Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment `<>...</>`
- Installing `import-sort-parser-babylon` does not change nor solve the problem.
## Suggestions, if possible
- Global settings, without `package.json`, in `settings.json`, for `"parser": "babel-vue"`
Perhaps it should be something like this (in `settings.json`).
- Not sure why `.jsx, .tsx, .mjs, .es, .es6` not included by default
- `default-parser` is not a valid option
- `"sort-imports.default-sort-style": "module"` in `settings.json` is useless. It doesn't change sorting style from `eslint` to `module` at all.
```json
{
"sort-imports.languages": [
"javascriptreact",
"typescriptreact",
"vue",
"javascript",
"typescript"
],
"sort-imports.default-sort-style": "module",
"sort-imports.default-parser": "babel-vue",
}
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.