@discourse/lint-configs 2.13.2 → 2.15.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.
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
meta: {
|
|
3
|
+
type: "layout",
|
|
4
|
+
docs: {
|
|
5
|
+
description: "Require an empty line before the default export",
|
|
6
|
+
},
|
|
7
|
+
fixable: "whitespace",
|
|
8
|
+
schema: [], // no options
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
create(context) {
|
|
12
|
+
const sourceCode = context.sourceCode;
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
Program(node) {
|
|
16
|
+
const body = node.body;
|
|
17
|
+
const index = body.findIndex(
|
|
18
|
+
(n) => n.type === "ExportDefaultDeclaration"
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
if (index === -1 || index === 0) {
|
|
22
|
+
// No default export or starts with the export
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const currentToken = body[index];
|
|
27
|
+
const previousToken = sourceCode.getTokenBefore(currentToken);
|
|
28
|
+
|
|
29
|
+
const isPadded =
|
|
30
|
+
currentToken.loc.end.line - previousToken.loc.end.line > 1;
|
|
31
|
+
|
|
32
|
+
if (isPadded) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
context.report({
|
|
37
|
+
node: body[index],
|
|
38
|
+
message: "Expected blank line before the default export.",
|
|
39
|
+
|
|
40
|
+
fix(fixer) {
|
|
41
|
+
return fixer.insertTextAfter(previousToken, "\n");
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
};
|
package/eslint.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import discourseCommonImports from "./eslint-rules/discourse-common-imports.mjs"
|
|
|
17
17
|
import i18nImport from "./eslint-rules/i18n-import-location.mjs";
|
|
18
18
|
import i18nT from "./eslint-rules/i18n-t.mjs";
|
|
19
19
|
import lineAfterImports from "./eslint-rules/line-after-imports.mjs";
|
|
20
|
+
import lineBeforeDefaultExport from "./eslint-rules/line-before-default-export.mjs";
|
|
20
21
|
import linesBetweenClassMembers from "./eslint-rules/lines-between-class-members.mjs";
|
|
21
22
|
import noSimpleQuerySelector from "./eslint-rules/no-simple-query-selector.mjs";
|
|
22
23
|
import serviceInjectImport from "./eslint-rules/service-inject-import.mjs";
|
|
@@ -118,6 +119,7 @@ export default [
|
|
|
118
119
|
"discourse-common-imports": discourseCommonImports,
|
|
119
120
|
"lines-between-class-members": linesBetweenClassMembers,
|
|
120
121
|
"line-after-imports": lineAfterImports,
|
|
122
|
+
"line-before-default-export": lineBeforeDefaultExport,
|
|
121
123
|
},
|
|
122
124
|
},
|
|
123
125
|
},
|
|
@@ -291,6 +293,7 @@ export default [
|
|
|
291
293
|
"discourse/discourse-common-imports": ["error"],
|
|
292
294
|
"discourse/lines-between-class-members": ["error"],
|
|
293
295
|
"discourse/line-after-imports": ["error"],
|
|
296
|
+
"discourse/line-before-default-export": ["error"],
|
|
294
297
|
},
|
|
295
298
|
},
|
|
296
299
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discourse/lint-configs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "Shareable lint configs for Discourse core, plugins, and themes",
|
|
5
5
|
"author": "Discourse",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/core": "^7.26.10",
|
|
34
|
-
"@babel/eslint-parser": "^7.
|
|
34
|
+
"@babel/eslint-parser": "^7.27.0",
|
|
35
35
|
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
36
|
-
"ember-template-lint": "^7.0.
|
|
37
|
-
"eslint": "^9.
|
|
36
|
+
"ember-template-lint": "^7.0.7",
|
|
37
|
+
"eslint": "^9.24.0",
|
|
38
38
|
"eslint-plugin-decorator-position": "^6.0.0",
|
|
39
39
|
"eslint-plugin-ember": "^12.5.0",
|
|
40
40
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"eslint-plugin-sort-class-members": "^1.21.0",
|
|
44
44
|
"globals": "^16.0.0",
|
|
45
45
|
"prettier": "^3.5.3",
|
|
46
|
-
"prettier-plugin-ember-template-tag": "^2.0.
|
|
47
|
-
"stylelint": "^16.
|
|
48
|
-
"stylelint-config-standard": "^
|
|
46
|
+
"prettier-plugin-ember-template-tag": "^2.0.5",
|
|
47
|
+
"stylelint": "^16.18.0",
|
|
48
|
+
"stylelint-config-standard": "^38.0.0",
|
|
49
49
|
"stylelint-config-standard-scss": "^14.0.0",
|
|
50
|
-
"typescript": "^5.8.
|
|
50
|
+
"typescript": "^5.8.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"ember-template-lint": "7.0.
|
|
54
|
-
"eslint": "9.
|
|
53
|
+
"ember-template-lint": "7.0.7",
|
|
54
|
+
"eslint": "9.24.0",
|
|
55
55
|
"prettier": "3.5.3",
|
|
56
|
-
"stylelint": "16.
|
|
56
|
+
"stylelint": "16.18.0"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/template-lint.config.cjs
CHANGED