# code style **Repository Path**: shylockKai/code-style ## Basic Information - **Project Name**: code style - **Description**: vscode,Eslint,Prettier,vue 配合编辑器保存代码自动修复 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-11-09 - **Last Updated**: 2023-03-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: Vue, CSS, JavaScript ## README # Vue 3 + Vite # 第一种方式(推荐) ## 编辑器配置 `.vscode`文件中添加`settings.json`文件适配VsCode编辑器 ```json { "prettier.enable": false, "editor.formatOnSave": false, "editor.codeActionsOnSave": { "source.fixAll.eslint": true } } ``` ## 安装 ```shell yarn add -D eslint @antfu/eslint-config # or npm i -D eslint @antfu/eslint-config ``` ## 配置 `.eslintrc` ```js { extends: ["@antfu"] } ``` # Add script for package.json For example: ```json { "scripts": { "lint": "eslint .", "lint:fix": "eslint . --fix" } } ``` ## TypeScript Aware Rules Type aware rules are enabled when a `tsconfig.eslint.json` is found in the project root, which will introduce some stricter rules into your project. If you want to enable it while have no `tsconfig.eslint.json` in the project root, you can change tsconfig name by modifying `ESLINT_TSCONFIG` env. ```js // .eslintrc.js process.env.ESLINT_TSCONFIG = 'tsconfig.json' module.exports = { extends: '@antfu' } ``` >请参考 https://github.com/antfu/eslint-config # 第二种方式 This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `