@discourse/lint-configs 2.17.0 → 2.17.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.
|
@@ -12,29 +12,28 @@ export default {
|
|
|
12
12
|
const sourceCode = context.sourceCode;
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
ExportDefaultDeclaration(node) {
|
|
16
|
+
const declaration = node.declaration;
|
|
17
|
+
const decorators = declaration?.decorators || [];
|
|
18
|
+
const targetNode = decorators.length > 0 ? decorators[0] : node;
|
|
19
|
+
|
|
20
|
+
const previousToken = sourceCode.getTokenBefore(targetNode, {
|
|
21
|
+
includeComments: true,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (!previousToken) {
|
|
23
25
|
return;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
const currentToken = body[index];
|
|
27
|
-
const previousToken = sourceCode.getTokenBefore(currentToken);
|
|
28
|
-
|
|
29
28
|
const isPadded =
|
|
30
|
-
|
|
29
|
+
targetNode.loc.start.line - previousToken.loc.end.line > 1;
|
|
31
30
|
|
|
32
31
|
if (isPadded) {
|
|
33
32
|
return;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
context.report({
|
|
37
|
-
node:
|
|
36
|
+
node: targetNode,
|
|
38
37
|
message: "Expected blank line before the default export.",
|
|
39
38
|
|
|
40
39
|
fix(fixer) {
|