@simplysm/eslint-plugin 10.0.66 → 11.0.3
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,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/eslint-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.3",
|
|
4
4
|
"description": "심플리즘 패키지 - ESLINT 플러그인",
|
|
5
5
|
"author": "김석래",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/kslhunter/
|
|
8
|
+
"url": "https://github.com/kslhunter/simplysm11.git",
|
|
9
9
|
"directory": "packages/eslint-plugin"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"node": "^16"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@angular-eslint/eslint-plugin": "^16.2.0",
|
|
19
|
+
"@angular-eslint/eslint-plugin-template": "^16.2.0",
|
|
20
|
+
"@angular-eslint/template-parser": "^16.2.0",
|
|
18
21
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
19
22
|
"@typescript-eslint/experimental-utils": "^5.62.0",
|
|
20
23
|
"@typescript-eslint/parser": "^6.7.4",
|
|
@@ -22,8 +25,6 @@
|
|
|
22
25
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
23
26
|
"eslint-module-utils": "^2.8.0",
|
|
24
27
|
"eslint-plugin-import": "^2.28.1",
|
|
25
|
-
"eslint-plugin-react": "^7.33.2",
|
|
26
|
-
"eslint-plugin-react-refresh": "^0.4.3",
|
|
27
28
|
"typescript": "^4.9.5"
|
|
28
29
|
}
|
|
29
30
|
}
|
package/src/configs/root.cjs
CHANGED
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
|
33
33
|
"no-undef": ["error"],
|
|
34
34
|
// "linebreak-style": ["error", "unix"]
|
|
35
35
|
|
|
36
|
-
"arrow-parens": ["error"]
|
|
36
|
+
// "arrow-parens": ["error"]
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
{
|
|
@@ -49,9 +49,9 @@ module.exports = {
|
|
|
49
49
|
"@typescript-eslint",
|
|
50
50
|
"import",
|
|
51
51
|
"@simplysm",
|
|
52
|
-
"
|
|
53
|
-
"react"
|
|
52
|
+
"@angular-eslint"
|
|
54
53
|
],
|
|
54
|
+
processor: "@angular-eslint/template/extract-inline-html",
|
|
55
55
|
settings: {
|
|
56
56
|
"import/parsers": {
|
|
57
57
|
"@typescript-eslint/parser": [".ts", ".tsx"]
|
|
@@ -60,25 +60,19 @@ module.exports = {
|
|
|
60
60
|
"typescript": {
|
|
61
61
|
project: "packages/*/tsconfig.json",
|
|
62
62
|
}
|
|
63
|
-
},
|
|
64
|
-
"react": {
|
|
65
|
-
version: "detect"
|
|
66
63
|
}
|
|
67
64
|
},
|
|
68
65
|
rules: {
|
|
69
66
|
// 기본
|
|
70
67
|
"no-console": ["warn"],
|
|
71
68
|
"no-warning-comments": ["warn"],
|
|
72
|
-
"arrow-parens": ["error"],
|
|
69
|
+
// "arrow-parens": ["error"],
|
|
73
70
|
// "linebreak-style": ["error", "unix"],
|
|
74
71
|
|
|
75
72
|
// import
|
|
76
73
|
"import/no-extraneous-dependencies": ["error"], // 느림
|
|
77
74
|
// "import/no-duplicates": ["error"], // 느림
|
|
78
75
|
|
|
79
|
-
// REACT
|
|
80
|
-
"react-refresh/only-export-components": ["warn"],
|
|
81
|
-
|
|
82
76
|
// 타입스크립트
|
|
83
77
|
"@typescript-eslint/explicit-member-accessibility": ["error"],
|
|
84
78
|
"@typescript-eslint/require-await": ["error"],
|
|
@@ -116,33 +110,21 @@ module.exports = {
|
|
|
116
110
|
}],
|
|
117
111
|
"@typescript-eslint/prefer-ts-expect-error": ["error"],
|
|
118
112
|
|
|
119
|
-
// REACT
|
|
120
|
-
"react/jsx-curly-brace-presence": ["error", {props: "always", propElementValues: "always"}],
|
|
121
|
-
"react/jsx-key": ["error", {
|
|
122
|
-
checkFragmentShorthand: false,
|
|
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
113
|
// 심플리즘
|
|
142
114
|
"@simplysm/ts-no-throw-not-implement-error": ["warn"],
|
|
143
115
|
"@simplysm/ts-no-self-entry-import": ["error"],
|
|
144
|
-
"@simplysm/ts-no-external-import": ["error"]
|
|
145
|
-
|
|
116
|
+
"@simplysm/ts-no-external-import": ["error"]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
files: ["*.html"],
|
|
121
|
+
parser: "@angular-eslint/template-parser",
|
|
122
|
+
plugins: [
|
|
123
|
+
"@angular-eslint/template",
|
|
124
|
+
"@simplysm"
|
|
125
|
+
],
|
|
126
|
+
rules: {
|
|
127
|
+
"@simplysm/ng-template-no-todo-comments": "warn"
|
|
146
128
|
}
|
|
147
129
|
}
|
|
148
130
|
]
|
package/src/index.cjs
CHANGED
|
@@ -6,6 +6,6 @@ module.exports = {
|
|
|
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
8
|
"ts-no-throw-not-implement-error": require("./rules/ts-no-throw-not-implement-error.cjs"),
|
|
9
|
-
"
|
|
9
|
+
"ng-template-no-todo-comments": require("./rules/ng-template-no-todo-comments.cjs")
|
|
10
10
|
}
|
|
11
11
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
meta: {
|
|
3
|
+
type: "suggestion",
|
|
4
|
+
docs: {
|
|
5
|
+
description: "HTML의 'TODO' 주석 경고"
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
schema: []
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
create: (context) => {
|
|
12
|
+
// const parserServices = context.parserServices;
|
|
13
|
+
return {
|
|
14
|
+
Program(node) {
|
|
15
|
+
if (node.value) {
|
|
16
|
+
const comments = node.value.match(/<!--(((?!-->)[\s\S])*)-->/g);
|
|
17
|
+
if (!comments) return;
|
|
18
|
+
|
|
19
|
+
let cursor = 0;
|
|
20
|
+
for (const comment of comments) {
|
|
21
|
+
if (!comment.includes("TODO:")) continue;
|
|
22
|
+
|
|
23
|
+
const index = node.value.slice(cursor).indexOf(comment) + cursor;
|
|
24
|
+
const line = node.value.slice(0, index).split("\n").length;
|
|
25
|
+
const column = index - node.value.slice(0, index).lastIndexOf("\n") - 1;
|
|
26
|
+
|
|
27
|
+
const endIndex = index + comment.length;
|
|
28
|
+
const endLine = node.value.slice(0, endIndex).split("\n").length;
|
|
29
|
+
const endColumn = endIndex - node.value.slice(0, endIndex).lastIndexOf("\n") - 1;
|
|
30
|
+
|
|
31
|
+
cursor += index;
|
|
32
|
+
|
|
33
|
+
context.report({
|
|
34
|
+
loc: {
|
|
35
|
+
start: { line, column },
|
|
36
|
+
end: { line: endLine, column: endColumn }
|
|
37
|
+
},
|
|
38
|
+
message: comment.match(/<!--(((?!-->)[\s\S])*)-->/)[1].trim()
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
};
|