@so1ve/eslint-plugin 3.8.1 → 3.9.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/dist/index.d.ts +10 -10
- package/dist/index.js +4 -7
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
|
|
2
2
|
|
|
3
3
|
//#region src/rules/function-style.d.ts
|
|
4
4
|
type MessageIds = "arrow" | "declaration";
|
|
@@ -12,15 +12,15 @@ type Options = [{
|
|
|
12
12
|
//#region src/index.d.ts
|
|
13
13
|
declare const _default: {
|
|
14
14
|
rules: {
|
|
15
|
-
"function-style":
|
|
16
|
-
"import-dedupe":
|
|
17
|
-
"no-inline-type-import":
|
|
18
|
-
"no-negated-comparison":
|
|
19
|
-
"no-useless-template-string":
|
|
20
|
-
"no-import-promises-as":
|
|
21
|
-
"pad-after-last-import":
|
|
22
|
-
"require-async-with-await":
|
|
23
|
-
"vue-root-element-sort-attributes":
|
|
15
|
+
"function-style": _typescript_eslint_utils_ts_eslint0.RuleModule<MessageIds, [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
16
|
+
"import-dedupe": _typescript_eslint_utils_ts_eslint0.RuleModule<"importDedupe", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
17
|
+
"no-inline-type-import": _typescript_eslint_utils_ts_eslint0.RuleModule<"noInlineTypeImport", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
18
|
+
"no-negated-comparison": _typescript_eslint_utils_ts_eslint0.RuleModule<"noNegatedComparison", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
19
|
+
"no-useless-template-string": _typescript_eslint_utils_ts_eslint0.RuleModule<"noUselessTemplateString", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
20
|
+
"no-import-promises-as": _typescript_eslint_utils_ts_eslint0.RuleModule<"noImportPromisesAs", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
21
|
+
"pad-after-last-import": _typescript_eslint_utils_ts_eslint0.RuleModule<"padAfterLastImport", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
22
|
+
"require-async-with-await": _typescript_eslint_utils_ts_eslint0.RuleModule<"requireAsyncWithAwait", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
23
|
+
"vue-root-element-sort-attributes": _typescript_eslint_utils_ts_eslint0.RuleModule<"wrongOrder", Options, unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -55,12 +55,10 @@ var function_style_default = createEslintRule({
|
|
|
55
55
|
});
|
|
56
56
|
function generateArrowFunction(name, info, returnValue, asVariable = true) {
|
|
57
57
|
const asyncKeyword = info.async ? "async " : "";
|
|
58
|
-
|
|
59
|
-
return `${variableDeclaration}${asyncKeyword}${info.generics}(${info.params})${info.returnType} => ${returnValue};`;
|
|
58
|
+
return `${asVariable && name ? `const ${name} = ` : ""}${asyncKeyword}${info.generics}(${info.params})${info.returnType} => ${returnValue};`;
|
|
60
59
|
}
|
|
61
60
|
function generateFunctionDeclaration(name, info) {
|
|
62
|
-
|
|
63
|
-
return `${asyncKeyword}function ${name}${info.generics}(${info.params})${info.returnType} ${info.body}`;
|
|
61
|
+
return `${info.async ? "async " : ""}function ${name}${info.generics}(${info.params})${info.returnType} ${info.body}`;
|
|
64
62
|
}
|
|
65
63
|
function setupScope(node) {
|
|
66
64
|
scopeStack.push(sourceCode.getScope(node));
|
|
@@ -214,8 +212,7 @@ var no_import_promises_as_default = createEslintRule({
|
|
|
214
212
|
},
|
|
215
213
|
defaultOptions: [],
|
|
216
214
|
create: (context) => {
|
|
217
|
-
const
|
|
218
|
-
const { text } = sourceCode;
|
|
215
|
+
const { text } = context.sourceCode;
|
|
219
216
|
return { ImportDeclaration(node) {
|
|
220
217
|
if (!POSSIBLE_IMPORT_SOURCES.includes(node.source.value)) return;
|
|
221
218
|
const promisesSpecifier = node.specifiers.find((s) => s.type === "ImportSpecifier" && s.imported.type === "Identifier" && s.imported.name === "promises" && s.local.name !== "promises");
|
|
@@ -372,7 +369,7 @@ var pad_after_last_import_default = createEslintRule({
|
|
|
372
369
|
const firstCommentAfterTokenStartLine = sourceCode.getCommentsAfter(lastImportNode)[0]?.loc.start.line;
|
|
373
370
|
const expectedLine = lastImportNode.loc.end.line + 1;
|
|
374
371
|
const nextTokenStartLine = nextToken?.loc.start.line;
|
|
375
|
-
if (nextToken && nextToken.value !== "
|
|
372
|
+
if (nextToken && nextToken.value !== "<\/script>" && (expectedLine === nextTokenStartLine || expectedLine === firstCommentAfterTokenStartLine)) context.report({
|
|
376
373
|
node: lastImportNode,
|
|
377
374
|
messageId: "padAfterLastImport",
|
|
378
375
|
fix: (fixer) => fixer.insertTextAfter(lastImportNode, "\n")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@so1ve/eslint-plugin",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@typescript-eslint/types": "^8.
|
|
37
|
-
"@typescript-eslint/utils": "^8.
|
|
36
|
+
"@typescript-eslint/types": "^8.44.0",
|
|
37
|
+
"@typescript-eslint/utils": "^8.44.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"vue-eslint-parser": "^10.
|
|
40
|
+
"vue-eslint-parser": "^10.2.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsdown",
|