@so1ve/eslint-plugin 0.58.0 → 0.60.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 +53 -13
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +53 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4,19 +4,19 @@ const utils = require('@typescript-eslint/utils');
|
|
|
4
4
|
|
|
5
5
|
const createEslintRule = utils.ESLintUtils.RuleCreator((ruleName) => ruleName);
|
|
6
6
|
|
|
7
|
-
const RULE_NAME$
|
|
7
|
+
const RULE_NAME$3 = "import-dedupe";
|
|
8
8
|
const importDedupe = createEslintRule({
|
|
9
|
-
name: RULE_NAME$
|
|
9
|
+
name: RULE_NAME$3,
|
|
10
10
|
meta: {
|
|
11
11
|
type: "problem",
|
|
12
12
|
docs: {
|
|
13
|
-
description: "Fix duplication in imports",
|
|
13
|
+
description: "Fix duplication in imports.",
|
|
14
14
|
recommended: "error"
|
|
15
15
|
},
|
|
16
16
|
fixable: "code",
|
|
17
17
|
schema: [],
|
|
18
18
|
messages: {
|
|
19
|
-
importDedupe: "Expect no duplication in imports"
|
|
19
|
+
importDedupe: "Expect no duplication in imports."
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
defaultOptions: [],
|
|
@@ -54,19 +54,19 @@ const importDedupe = createEslintRule({
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
const RULE_NAME$
|
|
57
|
+
const RULE_NAME$2 = "no-inline-type-import";
|
|
58
58
|
const noInlineTypeImport = createEslintRule({
|
|
59
|
-
name: RULE_NAME$
|
|
59
|
+
name: RULE_NAME$2,
|
|
60
60
|
meta: {
|
|
61
61
|
type: "layout",
|
|
62
62
|
docs: {
|
|
63
|
-
description: "Disallow inline type import",
|
|
63
|
+
description: "Disallow inline type import.",
|
|
64
64
|
recommended: "error"
|
|
65
65
|
},
|
|
66
66
|
fixable: "code",
|
|
67
67
|
schema: [],
|
|
68
68
|
messages: {
|
|
69
|
-
noInlineTypeImport: "Expected no inline type import"
|
|
69
|
+
noInlineTypeImport: "Expected no inline type import."
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
defaultOptions: [],
|
|
@@ -106,19 +106,19 @@ import { ${valueSpecifiersText} } from "${node.source.value}";`
|
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
const RULE_NAME = "no-useless-template-string";
|
|
109
|
+
const RULE_NAME$1 = "no-useless-template-string";
|
|
110
110
|
const noUselessTemplateString = createEslintRule({
|
|
111
|
-
name: RULE_NAME,
|
|
111
|
+
name: RULE_NAME$1,
|
|
112
112
|
meta: {
|
|
113
113
|
type: "problem",
|
|
114
114
|
docs: {
|
|
115
|
-
description: "No useless template string",
|
|
115
|
+
description: "No useless template string.",
|
|
116
116
|
recommended: "error"
|
|
117
117
|
},
|
|
118
118
|
fixable: "code",
|
|
119
119
|
schema: [],
|
|
120
120
|
messages: {
|
|
121
|
-
noUselessTemplateString: "No useless template string"
|
|
121
|
+
noUselessTemplateString: "No useless template string."
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
defaultOptions: [],
|
|
@@ -142,11 +142,51 @@ const noUselessTemplateString = createEslintRule({
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
+
const RULE_NAME = "pad-after-last-import";
|
|
146
|
+
const padAfterLastImport = createEslintRule({
|
|
147
|
+
name: RULE_NAME,
|
|
148
|
+
meta: {
|
|
149
|
+
type: "problem",
|
|
150
|
+
docs: {
|
|
151
|
+
description: "Pad after the last import.",
|
|
152
|
+
recommended: "error"
|
|
153
|
+
},
|
|
154
|
+
fixable: "code",
|
|
155
|
+
schema: [],
|
|
156
|
+
messages: {
|
|
157
|
+
padAfterLastImport: "Expected a blank line after the last import."
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
defaultOptions: [],
|
|
161
|
+
create: (context) => {
|
|
162
|
+
const sourceCode = context.getSourceCode();
|
|
163
|
+
let lastImportNode = null;
|
|
164
|
+
return {
|
|
165
|
+
ImportDeclaration(node) {
|
|
166
|
+
lastImportNode = node;
|
|
167
|
+
},
|
|
168
|
+
"Program:exit"() {
|
|
169
|
+
if (lastImportNode) {
|
|
170
|
+
const nextToken = sourceCode.getTokenAfter(lastImportNode);
|
|
171
|
+
if (lastImportNode.loc.end.line + 1 === nextToken.loc.start.line) {
|
|
172
|
+
context.report({
|
|
173
|
+
node: lastImportNode,
|
|
174
|
+
messageId: "padAfterLastImport",
|
|
175
|
+
fix: (fixer) => fixer.insertTextAfter(lastImportNode, "\n")
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
145
184
|
const index = {
|
|
146
185
|
rules: {
|
|
147
186
|
"import-dedupe": importDedupe,
|
|
148
187
|
"no-inline-type-import": noInlineTypeImport,
|
|
149
|
-
"no-useless-template-string": noUselessTemplateString
|
|
188
|
+
"no-useless-template-string": noUselessTemplateString,
|
|
189
|
+
"pad-after-last-import": padAfterLastImport
|
|
150
190
|
}
|
|
151
191
|
};
|
|
152
192
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
|
5
5
|
"import-dedupe": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"importDedupe", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
6
6
|
"no-inline-type-import": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noInlineTypeImport", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
7
7
|
"no-useless-template-string": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noUselessTemplateString", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
8
|
+
"pad-after-last-import": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"padAfterLastImport", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
|
|
8
9
|
};
|
|
9
10
|
};
|
|
10
11
|
|
package/dist/index.mjs
CHANGED
|
@@ -2,19 +2,19 @@ import { ESLintUtils } from '@typescript-eslint/utils';
|
|
|
2
2
|
|
|
3
3
|
const createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
|
|
4
4
|
|
|
5
|
-
const RULE_NAME$
|
|
5
|
+
const RULE_NAME$3 = "import-dedupe";
|
|
6
6
|
const importDedupe = createEslintRule({
|
|
7
|
-
name: RULE_NAME$
|
|
7
|
+
name: RULE_NAME$3,
|
|
8
8
|
meta: {
|
|
9
9
|
type: "problem",
|
|
10
10
|
docs: {
|
|
11
|
-
description: "Fix duplication in imports",
|
|
11
|
+
description: "Fix duplication in imports.",
|
|
12
12
|
recommended: "error"
|
|
13
13
|
},
|
|
14
14
|
fixable: "code",
|
|
15
15
|
schema: [],
|
|
16
16
|
messages: {
|
|
17
|
-
importDedupe: "Expect no duplication in imports"
|
|
17
|
+
importDedupe: "Expect no duplication in imports."
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
defaultOptions: [],
|
|
@@ -52,19 +52,19 @@ const importDedupe = createEslintRule({
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
const RULE_NAME$
|
|
55
|
+
const RULE_NAME$2 = "no-inline-type-import";
|
|
56
56
|
const noInlineTypeImport = createEslintRule({
|
|
57
|
-
name: RULE_NAME$
|
|
57
|
+
name: RULE_NAME$2,
|
|
58
58
|
meta: {
|
|
59
59
|
type: "layout",
|
|
60
60
|
docs: {
|
|
61
|
-
description: "Disallow inline type import",
|
|
61
|
+
description: "Disallow inline type import.",
|
|
62
62
|
recommended: "error"
|
|
63
63
|
},
|
|
64
64
|
fixable: "code",
|
|
65
65
|
schema: [],
|
|
66
66
|
messages: {
|
|
67
|
-
noInlineTypeImport: "Expected no inline type import"
|
|
67
|
+
noInlineTypeImport: "Expected no inline type import."
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
defaultOptions: [],
|
|
@@ -104,19 +104,19 @@ import { ${valueSpecifiersText} } from "${node.source.value}";`
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
const RULE_NAME = "no-useless-template-string";
|
|
107
|
+
const RULE_NAME$1 = "no-useless-template-string";
|
|
108
108
|
const noUselessTemplateString = createEslintRule({
|
|
109
|
-
name: RULE_NAME,
|
|
109
|
+
name: RULE_NAME$1,
|
|
110
110
|
meta: {
|
|
111
111
|
type: "problem",
|
|
112
112
|
docs: {
|
|
113
|
-
description: "No useless template string",
|
|
113
|
+
description: "No useless template string.",
|
|
114
114
|
recommended: "error"
|
|
115
115
|
},
|
|
116
116
|
fixable: "code",
|
|
117
117
|
schema: [],
|
|
118
118
|
messages: {
|
|
119
|
-
noUselessTemplateString: "No useless template string"
|
|
119
|
+
noUselessTemplateString: "No useless template string."
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
defaultOptions: [],
|
|
@@ -140,11 +140,51 @@ const noUselessTemplateString = createEslintRule({
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
+
const RULE_NAME = "pad-after-last-import";
|
|
144
|
+
const padAfterLastImport = createEslintRule({
|
|
145
|
+
name: RULE_NAME,
|
|
146
|
+
meta: {
|
|
147
|
+
type: "problem",
|
|
148
|
+
docs: {
|
|
149
|
+
description: "Pad after the last import.",
|
|
150
|
+
recommended: "error"
|
|
151
|
+
},
|
|
152
|
+
fixable: "code",
|
|
153
|
+
schema: [],
|
|
154
|
+
messages: {
|
|
155
|
+
padAfterLastImport: "Expected a blank line after the last import."
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
defaultOptions: [],
|
|
159
|
+
create: (context) => {
|
|
160
|
+
const sourceCode = context.getSourceCode();
|
|
161
|
+
let lastImportNode = null;
|
|
162
|
+
return {
|
|
163
|
+
ImportDeclaration(node) {
|
|
164
|
+
lastImportNode = node;
|
|
165
|
+
},
|
|
166
|
+
"Program:exit"() {
|
|
167
|
+
if (lastImportNode) {
|
|
168
|
+
const nextToken = sourceCode.getTokenAfter(lastImportNode);
|
|
169
|
+
if (lastImportNode.loc.end.line + 1 === nextToken.loc.start.line) {
|
|
170
|
+
context.report({
|
|
171
|
+
node: lastImportNode,
|
|
172
|
+
messageId: "padAfterLastImport",
|
|
173
|
+
fix: (fixer) => fixer.insertTextAfter(lastImportNode, "\n")
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
143
182
|
const index = {
|
|
144
183
|
rules: {
|
|
145
184
|
"import-dedupe": importDedupe,
|
|
146
185
|
"no-inline-type-import": noInlineTypeImport,
|
|
147
|
-
"no-useless-template-string": noUselessTemplateString
|
|
186
|
+
"no-useless-template-string": noUselessTemplateString,
|
|
187
|
+
"pad-after-last-import": padAfterLastImport
|
|
148
188
|
}
|
|
149
189
|
};
|
|
150
190
|
|