@simplysm/eslint-plugin 10.0.58 → 10.0.60

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/eslint-plugin",
3
- "version": "10.0.58",
3
+ "version": "10.0.60",
4
4
  "description": "심플리즘 패키지 - ESLINT 플러그인",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -21,8 +21,8 @@
21
21
  "eslint": "^8.50.0",
22
22
  "eslint-import-resolver-typescript": "^3.6.1",
23
23
  "eslint-module-utils": "^2.8.0",
24
- "eslint-plugin-deprecation": "^2.0.0",
25
24
  "eslint-plugin-import": "^2.28.1",
25
+ "eslint-plugin-react": "^7.33.2",
26
26
  "eslint-plugin-react-refresh": "^0.4.3",
27
27
  "typescript": "^4.9.5"
28
28
  }
@@ -32,6 +32,8 @@ module.exports = {
32
32
  "no-unused-vars": ["error"],
33
33
  "no-undef": ["error"],
34
34
  // "linebreak-style": ["error", "unix"]
35
+
36
+ "arrow-parens": ["error"]
35
37
  },
36
38
  },
37
39
  {
@@ -45,10 +47,10 @@ module.exports = {
45
47
  },
46
48
  plugins: [
47
49
  "@typescript-eslint",
48
- "deprecation",
49
50
  "import",
50
51
  "@simplysm",
51
- "react-refresh"
52
+ "react-refresh",
53
+ "react"
52
54
  ],
53
55
  settings: {
54
56
  "import/parsers": {
@@ -58,26 +60,22 @@ module.exports = {
58
60
  "typescript": {
59
61
  project: "packages/*/tsconfig.json",
60
62
  }
63
+ },
64
+ "react": {
65
+ version: "detect"
61
66
  }
62
67
  },
63
68
  rules: {
64
69
  // 기본
65
70
  "no-console": ["warn"],
66
71
  "no-warning-comments": ["warn"],
72
+ "arrow-parens": ["error"],
67
73
  // "linebreak-style": ["error", "unix"],
68
74
 
69
- // Deprecation
70
- // "deprecation/deprecation": ["warn"], // 느림
71
-
72
75
  // import
73
76
  "import/no-extraneous-dependencies": ["error"], // 느림
74
77
  // "import/no-duplicates": ["error"], // 느림
75
78
 
76
- // 심플리즘
77
- "@simplysm/ts-no-throw-not-implement-error": ["warn"],
78
- "@simplysm/ts-no-self-entry-import": ["error"],
79
- "@simplysm/ts-no-external-import": ["error"],
80
-
81
79
  // REACT
82
80
  "react-refresh/only-export-components": ["warn"],
83
81
 
@@ -111,12 +109,40 @@ module.exports = {
111
109
  "@typescript-eslint/no-unused-expressions": ["error"],
112
110
  "@typescript-eslint/no-unused-vars": ["error", {args: "none"}],
113
111
  "@typescript-eslint/strict-boolean-expressions": ["error", {
114
- allowString: true,
115
- allowNumber: true,
112
+ // allowString: true,
113
+ // allowNumber: true,
116
114
  allowNullableBoolean: true,
117
115
  allowNullableObject: true
118
116
  }],
119
- "@typescript-eslint/prefer-ts-expect-error": ["error"]
117
+ "@typescript-eslint/prefer-ts-expect-error": ["error"],
118
+
119
+ // REACT
120
+ "react/jsx-curly-brace-presence": ["error", {props: "always", propElementValues: "always"}],
121
+ "react/jsx-key": ["error", {
122
+ checkFragmentShorthand: true,
123
+ checkKeyMustBeforeSpread: true,
124
+ warnOnDuplicates: true
125
+ }],
126
+ "react/jsx-no-useless-fragment": "error",
127
+ "react/jsx-pascal-case": "error",
128
+ "react/jsx-wrap-multilines": ["error", {
129
+ "declaration": "parens",
130
+ "assignment": "parens",
131
+ "return": "parens",
132
+ "arrow": "parens",
133
+ "condition": "parens",
134
+ "logical": "parens",
135
+ "prop": "parens"
136
+ }],
137
+ "react/no-array-index-key": "error",
138
+ "react/no-deprecated": "warn",
139
+
140
+
141
+ // 심플리즘
142
+ "@simplysm/ts-no-throw-not-implement-error": ["warn"],
143
+ "@simplysm/ts-no-self-entry-import": ["error"],
144
+ "@simplysm/ts-no-external-import": ["error"],
145
+ "@simplysm/jsx-no-prop-object": ["error"],
120
146
  }
121
147
  }
122
148
  ]
package/src/index.cjs CHANGED
@@ -5,6 +5,7 @@ module.exports = {
5
5
  rules: {
6
6
  "ts-no-external-import": require("./rules/ts-no-external-import.cjs"),
7
7
  "ts-no-self-entry-import": require("./rules/ts-no-self-entry-import.cjs"),
8
- "ts-no-throw-not-implement-error": require("./rules/ts-no-throw-not-implement-error.cjs")
8
+ "ts-no-throw-not-implement-error": require("./rules/ts-no-throw-not-implement-error.cjs"),
9
+ "jsx-no-prop-object": require("./rules/jsx-no-direct-object.cjs")
9
10
  }
10
11
  };
@@ -0,0 +1,29 @@
1
+ module.exports = {
2
+ meta: {
3
+ type: "problem",
4
+ docs: {
5
+ description: "'jsx'에 직접적으로 Object/Array/Function를 입력할 수 없음",
6
+ },
7
+ fixable: false,
8
+ schema: [],
9
+ },
10
+
11
+ create: (context) => {
12
+ return {
13
+ JSXExpressionContainer(node){
14
+ if (
15
+ node.type !== 'JSXExpressionContainer'
16
+ || node.expression.type === "ArrayExpression"
17
+ || node.expression.type === "ObjectExpression"
18
+ || node.expression.type === "ArrowFunctionExpression"
19
+ || node.expression.type === "FunctionExpression"
20
+ ) {
21
+ context.report({
22
+ node,
23
+ message: "'jsx'에 직접적으로 Object/Array/Function을 넣을 수 없습니다. (필요시, $.obj, $.fn, $.getter 활용)"
24
+ });
25
+ }
26
+ }
27
+ };
28
+ },
29
+ };