@discourse/lint-configs 2.26.0 → 2.28.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,40 @@
1
+ export default {
2
+ meta: {
3
+ type: "suggestion",
4
+ docs: {
5
+ description:
6
+ "remove the deprecated version argument from apiInitializer/withPluginApi calls",
7
+ },
8
+ fixable: "code",
9
+ schema: [], // no options
10
+ },
11
+
12
+ create(context) {
13
+ return {
14
+ CallExpression(node) {
15
+ if (
16
+ node.callee.name === "apiInitializer" ||
17
+ node.callee.name === "withPluginApi"
18
+ ) {
19
+ if (
20
+ node.arguments.length >= 2 &&
21
+ node.arguments[0].type === "Literal"
22
+ ) {
23
+ context.report({
24
+ node: node.arguments[0],
25
+ message: `Specifying plugin api version in ${node.callee.name} is no longer necessary`,
26
+ fix(fixer) {
27
+ const arg = node.arguments[0];
28
+ const punctuatorToken = context.sourceCode.getTokenAfter(arg);
29
+ const nextToken =
30
+ context.sourceCode.getTokenAfter(punctuatorToken);
31
+
32
+ return fixer.removeRange([arg.range[0], nextToken.range[0]]);
33
+ },
34
+ });
35
+ }
36
+ }
37
+ },
38
+ };
39
+ },
40
+ };
package/eslint.mjs CHANGED
@@ -23,6 +23,7 @@ import lineBeforeDefaultExport from "./eslint-rules/line-before-default-export.m
23
23
  import linesBetweenClassMembers from "./eslint-rules/lines-between-class-members.mjs";
24
24
  import noCurlyComponents from "./eslint-rules/no-curly-components.mjs";
25
25
  import noSimpleQuerySelector from "./eslint-rules/no-simple-query-selector.mjs";
26
+ import pluginApiNoVersion from "./eslint-rules/plugin-api-no-version.mjs";
26
27
  import serviceInjectImport from "./eslint-rules/service-inject-import.mjs";
27
28
  import themeImports from "./eslint-rules/theme-imports.mjs";
28
29
  import truthHelpersImports from "./eslint-rules/truth-helpers-imports.mjs";
@@ -118,6 +119,7 @@ export default [
118
119
  "i18n-t": i18nT,
119
120
  "service-inject-import": serviceInjectImport,
120
121
  "truth-helpers-imports": truthHelpersImports,
122
+ "plugin-api-no-version": pluginApiNoVersion,
121
123
  "theme-imports": themeImports,
122
124
  "no-simple-query-selector": noSimpleQuerySelector,
123
125
  "deprecated-lookups": deprecatedLookups,
@@ -153,7 +155,6 @@ export default [
153
155
  "no-iterator": "error",
154
156
  "no-loop-func": "error",
155
157
  "no-misleading-character-class": "off",
156
- "no-mixed-spaces-and-tabs": "error",
157
158
  "no-multi-str": "error",
158
159
  "no-new": "error",
159
160
  "no-proto": "error",
@@ -163,7 +164,6 @@ export default [
163
164
  "no-sequences": "error",
164
165
  "no-shadow": "error",
165
166
  "no-this-before-super": "error",
166
- "no-trailing-spaces": "error",
167
167
  "no-undef": "error",
168
168
  "no-unexpected-multiline": "off",
169
169
  "no-unused-vars": "error",
@@ -171,9 +171,7 @@ export default [
171
171
  "no-var": "error",
172
172
  "no-with": "error",
173
173
  radix: "error",
174
- semi: "error",
175
174
  "valid-typeof": "error",
176
- "wrap-iife": ["error", "inside"],
177
175
  curly: "error",
178
176
  "import/no-duplicates": "error",
179
177
  "object-shorthand": ["error", "properties"],
@@ -294,6 +292,7 @@ export default [
294
292
  "discourse/i18n-t": ["error"],
295
293
  "discourse/service-inject-import": ["error"],
296
294
  "discourse/truth-helpers-imports": ["error"],
295
+ "discourse/plugin-api-no-version": ["error"],
297
296
  "discourse/theme-imports": ["error"],
298
297
  "discourse/no-simple-query-selector": ["error"],
299
298
  "discourse/deprecated-lookups": ["error"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discourse/lint-configs",
3
- "version": "2.26.0",
3
+ "version": "2.28.0",
4
4
  "description": "Shareable lint configs for Discourse core, plugins, and themes",
5
5
  "author": "Discourse",
6
6
  "license": "MIT",