TWorldIsNButThis
2022-04-14 11:37:06 +08:00
这个之前搞了我好几天,也是各种冲突和不适用的老规则
最后定下来是用 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/**/*"]
}