@so1ve/eslint-plugin 0.39.0 → 0.40.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 +2 -22
- package/dist/index.mjs +2 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,26 +33,6 @@ const genericSpacing = createEslintRule({
|
|
|
33
33
|
const preComma = pre.match(/(,)\s+$/)?.[0];
|
|
34
34
|
const post = sourceCode.text.slice(param.range[1]);
|
|
35
35
|
const postSpace = post.match(/^(\s*)/)?.[0];
|
|
36
|
-
const expectedIndent = node.parent.loc.start.column + 2;
|
|
37
|
-
if (param.loc.start.column !== expectedIndent && param.loc.start.line !== node.parent.loc.start.line) {
|
|
38
|
-
context.report({
|
|
39
|
-
node,
|
|
40
|
-
loc: {
|
|
41
|
-
start: {
|
|
42
|
-
line: param.loc.start.line,
|
|
43
|
-
column: 0
|
|
44
|
-
},
|
|
45
|
-
end: {
|
|
46
|
-
line: param.loc.start.line,
|
|
47
|
-
column: param.loc.start.column - 1
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
messageId: "genericSpacingMismatch",
|
|
51
|
-
*fix(fixer) {
|
|
52
|
-
yield fixer.replaceTextRange([param.range[0] + 2 - preSpace.length, param.range[0]], " ".repeat(node.parent.loc.start.column + 2));
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
36
|
if (preSpace && preSpace.length && !preComma && param.loc.start.line === node.loc.start.line) {
|
|
57
37
|
context.report({
|
|
58
38
|
node,
|
|
@@ -196,7 +176,7 @@ const genericSpacing = createEslintRule({
|
|
|
196
176
|
const preComma = pre.match(/(,)\s+$/)?.[0];
|
|
197
177
|
const post = sourceCode.text.slice(param.range[1]);
|
|
198
178
|
const postSpace = post.match(/^(\s*)/)?.[0];
|
|
199
|
-
if (preSpace && preSpace.length && !preComma) {
|
|
179
|
+
if (preSpace && preSpace.length && !preComma && param.loc.start.line === node.loc.start.line) {
|
|
200
180
|
context.report({
|
|
201
181
|
node,
|
|
202
182
|
loc: {
|
|
@@ -215,7 +195,7 @@ const genericSpacing = createEslintRule({
|
|
|
215
195
|
}
|
|
216
196
|
});
|
|
217
197
|
}
|
|
218
|
-
if (postSpace && postSpace.length) {
|
|
198
|
+
if (postSpace && postSpace.length && param.loc.end.line === node.loc.end.line) {
|
|
219
199
|
context.report({
|
|
220
200
|
loc: {
|
|
221
201
|
start: {
|
package/dist/index.mjs
CHANGED
|
@@ -31,26 +31,6 @@ const genericSpacing = createEslintRule({
|
|
|
31
31
|
const preComma = pre.match(/(,)\s+$/)?.[0];
|
|
32
32
|
const post = sourceCode.text.slice(param.range[1]);
|
|
33
33
|
const postSpace = post.match(/^(\s*)/)?.[0];
|
|
34
|
-
const expectedIndent = node.parent.loc.start.column + 2;
|
|
35
|
-
if (param.loc.start.column !== expectedIndent && param.loc.start.line !== node.parent.loc.start.line) {
|
|
36
|
-
context.report({
|
|
37
|
-
node,
|
|
38
|
-
loc: {
|
|
39
|
-
start: {
|
|
40
|
-
line: param.loc.start.line,
|
|
41
|
-
column: 0
|
|
42
|
-
},
|
|
43
|
-
end: {
|
|
44
|
-
line: param.loc.start.line,
|
|
45
|
-
column: param.loc.start.column - 1
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
messageId: "genericSpacingMismatch",
|
|
49
|
-
*fix(fixer) {
|
|
50
|
-
yield fixer.replaceTextRange([param.range[0] + 2 - preSpace.length, param.range[0]], " ".repeat(node.parent.loc.start.column + 2));
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
34
|
if (preSpace && preSpace.length && !preComma && param.loc.start.line === node.loc.start.line) {
|
|
55
35
|
context.report({
|
|
56
36
|
node,
|
|
@@ -194,7 +174,7 @@ const genericSpacing = createEslintRule({
|
|
|
194
174
|
const preComma = pre.match(/(,)\s+$/)?.[0];
|
|
195
175
|
const post = sourceCode.text.slice(param.range[1]);
|
|
196
176
|
const postSpace = post.match(/^(\s*)/)?.[0];
|
|
197
|
-
if (preSpace && preSpace.length && !preComma) {
|
|
177
|
+
if (preSpace && preSpace.length && !preComma && param.loc.start.line === node.loc.start.line) {
|
|
198
178
|
context.report({
|
|
199
179
|
node,
|
|
200
180
|
loc: {
|
|
@@ -213,7 +193,7 @@ const genericSpacing = createEslintRule({
|
|
|
213
193
|
}
|
|
214
194
|
});
|
|
215
195
|
}
|
|
216
|
-
if (postSpace && postSpace.length) {
|
|
196
|
+
if (postSpace && postSpace.length && param.loc.end.line === node.loc.end.line) {
|
|
217
197
|
context.report({
|
|
218
198
|
loc: {
|
|
219
199
|
start: {
|