@so1ve/eslint-plugin 0.76.0 → 0.77.0
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/dist/index.cjs +7 -50
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +7 -50
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -5,9 +5,9 @@ const types = require('@typescript-eslint/types');
|
|
|
5
5
|
|
|
6
6
|
const createEslintRule = utils.ESLintUtils.RuleCreator((ruleName) => ruleName);
|
|
7
7
|
|
|
8
|
-
const RULE_NAME$
|
|
8
|
+
const RULE_NAME$3 = "import-dedupe";
|
|
9
9
|
const importDedupe = createEslintRule({
|
|
10
|
-
name: RULE_NAME$
|
|
10
|
+
name: RULE_NAME$3,
|
|
11
11
|
meta: {
|
|
12
12
|
type: "problem",
|
|
13
13
|
docs: {
|
|
@@ -53,9 +53,9 @@ const importDedupe = createEslintRule({
|
|
|
53
53
|
})
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
const RULE_NAME$
|
|
56
|
+
const RULE_NAME$2 = "no-inline-type-import";
|
|
57
57
|
const noInlineTypeImport = createEslintRule({
|
|
58
|
-
name: RULE_NAME$
|
|
58
|
+
name: RULE_NAME$2,
|
|
59
59
|
meta: {
|
|
60
60
|
type: "layout",
|
|
61
61
|
docs: {
|
|
@@ -119,9 +119,9 @@ const noInlineTypeImport = createEslintRule({
|
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
const RULE_NAME$
|
|
122
|
+
const RULE_NAME$1 = "no-useless-template-string";
|
|
123
123
|
const noUselessTemplateString = createEslintRule({
|
|
124
|
-
name: RULE_NAME$
|
|
124
|
+
name: RULE_NAME$1,
|
|
125
125
|
meta: {
|
|
126
126
|
type: "problem",
|
|
127
127
|
docs: {
|
|
@@ -156,48 +156,6 @@ const noUselessTemplateString = createEslintRule({
|
|
|
156
156
|
})
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
const RULE_NAME$1 = "no-beginning-newline";
|
|
160
|
-
const noBeginningNewline = createEslintRule({
|
|
161
|
-
name: RULE_NAME$1,
|
|
162
|
-
meta: {
|
|
163
|
-
type: "layout",
|
|
164
|
-
docs: {
|
|
165
|
-
description: "No beginning newline",
|
|
166
|
-
recommended: "error"
|
|
167
|
-
},
|
|
168
|
-
fixable: "whitespace",
|
|
169
|
-
schema: [],
|
|
170
|
-
messages: {
|
|
171
|
-
noBeginningNewline: "No beginning newline"
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
defaultOptions: [],
|
|
175
|
-
create: (context) => {
|
|
176
|
-
const text = context.getSourceCode().text;
|
|
177
|
-
return {
|
|
178
|
-
Program: (node) => {
|
|
179
|
-
const newlines = text.match(/([\n]*)/)[1];
|
|
180
|
-
if (newlines.length > 0) {
|
|
181
|
-
context.report({
|
|
182
|
-
node,
|
|
183
|
-
loc: {
|
|
184
|
-
start: {
|
|
185
|
-
line: 0,
|
|
186
|
-
column: 0
|
|
187
|
-
},
|
|
188
|
-
end: node.loc.start
|
|
189
|
-
},
|
|
190
|
-
messageId: "noBeginningNewline",
|
|
191
|
-
*fix(fixer) {
|
|
192
|
-
yield fixer.removeRange([0, node.range[0]]);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
159
|
const RULE_NAME = "function-style";
|
|
202
160
|
const START_RETURN = /^return /;
|
|
203
161
|
const END_SEMICOLON = /;$/;
|
|
@@ -251,7 +209,7 @@ const functionStyle = createEslintRule({
|
|
|
251
209
|
const params = node.params.map((param) => sourceCode.getText(param)).join(", ");
|
|
252
210
|
const generics = node.typeParameters ? sourceCode.getText(node.typeParameters) : "";
|
|
253
211
|
const body = sourceCode.getText(node.body);
|
|
254
|
-
return type === "arrow" ? `const ${node.id.name} = ${async}${generics}(${params}) => ${body}
|
|
212
|
+
return type === "arrow" ? `const ${node.id.name} = ${async}${generics}(${params}) => ${body};` : `${async}function ${node.parent.id.name}${generics}(${params}) ${body}`;
|
|
255
213
|
}
|
|
256
214
|
return {
|
|
257
215
|
FunctionDeclaration(node) {
|
|
@@ -316,7 +274,6 @@ const index = {
|
|
|
316
274
|
"import-dedupe": importDedupe,
|
|
317
275
|
"no-inline-type-import": noInlineTypeImport,
|
|
318
276
|
"no-useless-template-string": noUselessTemplateString,
|
|
319
|
-
"no-beginning-newline": noBeginningNewline,
|
|
320
277
|
"function-style": functionStyle
|
|
321
278
|
}
|
|
322
279
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ declare const _default: {
|
|
|
7
7
|
"import-dedupe": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"importDedupe", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
8
8
|
"no-inline-type-import": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noInlineTypeImport", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
9
9
|
"no-useless-template-string": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noUselessTemplateString", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
10
|
-
"no-beginning-newline": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noBeginningNewline", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
11
10
|
"function-style": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<MessageIds, [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
12
11
|
};
|
|
13
12
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -3,9 +3,9 @@ import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
|
3
3
|
|
|
4
4
|
const createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
|
|
5
5
|
|
|
6
|
-
const RULE_NAME$
|
|
6
|
+
const RULE_NAME$3 = "import-dedupe";
|
|
7
7
|
const importDedupe = createEslintRule({
|
|
8
|
-
name: RULE_NAME$
|
|
8
|
+
name: RULE_NAME$3,
|
|
9
9
|
meta: {
|
|
10
10
|
type: "problem",
|
|
11
11
|
docs: {
|
|
@@ -51,9 +51,9 @@ const importDedupe = createEslintRule({
|
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
const RULE_NAME$
|
|
54
|
+
const RULE_NAME$2 = "no-inline-type-import";
|
|
55
55
|
const noInlineTypeImport = createEslintRule({
|
|
56
|
-
name: RULE_NAME$
|
|
56
|
+
name: RULE_NAME$2,
|
|
57
57
|
meta: {
|
|
58
58
|
type: "layout",
|
|
59
59
|
docs: {
|
|
@@ -117,9 +117,9 @@ const noInlineTypeImport = createEslintRule({
|
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
const RULE_NAME$
|
|
120
|
+
const RULE_NAME$1 = "no-useless-template-string";
|
|
121
121
|
const noUselessTemplateString = createEslintRule({
|
|
122
|
-
name: RULE_NAME$
|
|
122
|
+
name: RULE_NAME$1,
|
|
123
123
|
meta: {
|
|
124
124
|
type: "problem",
|
|
125
125
|
docs: {
|
|
@@ -154,48 +154,6 @@ const noUselessTemplateString = createEslintRule({
|
|
|
154
154
|
})
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
const RULE_NAME$1 = "no-beginning-newline";
|
|
158
|
-
const noBeginningNewline = createEslintRule({
|
|
159
|
-
name: RULE_NAME$1,
|
|
160
|
-
meta: {
|
|
161
|
-
type: "layout",
|
|
162
|
-
docs: {
|
|
163
|
-
description: "No beginning newline",
|
|
164
|
-
recommended: "error"
|
|
165
|
-
},
|
|
166
|
-
fixable: "whitespace",
|
|
167
|
-
schema: [],
|
|
168
|
-
messages: {
|
|
169
|
-
noBeginningNewline: "No beginning newline"
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
defaultOptions: [],
|
|
173
|
-
create: (context) => {
|
|
174
|
-
const text = context.getSourceCode().text;
|
|
175
|
-
return {
|
|
176
|
-
Program: (node) => {
|
|
177
|
-
const newlines = text.match(/([\n]*)/)[1];
|
|
178
|
-
if (newlines.length > 0) {
|
|
179
|
-
context.report({
|
|
180
|
-
node,
|
|
181
|
-
loc: {
|
|
182
|
-
start: {
|
|
183
|
-
line: 0,
|
|
184
|
-
column: 0
|
|
185
|
-
},
|
|
186
|
-
end: node.loc.start
|
|
187
|
-
},
|
|
188
|
-
messageId: "noBeginningNewline",
|
|
189
|
-
*fix(fixer) {
|
|
190
|
-
yield fixer.removeRange([0, node.range[0]]);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
157
|
const RULE_NAME = "function-style";
|
|
200
158
|
const START_RETURN = /^return /;
|
|
201
159
|
const END_SEMICOLON = /;$/;
|
|
@@ -249,7 +207,7 @@ const functionStyle = createEslintRule({
|
|
|
249
207
|
const params = node.params.map((param) => sourceCode.getText(param)).join(", ");
|
|
250
208
|
const generics = node.typeParameters ? sourceCode.getText(node.typeParameters) : "";
|
|
251
209
|
const body = sourceCode.getText(node.body);
|
|
252
|
-
return type === "arrow" ? `const ${node.id.name} = ${async}${generics}(${params}) => ${body}
|
|
210
|
+
return type === "arrow" ? `const ${node.id.name} = ${async}${generics}(${params}) => ${body};` : `${async}function ${node.parent.id.name}${generics}(${params}) ${body}`;
|
|
253
211
|
}
|
|
254
212
|
return {
|
|
255
213
|
FunctionDeclaration(node) {
|
|
@@ -314,7 +272,6 @@ const index = {
|
|
|
314
272
|
"import-dedupe": importDedupe,
|
|
315
273
|
"no-inline-type-import": noInlineTypeImport,
|
|
316
274
|
"no-useless-template-string": noUselessTemplateString,
|
|
317
|
-
"no-beginning-newline": noBeginningNewline,
|
|
318
275
|
"function-style": functionStyle
|
|
319
276
|
}
|
|
320
277
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@so1ve/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@typescript-eslint/utils": "^5.
|
|
34
|
+
"@typescript-eslint/utils": "^5.59.2",
|
|
35
35
|
"@vue/reactivity": "^3.2.47"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/node": "^18.
|
|
39
|
-
"@typescript-eslint/types": "^5.
|
|
38
|
+
"@types/node": "^18.16.5",
|
|
39
|
+
"@typescript-eslint/types": "^5.59.2"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "unbuild",
|