@lincy/eslint-config 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -136,6 +136,8 @@ export default lincy({
136
136
  typescript: true, // 默认值: 检测是否安装typescript依赖, 可选: false
137
137
  // 是否启用 vue 规则
138
138
  vue: true, // 默认值: 检测是否安装vue依赖, 可选: false
139
+ // 是否启用 jsx 规则
140
+ jsx: true, // 默认值: true, 可选: false
139
141
  // 是否启用 jsonc 规则
140
142
  jsonc: false, // 默认值: true, 可选: false
141
143
  // 是否启用 yaml 规则
@@ -280,6 +282,7 @@ export default lincy(
280
282
  {
281
283
  isInEditor: true,
282
284
  vue: true,
285
+ jsx: true,
283
286
  typescript: true,
284
287
  stylistic: true,
285
288
  gitignore: true,
@@ -377,6 +380,8 @@ import pluginReactHooks from 'eslint-plugin-react-hooks'
377
380
  export default lincy(
378
381
  {
379
382
  vue: false,
383
+ // 关闭stylistic提供的jsx规则, 直接使用eslint-plugin-react
384
+ jsx: false,
380
385
  },
381
386
  // react 相关规则
382
387
  {
package/dist/index.cjs CHANGED
@@ -990,17 +990,33 @@ function stylistic(options = {}) {
990
990
  "style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
991
991
  "style/yield-star-spacing": ["error", "both"],
992
992
  ...jsx ? {
993
- "style/jsx-child-element-spacing": "error",
994
- "style/jsx-closing-bracket-location": ["error", "line-aligned"],
993
+ "style/jsx-closing-bracket-location": "error",
994
+ "style/jsx-closing-tag-location": "error",
995
+ "style/jsx-curly-brace-presence": ["error", { propElementValues: "always" }],
995
996
  "style/jsx-curly-newline": "error",
996
- "style/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
997
+ "style/jsx-curly-spacing": ["error", "never"],
997
998
  "style/jsx-equals-spacing": "error",
998
999
  "style/jsx-first-prop-new-line": "error",
999
- "style/jsx-indent": ["error", indent],
1000
+ "style/jsx-indent": ["error", indent, { checkAttributes: true, indentLogicalExpressions: true }],
1000
1001
  "style/jsx-indent-props": ["error", indent],
1002
+ "style/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
1003
+ "style/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
1001
1004
  "style/jsx-quotes": "error",
1002
- "style/jsx-tag-spacing": "error",
1003
- "style/jsx-wrap-multilines": "error"
1005
+ "style/jsx-tag-spacing": ["error", {
1006
+ afterOpening: "never",
1007
+ beforeClosing: "never",
1008
+ beforeSelfClosing: "always",
1009
+ closingSlash: "never"
1010
+ }],
1011
+ "style/jsx-wrap-multilines": ["error", {
1012
+ arrow: "parens-new-line",
1013
+ assignment: "parens-new-line",
1014
+ condition: "parens-new-line",
1015
+ declaration: "parens-new-line",
1016
+ logical: "parens-new-line",
1017
+ prop: "parens-new-line",
1018
+ return: "parens-new-line"
1019
+ }]
1004
1020
  } : {},
1005
1021
  ...overrides
1006
1022
  }
@@ -1290,14 +1306,10 @@ function vue(options = {}) {
1290
1306
  "vue/no-useless-v-bind": "error",
1291
1307
  "vue/no-v-html": "off",
1292
1308
  "vue/no-v-text-v-html-on-component": "off",
1293
- "vue/object-shorthand": [
1294
- "error",
1295
- "always",
1296
- {
1297
- avoidQuotes: true,
1298
- ignoreConstructors: false
1299
- }
1300
- ],
1309
+ "vue/object-shorthand": ["error", "always", {
1310
+ avoidQuotes: true,
1311
+ ignoreConstructors: false
1312
+ }],
1301
1313
  "vue/prefer-separate-static-class": "error",
1302
1314
  "vue/prefer-template": "error",
1303
1315
  "vue/require-default-prop": "off",
package/dist/index.js CHANGED
@@ -896,17 +896,33 @@ function stylistic(options = {}) {
896
896
  "style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
897
897
  "style/yield-star-spacing": ["error", "both"],
898
898
  ...jsx ? {
899
- "style/jsx-child-element-spacing": "error",
900
- "style/jsx-closing-bracket-location": ["error", "line-aligned"],
899
+ "style/jsx-closing-bracket-location": "error",
900
+ "style/jsx-closing-tag-location": "error",
901
+ "style/jsx-curly-brace-presence": ["error", { propElementValues: "always" }],
901
902
  "style/jsx-curly-newline": "error",
902
- "style/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
903
+ "style/jsx-curly-spacing": ["error", "never"],
903
904
  "style/jsx-equals-spacing": "error",
904
905
  "style/jsx-first-prop-new-line": "error",
905
- "style/jsx-indent": ["error", indent],
906
+ "style/jsx-indent": ["error", indent, { checkAttributes: true, indentLogicalExpressions: true }],
906
907
  "style/jsx-indent-props": ["error", indent],
908
+ "style/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
909
+ "style/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
907
910
  "style/jsx-quotes": "error",
908
- "style/jsx-tag-spacing": "error",
909
- "style/jsx-wrap-multilines": "error"
911
+ "style/jsx-tag-spacing": ["error", {
912
+ afterOpening: "never",
913
+ beforeClosing: "never",
914
+ beforeSelfClosing: "always",
915
+ closingSlash: "never"
916
+ }],
917
+ "style/jsx-wrap-multilines": ["error", {
918
+ arrow: "parens-new-line",
919
+ assignment: "parens-new-line",
920
+ condition: "parens-new-line",
921
+ declaration: "parens-new-line",
922
+ logical: "parens-new-line",
923
+ prop: "parens-new-line",
924
+ return: "parens-new-line"
925
+ }]
910
926
  } : {},
911
927
  ...overrides
912
928
  }
@@ -1196,14 +1212,10 @@ function vue(options = {}) {
1196
1212
  "vue/no-useless-v-bind": "error",
1197
1213
  "vue/no-v-html": "off",
1198
1214
  "vue/no-v-text-v-html-on-component": "off",
1199
- "vue/object-shorthand": [
1200
- "error",
1201
- "always",
1202
- {
1203
- avoidQuotes: true,
1204
- ignoreConstructors: false
1205
- }
1206
- ],
1215
+ "vue/object-shorthand": ["error", "always", {
1216
+ avoidQuotes: true,
1217
+ ignoreConstructors: false
1218
+ }],
1207
1219
  "vue/prefer-separate-static-class": "error",
1208
1220
  "vue/prefer-template": "error",
1209
1221
  "vue/require-default-prop": "off",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "3.5.0",
4
+ "version": "3.5.1",
5
5
  "packageManager": "pnpm@8.7.6",
6
6
  "description": "LinCenYing's ESLint config",
7
7
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
@@ -50,7 +50,7 @@
50
50
  "eslint-plugin-jsdoc": "^46.8.2",
51
51
  "eslint-plugin-jsonc": "^2.10.0",
52
52
  "eslint-plugin-markdown": "^3.0.1",
53
- "eslint-plugin-n": "^16.1.0",
53
+ "eslint-plugin-n": "^16.2.0",
54
54
  "eslint-plugin-no-only-tests": "^3.1.0",
55
55
  "eslint-plugin-unicorn": "^48.0.1",
56
56
  "eslint-plugin-unused-imports": "^3.0.0",
@@ -67,7 +67,7 @@
67
67
  "@antfu/ni": "^0.21.8",
68
68
  "@lincy/eslint-config": "workspace:*",
69
69
  "@stylistic/eslint-plugin-migrate": "^0.0.8",
70
- "@types/eslint": "^8.44.3",
70
+ "@types/eslint": "^8.44.4",
71
71
  "@types/node": "^20.8.4",
72
72
  "bumpp": "^9.2.0",
73
73
  "eslint": "^8.51.0",