加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

reactjs – 如何自动停止将相对路径替换为绝对路径的所有文件

发布时间:2020-12-15 05:04:37 所属栏目:百科 来源:网络整理
导读:我的问题是当我编写vscode自动替换编辑器时,从相对路径到我项目中所有文件的绝对路径自动替换. 例如: 当我像这样导入时: import { login } from '../logic.redux/action' 五分钟后(可能是一些操作,如保存或导入另一个文件),它将转换为: import { login }
我的问题是当我编写vscode自动替换编辑器时,从相对路径到我项目中所有文件的绝对路径自动替换.

例如:
当我像这样导入时:

import { login } from '../logic.redux/action'

五分钟后(可能是一些操作,如保存或导入另一个文件),它将转换为:

import { login } from '@module/login/logic.redux/action'

并且认真地将所有文件覆盖为绝对文件.告诉我,我做错了什么

我的项目包括: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"]
}

这是我的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": []
}

并在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","editor.detectIndentation": false,"editor.insertSpaces": false,"editor.tabSize": 4,}

这里是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-keys
打开vscode用户设置:文件 – >偏好 – >设置

设置“javascript.updateImportsOnFileMove.enabled”:“提示”,

每次重命名都会提示
始终自动更新路径
永远不要重命名路径,不要提示我

你的可能总是在

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读