各种工具安装

彻底卸载禁用snap #

sudo vim /etc/apt/preferences.d/nosnap.pref
https://www.cnblogs.com/learner-and-helper-YZY/p/17654961.html

oh-my-zsh #

sudo apt install zsh -y
sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

git #

  • 配置github用户
git config --global user.name "youname"
git config --global user.email "youname@qq.com"
  • 配置ssh key
ssh-keygen -m PEM -t ed25519 -C "yourname@qq.com"
# id_ed25519.pub内容 粘贴到远端github的setting->SSH and GPG keys下
ssh -T git@github.com
  • 配置github和公司仓库地址
cd ~/.ssh && vim config
Host github.com
        Hostname github.com
        Port 22
        User git
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/id_github

Host e.coding.net
        Hostname e.coding.net
        Port 22
        User git
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/id_ed25519

node npm pnpm #

# 安装nvm,重启终端
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm ls-remote
nvm install v20.10.0
nvm use v20.10.0
npm install -g pnpm

npm源管理 #

npm install -g nrm open@8.4.2 --save
nrm use cnpm

eslint #

# 项目目录下
pnpm i eslint eslint-plugin-vue@latest @typescript-eslint/parser@latest @typescript-eslint/eslint-plugin@latest -D
  • vscode安装eslint插件的配置
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "vue",
        "typescript"
    ],
    "eslint.format.enable": true,
    "editor.codeActionsOnSave": {
        "source.fixAll": true,
        "eslint.autoFixOnSave": true,
    },
  • .eslintrc.js(根目录下创建)
module.exports = {
	parser: 'vue-eslint-parser',
	parserOptions: {
		parser: '@typescript-eslint/parser',
		ecmaVersion: 2020
	},
	extends: [
		'plugin:vue/vue3-recommended',
		'plugin:@typescript-eslint/recommended'
	],
	rules: {
		quotes: ['error', 'single', { 'allowTemplateLiterals': true }],// 强制使用一致的反勾号、双引号或单引号
		eqeqeq: 'off', // 要求使用 === 和 !==
		semi: ['error', 'never'], // 要求或禁止使用分号代替 ASI
		'max-len': ['error', 240], // 强制一行的最大长度
		'eol-last': 'off', // 要求或禁止文件末尾存在空行
		'no-shadow': 'off', // 禁止变量声明与外层作用域的变量同名
		'import/no-cycle': 'off', // 禁止一个模块导入一个有依赖路径的模块回到自己身上
		'arrow-parens': 'off', // 要求箭头函数的参数使用圆括号
		'no-use-before-define': 'off', // 禁止在变量定义之前使用它们,则倾向于默认输出
		'prefer-const': 'warn', // 要求使用 const 声明那些声明后不再被修改的变量
		'global-require': 'off', // 要求 require() 出现在顶层模块作用域中
		'one-var-declaration-per-line': 'off', // 要求或禁止在变量声明周围换行
		'one-var': 'off', // 强制函数中的变量要么一起声明要么分开声明
		'object-curly-newline': 'off', // 强制大括号内换行符的一致性
		'default-case': 'off', // 要求 switch 语句中有 default 分支
		'no-trailing-spaces': 'off', // 禁用行尾空格
		'no-multi-spaces': 2,
		'no-unused-expressions': 'off', // 禁止出现未使用过的表达式
		'no-underscore-dangle': 'off', // 禁止标识符中有悬空下划线
		'no-await-in-loop': 'off', // 禁止在循环中出现 await
		'import/no-unresolved': 'off', // 确保导入指向一个可以解析的文件/模块
		'space-before-function-paren': 'off',
		'comma-dangle': ['error', 'never'],// 要求或禁止末尾逗号
		'@typescript-eslint/ban-ts-ignore': 'off',
		'@typescript-eslint/explicit-function-return-type': 'off',
		'@typescript-eslint/no-explicit-any': 'off',
		'@typescript-eslint/no-var-requires': 'off',
		'@typescript-eslint/no-empty-function': 'off',
		'vue/custom-event-name-casing': 'off',
		'no-use-before-define': 'off',
		'@typescript-eslint/no-use-before-define': 'off',
		'@typescript-eslint/ban-ts-comment': 'off',
		'@typescript-eslint/ban-types': 'off',
		'@typescript-eslint/no-non-null-assertion': 'off',
		'@typescript-eslint/explicit-module-boundary-types': 'off',
		'@typescript-eslint/no-unused-vars': [
			'error',
			{
				argsIgnorePattern: '^h$',
				varsIgnorePattern: '^h$'
			}
		],
		'vue/max-attributes-per-line': ['error', {
			'singleline': {
				'max': 5
			},
			'multiline': {
				'max': 5
			}
		}],
		'vue/first-attribute-linebreak': ['error', {
			'singleline': 'beside',
			'multiline': 'beside'
		}],
		'vue/html-closing-bracket-newline': ['error', {
			'singleline': 'never',
			'multiline': 'never'
		}],
		'vue/multi-word-component-names': 0, //开启 关闭驼峰命名规则
		'no-multiple-empty-lines': [2, {
			max: 1
		}]

	}
}
  • .eslintignore(忽略扫描)
build/*.js
src/assets
public
dist
node_modules
README.md

docker docker-compose #

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
sudo mkdir -p /etc/docker
sudo vim /etc/docker/daemon.json

{
 "registry-mirrors": ["https://registry.docker-cn.com"],
 "iptables": false
}

sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker

wsl2高级配置 #

  • win11用户下新建.wslconfig
[wsl2]
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

[experimental]
sparseVhd=true
autoMemoryReclaim=dropcache

go #

wget https://golang.google.cn/dl/go1.20.3.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.3.linux-amd64.tar.gz

# vim ~/.zshrc
export GOPATH=/home/xiaohu/gopath
export GOBIN=/home/xiaohu/gopath/bin
export PATH=$PATH:$GOBIN:/usr/local/go/bin
export GOROOT=/usr/local/go
export GOPROXY=https://goproxy.io,direct
export GO111MODULE=on

# 重启终端
go env

vscode通用配置 #

{
    //通用
    "editor.fontSize": 17, //字体大小
    "editor.tabSize": 4, //缩进
    "editor.insertSpaces": false, //使用tab缩进
    "editor.formatOnSave": true, //是否保存前格式化
    "files.autoSave": "afterDelay", //文件自动保存
    "editor.formatOnPaste": true, //粘贴自动格式化
    "files.trimTrailingWhitespace": true, //保存时是否删除行尾空格
    "editor.copyWithSyntaxHighlighting": false, //复制代码是否携带语法高亮
    "window.zoomLevel": -1, //terminal tabs样式
    "editor.rulers": [ //标尺
        120
    ],
    "workbench.colorTheme": "GitHub Dark", //theme
    "workbench.iconTheme": "vscode-icons", //文件图标
    "workbench.colorCustomizations": { //颜色覆盖
        "editorRuler.foreground": "#08fc31",
    },
    //go
    "[go]": {
        "editor.wordWrap": "on", //折行
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        },
    },
    "go.testFlags": [
        "-gcflags=all=-l",
        "-v"
    ],
    "go.alternateTools": {
        "go.inferGopath": true,
        "go.autocompleteUnimportedPackages": true,
        "go.gocodePackageLookupMode": "go",
        "go.gotoSymbol.includeImports": true,
        "go.useCodeSnippetsOnFunctionSuggest": true,
        "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
        "go.docsTool": "gogetdoc",
    },
    "go.useLanguageServer": true,
    "go.formatTool": "goimports",
    //vue
    "javascript.updateImportsOnFileMove.enabled": "always",
    "typescript.updateImportsOnFileMove.enabled": "always",
    //highlight
    "highlight-matching-tag.styles": {
        "opening": {
            "full": {
                "custom": {
                    "borderWidth": "1px",
                    "borderStyle": "solid",
                    "borderColor": "red",
                    "borderRadius": "5px"
                }
            }
        }
    },
    //gitlens
    "gitlens.defaultDateFormat": "YYYY-MM-DD HH:mm:ss",
    //tabnine
    "tabnine.experimentalAutoImports": true,
    "vsicons.dontShowNewVersionMessage": true,
    "git.confirmSync": false,
    //eslint
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "vue",
        "typescript"
    ],
    "eslint.format.enable": true,
    "editor.codeActionsOnSave": {
        "source.fixAll": true,
        "eslint.autoFixOnSave": true,
    },
}