@discourse/lint-configs 2.37.2 → 2.39.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/eslint-rules/test-filename-suffix.mjs +38 -0
- package/eslint.mjs +22 -31
- package/package.json +9 -9
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
3
|
+
function isTestFile(filename) {
|
|
4
|
+
return /tests?\/(javascripts\/)?(acceptance|integration|unit)/.test(filename);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function hasTestSuffix(filename) {
|
|
8
|
+
return path.parse(filename).name.endsWith("-test");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
meta: {
|
|
13
|
+
type: "problem",
|
|
14
|
+
docs: {
|
|
15
|
+
description: "Require test filenames to end with `-test`.",
|
|
16
|
+
},
|
|
17
|
+
schema: [], // no options
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
create(context) {
|
|
21
|
+
return {
|
|
22
|
+
Program(node) {
|
|
23
|
+
const filename = context.getFilename();
|
|
24
|
+
|
|
25
|
+
if (!isTestFile(filename)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!hasTestSuffix(filename)) {
|
|
30
|
+
context.report({
|
|
31
|
+
node,
|
|
32
|
+
message: "Test filenames must end with `-test`.",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
};
|
package/eslint.mjs
CHANGED
|
@@ -29,6 +29,7 @@ import noUnusedServices from "./eslint-rules/no-unused-services.mjs";
|
|
|
29
29
|
import pluginApiNoVersion from "./eslint-rules/plugin-api-no-version.mjs";
|
|
30
30
|
import serviceInjectImport from "./eslint-rules/service-inject-import.mjs";
|
|
31
31
|
import templateTagNoSelfThis from "./eslint-rules/template-tag-no-self-this.mjs";
|
|
32
|
+
import testFilenameSuffix from "./eslint-rules/test-filename-suffix.mjs";
|
|
32
33
|
import themeImports from "./eslint-rules/theme-imports.mjs";
|
|
33
34
|
import truthHelpersImports from "./eslint-rules/truth-helpers-imports.mjs";
|
|
34
35
|
|
|
@@ -55,6 +56,7 @@ export default [
|
|
|
55
56
|
useBabel: true,
|
|
56
57
|
requireConfigFile: false,
|
|
57
58
|
babelOptions: {
|
|
59
|
+
configFile: false,
|
|
58
60
|
plugins: [[decoratorsPluginPath, { legacy: true }]],
|
|
59
61
|
},
|
|
60
62
|
},
|
|
@@ -139,6 +141,7 @@ export default [
|
|
|
139
141
|
"no-route-template": noRouteTemplate,
|
|
140
142
|
"template-tag-no-self-this": templateTagNoSelfThis,
|
|
141
143
|
"moved-packages-import-paths": movedPackagesImportPaths,
|
|
144
|
+
"test-filename-suffix": testFilenameSuffix,
|
|
142
145
|
},
|
|
143
146
|
},
|
|
144
147
|
},
|
|
@@ -185,41 +188,28 @@ export default [
|
|
|
185
188
|
"import/no-duplicates": "error",
|
|
186
189
|
"object-shorthand": ["error", "properties"],
|
|
187
190
|
"no-dupe-class-members": "error",
|
|
188
|
-
"ember/no-
|
|
189
|
-
"ember/no-component-lifecycle-hooks": "off",
|
|
190
|
-
"ember/require-tagless-components": "off",
|
|
191
|
+
"ember/no-component-lifecycle-hooks": "off", // too much noise for now; classic components should be converted to glimmer wholesale instead
|
|
191
192
|
"ember/no-assignment-of-untracked-properties-used-in-tracking-contexts":
|
|
192
|
-
"off",
|
|
193
|
-
"ember/no-computed-properties-in-native-classes": "off",
|
|
194
|
-
"ember/
|
|
195
|
-
"ember/require-
|
|
196
|
-
"ember/require-return-from-computed": "off",
|
|
193
|
+
"off", // TODO? needs to understand `@trackedArray` though
|
|
194
|
+
"ember/no-computed-properties-in-native-classes": "off", // too many for now
|
|
195
|
+
"ember/require-computed-property-dependencies": "off", // we no longer recommend using @computed
|
|
196
|
+
"ember/require-return-from-computed": "off", // we no longer recommend using @computed
|
|
197
197
|
"ember/use-brace-expansion": "off", // we no longer recommend using @computed
|
|
198
198
|
"ember/no-deprecated-router-transition-methods": "off", // this rule is broken
|
|
199
|
-
"ember/
|
|
200
|
-
"ember/no-get": "off",
|
|
201
|
-
"ember/no-observers": "off",
|
|
199
|
+
"ember/no-get": "off", // TODO: still too many uses, and is required when crossing `@tracked`/`EmberObject` boundary
|
|
202
200
|
"ember/no-implicit-injections": "off", // this rule is broken
|
|
203
|
-
"ember/no-array-prototype-extensions": "off",
|
|
204
|
-
"ember/no-at-ember-render-modifiers": "off",
|
|
205
|
-
"ember/classic-decorator-hooks": "off",
|
|
206
|
-
"ember/classic-decorator-no-classic-methods": "off",
|
|
207
|
-
"ember/no-
|
|
208
|
-
"ember/no-
|
|
209
|
-
"ember/no-
|
|
210
|
-
"ember/no-
|
|
211
|
-
"ember/no-
|
|
212
|
-
"ember/no-controller-access-in-routes": "off",
|
|
213
|
-
"ember/no-shadow-route-definition": "off",
|
|
214
|
-
"ember/no-unnecessary-index-route": "off",
|
|
201
|
+
"ember/no-array-prototype-extensions": "off", // too many false-positives
|
|
202
|
+
"ember/no-at-ember-render-modifiers": "off", // TODO: @ember/render-modifiers are considered an anti-pattern
|
|
203
|
+
"ember/classic-decorator-hooks": "off", // too much noise; doesn't consider EmberObject/Controller/EmberComponent as classic w/o the decorator
|
|
204
|
+
"ember/classic-decorator-no-classic-methods": "off", // same as ember/classic-decorator-hooks
|
|
205
|
+
"ember/no-runloop": "off", // TODO: though not in the foreseeable future
|
|
206
|
+
"ember/no-capital-letters-in-routes": "off", // TODO: too many errors for now
|
|
207
|
+
"ember/no-controller-access-in-routes": "off", // TODO: maybe?
|
|
208
|
+
"ember/no-shadow-route-definition": "off", // TODO: but there seems to be a bug in the rule (a nested route can't shadow the parent)
|
|
209
|
+
"ember/no-unnecessary-index-route": "off", // the assumption made in this rule doesn't seem to be true in discourse router
|
|
215
210
|
"ember/no-unnecessary-service-injection-argument": "error",
|
|
216
|
-
"ember/route-path-style": "off",
|
|
217
|
-
"ember/routes-segments-snake-case": "off",
|
|
218
211
|
"ember/no-replace-test-comments": "error",
|
|
219
|
-
"qunit/no-
|
|
220
|
-
"qunit/no-conditional-assertions": "off",
|
|
221
|
-
"qunit/no-identical-names": "off",
|
|
222
|
-
"qunit/no-loose-assertions": "off",
|
|
212
|
+
"qunit/no-identical-names": "off", // the rule doesn't consider that tests might be in different `acceptance` modules
|
|
223
213
|
"sort-class-members/sort-class-members": [
|
|
224
214
|
"error",
|
|
225
215
|
{
|
|
@@ -316,8 +306,9 @@ export default [
|
|
|
316
306
|
"discourse/capital-components": ["error"],
|
|
317
307
|
"discourse/no-onclick": ["error"],
|
|
318
308
|
"discourse/template-tag-no-self-this": ["error"],
|
|
319
|
-
|
|
320
|
-
|
|
309
|
+
"discourse/no-route-template": ["error"],
|
|
310
|
+
"discourse/moved-packages-import-paths": ["error"],
|
|
311
|
+
"discourse/test-filename-suffix": ["error"],
|
|
321
312
|
},
|
|
322
313
|
},
|
|
323
314
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discourse/lint-configs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.39.0",
|
|
4
4
|
"description": "Shareable lint configs for Discourse core, plugins, and themes",
|
|
5
5
|
"author": "Discourse",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"./template-lint-rules": "./template-lint-rules/index.mjs"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@babel/core": "^7.
|
|
32
|
+
"@babel/core": "^7.29.0",
|
|
33
33
|
"@babel/eslint-parser": "^7.28.6",
|
|
34
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
34
|
+
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
35
35
|
"@eslint/js": "^9.39.2",
|
|
36
36
|
"ember-eslint-parser": "^0.5.13",
|
|
37
37
|
"ember-template-lint": "^7.9.3",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"eslint-plugin-qunit": "^8.2.5",
|
|
43
43
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
44
44
|
"eslint-plugin-sort-class-members": "^1.21.0",
|
|
45
|
-
"globals": "^17.
|
|
46
|
-
"prettier": "^3.8.
|
|
47
|
-
"prettier-plugin-ember-template-tag": "^2.1.
|
|
48
|
-
"stylelint": "^17.
|
|
45
|
+
"globals": "^17.3.0",
|
|
46
|
+
"prettier": "^3.8.1",
|
|
47
|
+
"prettier-plugin-ember-template-tag": "^2.1.3",
|
|
48
|
+
"stylelint": "^17.1.0",
|
|
49
49
|
"stylelint-config-standard": "^40.0.0",
|
|
50
50
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
51
51
|
"stylelint-scss": "^7.0.0",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"ember-template-lint": "7.9.3",
|
|
56
56
|
"eslint": "9.39.2",
|
|
57
|
-
"prettier": "3.8.
|
|
58
|
-
"stylelint": "17.
|
|
57
|
+
"prettier": "3.8.1",
|
|
58
|
+
"stylelint": "17.1.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"lint": "eslint --no-error-on-unmatched-pattern \"**/*.{cjs,mjs,js}\" && pnpm prettier --check \"**/*.{cjs,mjs,js}\"",
|