@discourse/lint-configs 2.17.1 → 2.18.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.
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function isCommentNode(node) {
|
|
2
|
+
return node.type === "Line" || node.type === "Block";
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
export default {
|
|
2
6
|
meta: {
|
|
3
7
|
type: "layout",
|
|
@@ -13,23 +17,33 @@ export default {
|
|
|
13
17
|
|
|
14
18
|
return {
|
|
15
19
|
ExportDefaultDeclaration(node) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const previousToken = sourceCode.getTokenBefore(targetNode, {
|
|
21
|
-
includeComments: true,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
if (!previousToken) {
|
|
25
|
-
return;
|
|
20
|
+
let targetNode = node;
|
|
21
|
+
if (node.declaration?.decorators?.length) {
|
|
22
|
+
targetNode = node.declaration.decorators[0];
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
let previousToken;
|
|
26
|
+
while (true) {
|
|
27
|
+
previousToken = sourceCode.getTokenBefore(targetNode, {
|
|
28
|
+
includeComments: true,
|
|
29
|
+
});
|
|
30
|
+
if (!previousToken) {
|
|
31
|
+
// Top of file, no need for newline
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const isPadded =
|
|
36
|
+
targetNode.loc.start.line - previousToken.loc.end.line > 1;
|
|
37
|
+
if (isPadded) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (isCommentNode(previousToken)) {
|
|
42
|
+
targetNode = previousToken;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
break;
|
|
33
47
|
}
|
|
34
48
|
|
|
35
49
|
context.report({
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
meta: {
|
|
3
|
+
type: "problem",
|
|
4
|
+
docs: {
|
|
5
|
+
description: "disallow api.registerConnectorClass() uses",
|
|
6
|
+
},
|
|
7
|
+
fixable: "code",
|
|
8
|
+
schema: [], // no options
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
create(context) {
|
|
12
|
+
return {
|
|
13
|
+
CallExpression(node) {
|
|
14
|
+
const { callee, arguments: args } = node;
|
|
15
|
+
|
|
16
|
+
if (
|
|
17
|
+
callee.type === "MemberExpression" &&
|
|
18
|
+
callee.property.name === "registerConnectorClass" &&
|
|
19
|
+
args.length === 3
|
|
20
|
+
) {
|
|
21
|
+
context.report({
|
|
22
|
+
node,
|
|
23
|
+
message:
|
|
24
|
+
"registerConnectorClass is deprecated. Create a glimmer component in a plugin connector directory or use renderInOutlet instead.",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
};
|
package/eslint.mjs
CHANGED
|
@@ -19,6 +19,7 @@ import i18nT from "./eslint-rules/i18n-t.mjs";
|
|
|
19
19
|
import lineAfterImports from "./eslint-rules/line-after-imports.mjs";
|
|
20
20
|
import lineBeforeDefaultExport from "./eslint-rules/line-before-default-export.mjs";
|
|
21
21
|
import linesBetweenClassMembers from "./eslint-rules/lines-between-class-members.mjs";
|
|
22
|
+
import noRegisterConnectorClass from "./eslint-rules/no-register-connector-class.mjs";
|
|
22
23
|
import noSimpleQuerySelector from "./eslint-rules/no-simple-query-selector.mjs";
|
|
23
24
|
import serviceInjectImport from "./eslint-rules/service-inject-import.mjs";
|
|
24
25
|
import truthHelpersImports from "./eslint-rules/truth-helpers-imports.mjs";
|
|
@@ -118,6 +119,7 @@ export default [
|
|
|
118
119
|
"deprecated-lookups": deprecatedLookups,
|
|
119
120
|
"discourse-common-imports": discourseCommonImports,
|
|
120
121
|
"lines-between-class-members": linesBetweenClassMembers,
|
|
122
|
+
"no-register-connector-class": noRegisterConnectorClass,
|
|
121
123
|
"line-after-imports": lineAfterImports,
|
|
122
124
|
"line-before-default-export": lineBeforeDefaultExport,
|
|
123
125
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discourse/lint-configs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Shareable lint configs for Discourse core, plugins, and themes",
|
|
5
5
|
"author": "Discourse",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,26 +33,26 @@
|
|
|
33
33
|
"@babel/core": "^7.27.1",
|
|
34
34
|
"@babel/eslint-parser": "^7.27.1",
|
|
35
35
|
"@babel/plugin-proposal-decorators": "^7.27.1",
|
|
36
|
-
"ember-template-lint": "^7.
|
|
37
|
-
"eslint": "^9.
|
|
36
|
+
"ember-template-lint": "^7.7.0",
|
|
37
|
+
"eslint": "^9.27.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",
|
|
41
41
|
"eslint-plugin-qunit": "^8.1.2",
|
|
42
42
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
43
43
|
"eslint-plugin-sort-class-members": "^1.21.0",
|
|
44
|
-
"globals": "^16.
|
|
44
|
+
"globals": "^16.1.0",
|
|
45
45
|
"prettier": "^3.5.3",
|
|
46
46
|
"prettier-plugin-ember-template-tag": "^2.0.5",
|
|
47
47
|
"stylelint": "^16.19.1",
|
|
48
48
|
"stylelint-config-standard": "^38.0.0",
|
|
49
|
-
"stylelint-config-standard-scss": "^
|
|
49
|
+
"stylelint-config-standard-scss": "^15.0.1",
|
|
50
50
|
"stylelint-scss": "^6.12.0",
|
|
51
51
|
"typescript": "^5.8.3"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"ember-template-lint": "7.
|
|
55
|
-
"eslint": "9.
|
|
54
|
+
"ember-template-lint": "7.7.0",
|
|
55
|
+
"eslint": "9.27.0",
|
|
56
56
|
"prettier": "3.5.3",
|
|
57
57
|
"stylelint": "16.19.1"
|
|
58
58
|
}
|