commitizen prettier eslint husky
ts 文件 eslint - disable no-var
什么是ESLint? - 知乎 (zhihu.com) ESLint 是 JavaScript 代码检查工具。 它可以配和 VS Code 的 ESLint 插件来提示代并修复码格式错误,也可以在命令行使用,比如执行 eslint. --fix 来检查并修复代码格式。 ESLint 也可通过插件来配 ......
vue报错:You may use special comments to disable some warnings. Use // eslint-disable-next-line to ignore the next line. Use /* eslint-disable */ to ignore all warnings in a file.
报错信息: 解决方法: ESLint 语法错误,那就取消ESLint验证规则 然后重启即可 ......
prettier 格式化 html 标签换行
在项目根目录下创建文件:.prettierrc 输入一下内容: 保存即可 { "htmlWhitespaceSensitivity": "ignore" } ......
从仓库的角度使用 Eslint 跟 Prettier
去年,anfu 谈论了他对 Prettier 跟 Eslint 的看法-为什么我不使用 Prettier,同样在那个时候,VUECONF 2022 也分享了关于对前端项目 linter 跟 formatter 的实践- Vue 项目配置:最佳实践与个人偏见,彼时,这些经验与分享让我重新审视这些代码规 ......
vue3+ts项目引入eslint和prettier
创建项目 // uniapp npm install -g @dcloudio/uni-cli npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project // vue3npm init vite@latest my-project --tem ......
Git — husky + eslint 实现提交前校验与规范提交
node版本: = 14.21.3 || >16.0.0 一、配置ESlint 1.1 安装eslint npm install eslint -D 1.2 初始化eslint,生成配置文件 npx eslint --init 1.3 在编辑器安装ESlint插件 1.4 通过执行命令检测文件代码规 ......
git hook 和 Husky工具
git hook 背景 git : 除了作为版本控制之外,还能执行自定义操作 git hook , 它存在于.git 文件夹下的hook文件夹,里面有很多以.sample结尾的demo文件,要执行它,只需要把文件名后面的的sample删了。 应用场景: (1)实现自动编译 (2)自动删除仓库中的编译 ......
Teamcenter AWC开发报错 ESLintError in plugin "gulp-eslint"
1、npm run refresh 没有报错,npm run build会报错 ✖ 34 problems (1 error, 33 warnings) 0 errors and 12 warnings potentially fixable with the `--fix` option. [08 ......
vscode ESlint configuration
.eslintrc.yml root: true globals: APP_ENV: true extends: - eslint:recommended - plugin:react/recommended - plugin:react-hooks/recommended env: browser ......
vscode自动保存设置为afterDelay后prettier不生效
"files.autoSave": "afterDelay" "editor.formatOnSave": true 这两个配置不能一起使用 解决方法: 1.将"afterDelay"修改为“onFocusChange" 2.设置成onFocusChange或者onWindowChange 3.关闭 ......
解决:Expected 1 line break before closing bracket, but no line breaks found.eslint
运行时报错以下 解决 在eslintrc.js rules下添加以下代码 'vue/singleline-html-element-content-newline': 'off', 'vue/multiline-html-element-content-newline': 'off', ......
Delete'cr'[prettier / prettier] 运行项目报错error Replace `xxx` with `··xxx·` prettier/prettier 解决办法
问题:在运行项目时报错 原因: linux系统和Windows系统换行符不一致,要根据实际情况切换LF或CRLF,如果不想每个页面切换,可用以下方法 解决: 在eslintrc.js文件的rules中添加 "prettier/prettier": "off" 也可参照这个网址 https://www ......
Eslint 的rules一些配置 (.eslintrc.js文件中的rules选项)
rules: { // off=0, warn=1, error=2, 如果是数组, 第二项表示参数option // indent: [2, 2], // 控制缩进为2 eqeqeq: 1, // 警告使用全等 // quotes: [2, 'single'], //单引号 singleQuote ......
husky 源码浅析
前言 我们在上一篇中讲了 自定义 Git Hook, 那么前端同学有没有对 husky 的工作原理产生好奇呢,为什么 husky 可以让 git 执行他指定目录下的 hooks 目录呢? 我们这一篇文章就带大家通过源码分析一下 husky 的工作原理,同时基于 husky 源码我们拓展讲一下如何使用 ......
【最新最全指南】Vue项目安装eslint配置说明
本指南都适配windows和mac下的开发项目 第一步:安装 1、全局安装:eslint (最好全局安装1个,配置出错debug方便) npm install eslint -g 2、项目本地dev安装:eslint(也可不安装,后面安装eslint-plugin-vue时候,默认会一起安装esli ......
panjiachen的vue-admin-template中关闭eslint
由于有语法检查,所以我想关闭eslint 低版本: 在conf/index.js中将 useEslint改为 flase 高版本: 在.eslintrc.js中有rules,这里边都是eslint的校验规则,如果你不想有校验,可以直接将rule括号中的规则都注释掉 ......
配置 husky+lint-staged
官方文档 husky-github husky-doc lint-staged 安装依赖 yarn add husky lint-staged -D 在package.json 中添加一条 preinstall 脚本 { "script":{ "prepare": "husky install" } ......
整合prettierrc 和 eslint 最新
package.json 文件配置 { "name": "webpage", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service b ......
vscode ESLint 配置
vscode 下载 https://code.visualstudio.com/ 插件官网 https://marketplace.visualstudio.com/VSCode vscode 的 setting.json文件配置ESlint { "editor.formatOnSave": tru ......
VSCode ESLint规则警告屏蔽方法
举例:要屏蔽“Missing trailing comma”或“comma-dangle”警告,你可以使用ESLint的配置选项来设置规则。下面是一些方法,你可以根据自己的需求选择其中一种(这里只是举例,其他警告处理方法相同) 方法1:在代码中添加注释来禁用规则 在你希望屏蔽警告的代码行的上方添加如 ......
husky——The '.husky/pre-commit' hook was ignored because it's not set as executable
前言 系统:mac hint: The '.husky/pre-commit' hook was ignored because it's not set as executable. hint: You can disable this warning with `git config advic ......
vue/eslint_vue/no-side-effects-in-computed-properties报错
出现这个错误的缘由是因为我在vue3中的computed中, 把computed的回调函数当做数据监听器处理程序, 在里面修改了ref定义的变量数据的值. const curArticle = computed(() => { if (curArticleList.value.length 0) { ......
Failed to load plugin '@typescript-eslint' declared in '.eslintrc.cjs
项目配置依赖: vue3.3.4 + vite4.4.11 + eslint8.46.0 报错信息 Failed to load plugin '@typescript-eslint' declared in '.eslintrc.cjs » @vue/eslint-config-typescrip ......
prettier 与 stylelint 冲突之 Delete `;` eslint(prettier/prettier)
1、报错 2、解决方案 .stylelintrc.js文件中配置declaration-block-trailing-semicolon, 将stylelint该条规则关闭。 { + 'declaration-block-trailing-semicolon': null } ......
使用脚本整合指定文件/文件夹,执行定制化 ESLint 命令
描述了如何通过自定义脚本简化 ESLint 命令的执行。该脚本支持指定文件或文件夹,指定 ESLint 配置文件,附带命令,以及前后置执行命令等功能,极大地提高了代码检查和格式化的效率。 ......
eslint$prettier 记录
module.exports = { // eslint 配置 eslintJSON: { root: true, // 当前配置为根配置,将不再从上级文件夹查找配置 parserOptions: { parser: 'babel-eslint', // 采用 babel-eslint 作为语法解析 ......
eslint提示 xxx should be listed in the project's dependencies
有时候手动安装了一个npm包A,npm包A里面包含了npm包B,这时候如果 import xxx from 'npm包B'; eslint会报错,提示 npm包B 不在 package.json 里面 解决方法:在 eslintrc.js 增加配置 module.exports = { rules: ......
eslint识别不了别名解决方法
第一步 npm i eslint-import-resolver-alias -D 第二步:在 eslintrc.js 配置 module.exports = { settings: { 'import/resolver': { alias: { map: [ // 这里参照webpack的别名配置 ......
vscode 上无法 prettier 加载配置文件失败的问题
先说结论: 1. prettier 的配置文件有几种格式,先按照官方文档 配置好 2. 如果想按住 Ctrl + Alt + L 格式化代码,需要关闭 vscode 中的 formatOnSave 3. 每次修改完设置需要重启 vscode,这里重启的正确步骤:File -> Close Folde ......