开始学习 React ,自己想用 Vite 作为开发环境,但是被配置 eslint 和 prettier 卡主了,看网上文章每个教的都不太一样,搞不懂 eslint plugin 到底要装哪些,于是想找个脚手架直接上,但是看网上基本上都是 ts 版的脚手架,想问问有没有 V 友能分享一下在维护的 js 版本的 vite 脚手架
![]() |
1
xujiahui 82 天前 ![]() 放弃 eslint 就简单了,https://github.com/vitejs/awesome-vite 这个里面有各种各样的模板
|
![]() |
3
stille 82 天前
最近学习 vue 也是 eslint 搞懵逼了,脚手架里一套,vscode 插件又一套.实在不知道该怎么配了.
|
4
TWorldIsNButThis 82 天前 ![]() 这个之前搞了我好几天,也是各种冲突和不适用的老规则
最后定下来是用 eslint 驱动 prettier ,装 eslint-config-prettier eslint-plugin-prettier 然后在 eslintrc 里写 eslint 和 prettier 的配置 { "env": {"browser": true, "es2021": true}, "extends": [ "eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended", "plugin:prettier/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": {"ecmaFeatures": {"jsx": true}, "ecmaVersion": "latest", "sourceType": "module"}, "settings": { "react": { "version": "detect" } }, "plugins": ["react", "@typescript-eslint"], "rules": { "quotes": ["error", "single"], "semi": ["error", "never"], "react/react-in-jsx-scope": "off", "prettier/prettier": [ "error", { "trailingComma": "es5", "singleQuote": true, "printWidth": 120, "semi": false, "plugins": ["prettier-plugin-tailwindcss"], "tailwindConfig": "./tailwind.config.js", "endOfLine": "auto" } ] }, "ignorePatterns": ["**/*.config.*", "dist/**/*"] } |
![]() |
5
guzzhao 82 天前 via Android ![]() https://github.com/guzzhao/my-react-app
可以看看我这个,完成度不咋高,eslint 用的腾讯的 |
7
me221 82 天前
刚开始学就别用什么 lint 了吧
|
![]() |
8
zhaol 82 天前
如果只是学了自己玩玩可以不学 ts ,如果是为了工作的话,建议还是一起学了,很多公司都有这个要求。其实上手也很快,不用很深入。
|
![]() |
10
ccyu220 82 天前
@stille 写错了,上面的实效了,现在是 yarn create [email protected]
|
11
dengqing 82 天前 via iPhone
如果是后台可以用这个
vite-ant-design-pro 完成度还可以 https://github.com/1247748612/vite-ant-design-pro 创建项目 pnpm create ant-design-pro |
![]() |
12
molvqingtai 81 天前 via Android ![]() 有写过 eslint 配置的文章,其实挺简单的
https://juejin.cn/post/6971812117993226248#heading-5 |
13
me221 81 天前 ![]() |
14
Kei001 OP @TWorldIsNButThis #4 感谢,可否分享一下你的 package.json 呢
|