Tri*_* LE 5 typescript reactjs react-native visual-studio-code
我的问题是当我编写vscode自动替换编辑器时,从相对路径到我项目中所有文件的绝对路径自动替换.
例如:当我像这样导入时:
import { login } from '../logic.redux/action'Run Code Online (Sandbox Code Playgroud)
五分钟后(可能是一些操作,如保存或导入另一个文件),它将转换为:
import { login } from '@module/login/logic.redux/action'Run Code Online (Sandbox Code Playgroud)
并且认真地将所有文件覆盖为绝对文件.告诉我,我做错了什么
我的项目包括:Typescript + react-native(项目)
这是我的tsconfig.json
{
"compilerOptions": {
"module": "es6",
"target": "es6",
"lib": ["es6", "dom"],
"sourceMap": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "react-native",
"moduleResolution": "node",
"noEmit": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": false,
"baseUrl": "./src",
"paths": {
"@conf/*": ["./conf/*"],
"@i18n/*": ["./i18n/*"],
"@module/*": ["./module/*"],
"@router/*": ["./router/*"],
"@theme/*": ["./theme/*"],
"@tpl/*": ["./tpl/*"],
"@util/*": ["./util/*"]
}
},
"exclude": ["node_modules"]
}Run Code Online (Sandbox Code Playgroud)
这是我的tslint.json
{
"defaultSeverity": "error",
"extends": [
"tslint-config-airbnb"
],
"jsRules": {},
"rules": {
"indent": [
true,
"tabs", 4
],
"ter-indent": [
false
],
"semicolon": [
true,
"never"
],
"object-literal-sort-keys": false,
"quotemark": [
true,
"single",
"jsx-double"
],
"ordered-imports": true,
"interface-name": [
false
],
"max-line-length": [
true,
140
],
"no-console": [
false
],
"no-empty-interface": false,
"no-var-requires": false,
"import-name": false,
"no-consecutive-blank-lines": [
true,
0
],
"no-increment-decrement": false,
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-pascal-case"
],
"no-unused-variable": false
},
"rulesDirectory": []
}Run Code Online (Sandbox Code Playgroud)
并在vscode中设置用户
{
"workbench.colorTheme": "Bimbo Theme",
"sublimeTextKeymap.promptV3Features": true,
"editor.renderWhitespace": "boundary",
"editor.rulers": [100],
"editor.cursorBlinking": "solid",
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"window.zoomLevel": 0,
"todohighlight.isEnable": true,
"javascript.implicitProjectConfig.experimentalDecorators": true,
"gitlens.advanced.messages": {
"suppressShowKeyBindingsNotice": true
},
"files.autoSave": "off",
"eslint.autoFixOnSave":true,
"tslint.autoFixOnSave": true,
"tslint.configFile": "./tslint.ide.json",
"typescript.updateImportsOnFileMove.enabled": "always",
"javascript.implicitProjectConfig.experimentalDecorators": true,
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.tabSize": 4,
}Run Code Online (Sandbox Code Playgroud)
这里是List扩展名
PeterJausovec.vscode-docker
abotteram.typescript-react-snippets
ajhyndman.jslint
anseki.vscode-color
azemoh.one-monokai
bierner.markdown-preview-github-styles
chenxsan.vscode-standardjs
chong.vscode-typescript-react-redux-snippets
christian-kohler.path-intellisense
cmstead.jsrefactor
Compulim.compulim-vscode-closetag
cssho.vscode-svgviewer
Dart-Code.dart-code
dbaeumer.vscode-eslint
DotJoshJohnson.xml
dracula-theme.theme-dracula
dsznajder.es7-react-js-snippets
eamodio.gitlens
EditorConfig.EditorConfig
eg2.tslint
emmanuelbeziat.vscode-great-icons
esbenp.prettier-vscode
formulahendry.auto-close-tag
formulahendry.auto-complete-tag
formulahendry.auto-rename-tag
HookyQR.beautify
infeng.vscode-react-typescript
jundat95.react-native-snippet
karyfoundation.comment
kevinkyang.auto-comment-blocks
mgmcdermott.vscode-language-babel
miclo.sort-typescript-imports
mohsen1.prettify-json
monokai.theme-monokai-pro-vscode
ms-python.python
ms-vscode.node-debug2
ms-vscode.sublime-keybindings
naumovs.color-highlight
patrys.vscode-code-outline
pawelgrzybek.bimbo-theme
pmneo.tsimporter
pnp.polacode
richie5um2.vscode-sort-json
santosh.react-native-snippet
shd101wyy.markdown-preview-enhanced
stevencl.addDocComments
teabyii.ayu
vsmobile.vscode-react-native
waderyan.gitblame
wayou.vscode-todo-highlight
wix.vscode-import-cost
xabikos.JavaScriptSnippets
yzhang.markdown-all-in-one
zengxingxin.sort-js-object-keysRun Code Online (Sandbox Code Playgroud)
打开vscode用户设置:File -> Preferences -> Settings
放"javascript.updateImportsOnFileMove.enabled": "prompt",
prompt每次重命名
always更新路径时都会自动
never重命名路径并且不提示我
你的可能已经设置为always
| 归档时间: |
|
| 查看次数: |
2130 次 |
| 最近记录: |