推荐 最新
七安前

Insert `..`eslint(prettier/prettier)如何解决?

"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241229/4460f6a047cd61a3cc05bd6d8f699b33.png) 查资料说是配置"prettier.vueIndentScriptAndStyle": true, 但在vscode的设置中配置后依然无效,求解 语言是vue+ts

18
1
0
浏览量272
一颗西兰花

vue3项目中ts这种错误怎么包含进去进行eslint校验?

"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241223/7761d3e2352ef82f3d67205670ab28a5.png) 请问这种类型赋错了怎么加进eslint的校验规则?eslint检查不了这种错误吗?可以看出这个错误是ts抛出的,已经安装了typescript-eslint的包。 根据回答调整的eslint设置,还是不行 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241223/3bbd9a4e05d6785ec0621cc120cf5141.png) "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241223/82fde5dc10512741411db55cebde019f.png)

18
1
0
浏览量216
销售经理537

alloyTeam的eslint规则在vue/cli 5.0.8版本中会报错?

{ "name": "kk", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "core-js": "^3.32.2", "register-service-worker": "^1.7.2", "vue": "^3.3.4", "vue-router": "^4.2.5", "vuex": "^4.1.0" }, "devDependencies": { "@babel/core": "^7.22.20", "@babel/eslint-parser": "^7.22.15", "@typescript-eslint/eslint-plugin": "^6.7.2", "@typescript-eslint/parser": "^6.7.2", "@vue/cli-plugin-babel": "~5.0.8", "@vue/cli-plugin-eslint": "~5.0.8", "@vue/cli-plugin-pwa": "~5.0.8", "@vue/cli-plugin-router": "~5.0.8", "@vue/cli-plugin-typescript": "~5.0.8", "@vue/cli-plugin-vuex": "~5.0.8", "@vue/cli-service": "~5.0.8", "@vue/eslint-config-typescript": "^12.0.0", "eslint": "^8.49.0", "eslint-config-alloy": "^5.1.2", "eslint-plugin-vue": "^9.17.0", "less": "^4.2.0", "less-loader": "^8.1.1", "typescript": "~5.2.2", "vue-eslint-parser": "^9.3.1" } } eslintrc module.exports = { extends: ['alloy', 'alloy/vue', 'alloy/typescript'], parser: 'vue-eslint-parser', parserOptions: { parser: { js: '@babel/eslint-parser', jsx: '@babel/eslint-parser', ts: '@typescript-eslint/parser', tsx: '@typescript-eslint/parser' // Leave the template parser unspecified, so that it could be determined by `` } }, env: { // Your environments (which contains several predefined global variables) // // browser: true, // node: true, // mocha: true, // jest: true, // jquery: true }, globals: { // Your global variables (setting to false means it's not allowed to be reassigned) // // myGlobal: false }, rules: { // Customize your rules // // Please keep this rule off because it requiresTypeChecking // https://github.com/vuejs/vue-eslint-parser/issues/104 // https://github.com/typescript-eslint/typescript-eslint/pull/5318 '@typescript-eslint/prefer-optional-chain': 'off' } } 报错信息 ERROR in [eslint] Error while loading rule '@typescript-eslint/consistent-type-assertions': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser. 在网上查了一下,都是说在eslintrc的parserOptions下新建个project键,然后写上tsconfig.json的位置,但是配置后并没有生效。有哪位大佬知晓什么情况吗?

10
1
0
浏览量292
UX_siri

vscode 中,如何在自动格式化时,如何将标签变成自闭合标签?

vscode 中,如何在自动格式化时,如何将标签变成自闭合标签 ? 如 "" 变为 "" 如 "" 不发生变化,还是 "" 如 "" 变为 "" 编辑器:VS Code 语言:React + TS + TSX 插件:Lint + Prettier 编译工具: Webpack(RsPack)

0
1
0
浏览量208
NKTDYD

开发eslint自定义规则时,报错 Unexpected token < ,该如何解决?

开发eslint自定义规则时,我测试的代码是 , "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240928/cbdcce577f7c0c5f3919457454aa4eae.png) 运行 yarn run test, 报错说 AssertionError [ERR_ASSERTION]: A fatal parsing error occurred: Parsing error: Unexpected token <, 如下图 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240928/892cd50d914920c4c454e821c9baf4bb.png) 是因为解析有问题吗?安装和配置了babel-eslint,仍然有这个问题 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240928/0675328e967380d00ff99fda3ddd03db.png)

0
1
0
浏览量213
你可以的拿捏了

如何让 ESLint 识别全局导入变量并消除 'not defined' 警告?

全局导入,不需要再写"import..."就可以使用,但是eslint显示".. not defined",这该怎么解决?如何让elint知道它们已经导入了并且是定义的? // vite.config.js import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], test: { environment: "jsdom", globals: true, // <---- setupFiles: "./testSetup.js", }, }); // testSetup.js import "@testing-library/jest-dom/vitest"; // .eslintrc.cjs module.exports = { root: true, env: { browser: true, es2020: true }, extends: [ "eslint:recommended", "plugin:react/recommended", "plugin:react/jsx-runtime", "plugin:react-hooks/recommended", "plugin:testing-library/react", ], ignorePatterns: ["dist", ".eslintrc.cjs"], parserOptions: { ecmaVersion: "latest", sourceType: "module" }, settings: { react: { version: "18.2" } }, plugins: ["react-refresh", "testing-library"], rules: { "react/jsx-no-target-blank": "off", "react-refresh/only-export-components": [ "warn", { allowConstantExport: true }, ], }, }; "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240927/e1b09f4cb112a146255c4dd6e758aec2.png)

0
1
0
浏览量209
横刀立马007

react代码中的eslint校验问题,怎么处理?

react代码中eslint的错误提示: "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241001/111d23c10d81b8433a71696e52acac5b.png) 这个该改成啥??

0
1
0
浏览量166
脑洞大咖

vue3 项目使用.prettierrc自动保存,元素标签换行风格如何配置?

如图所示,我如何配置保存成我想要的结果。 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241121/1b4eb14ae00016e97e55fa212dba2bf3.png)

0
1
0
浏览量20
小飞侠007

ESLint错误代码未提示?

eslint安装了 为啥写错误代码没有提示波浪号 运行命令检查是会报错的 "image.png" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241029/45c5eb72e7673e25f588f6d602b58849.png) "image.png" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241029/0259d047c5b1faa8d6d6fa89db69713e.png) "image.png" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241029/e1860f872feea13be6389313b8e6583c.png)

0
1
0
浏览量21
嚯嚯嚯嚯嚯嚯

使用eslint和prettier 配置成可以自动格式化代码成驼峰?

有大佬知道怎么使用eslint和prettier 配置成可以自动格式化代码成驼峰的吗。十分感谢。"一开始是这样有警告" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241102/5ff3f5aa50a9daf1d3c754d1ece0ebf6.png)"希望可以自动格式化成这个样子,有大佬做过吗。感激不尽。" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241102/2105c87c937636a53453a6e469f79267.png)"还有一个问题明明已经安装eslint-重启过-也重新安装过-为什么右键格式化程序还是没有eslint" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241102/139c702957c37f69d7a6b3387de41337.png) 希望能够自动格式化驼峰格式。

0
1
0
浏览量15