@simplysm/eslint-plugin 10.0.59 → 10.0.61
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.
|
|
3
|
+
"version": "10.0.61",
|
|
4
4
|
"description": "심플리즘 패키지 - ESLINT 플러그인",
|
|
5
5
|
"author": "김석래",
|
|
6
6
|
"repository": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "src/index.cjs",
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": "^
|
|
15
|
+
"node": "^16"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
|
@@ -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
|
}
|
package/src/configs/root.cjs
CHANGED
|
@@ -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,58 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
meta: {
|
|
3
|
+
type: "problem",
|
|
4
|
+
docs: {
|
|
5
|
+
description: "'jsx'에 직접적으로 Object/Array/Function를 입력할 수 없음",
|
|
6
|
+
},
|
|
7
|
+
fixable: false,
|
|
8
|
+
schema: [],
|
|
9
|
+
},
|
|
10
|
+
create: (context) => {
|
|
11
|
+
let scope = context.getScope();
|
|
12
|
+
let variables = scope.variables;
|
|
13
|
+
|
|
14
|
+
while (scope.type !== 'global') {
|
|
15
|
+
scope = scope.upper;
|
|
16
|
+
variables = scope.variables.concat(variables);
|
|
17
|
+
}
|
|
18
|
+
if (scope.childScopes.length) {
|
|
19
|
+
variables = scope.childScopes[0].variables.concat(variables);
|
|
20
|
+
if (scope.childScopes[0].childScopes.length) {
|
|
21
|
+
variables = scope.childScopes[0].childScopes[0].variables.concat(variables);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
variables = variables.reverse();
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
JSXExpressionContainer(node) {
|
|
28
|
+
if (
|
|
29
|
+
node.type !== 'JSXExpressionContainer'
|
|
30
|
+
|| node.expression.type === "ArrayExpression"
|
|
31
|
+
|| node.expression.type === "ObjectExpression"
|
|
32
|
+
|| node.expression.type === "ArrowFunctionExpression"
|
|
33
|
+
|| node.expression.type === "FunctionExpression"
|
|
34
|
+
) {
|
|
35
|
+
context.report({
|
|
36
|
+
node,
|
|
37
|
+
message: "'jsx'에 직접적으로 Object/Array/Function을 넣을 수 없습니다. (필요시, $.obj, $.fn, $.getter 활용)"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else if (node.expression.type === "Identifier") {
|
|
41
|
+
const variable = variables.find((item) => item.name === node.expression.name);
|
|
42
|
+
|
|
43
|
+
if (
|
|
44
|
+
variable?.defs[0]?.node.init?.type === "ArrayExpression"
|
|
45
|
+
|| variable?.defs[0]?.node.init?.type === "ObjectExpression"
|
|
46
|
+
|| variable?.defs[0]?.node.init?.type === "ArrowFunctionExpression"
|
|
47
|
+
|| variable?.defs[0]?.node.init?.type === "FunctionExpression"
|
|
48
|
+
) {
|
|
49
|
+
context.report({
|
|
50
|
+
node,
|
|
51
|
+
message: "'jsx'에 직접적으로 Object/Array/Function을 넣을 수 없습니다. (필요시, $.obj, $.fn, $.getter 활용)"
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
};
|