@open-xchange/linter-presets 1.18.4 → 1.18.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.18.5` – 2026-Mar-19
4
+
5
+ - added: (ESLint) rules `@eslint-react/jsx-dollar`
6
+ - chore: bump dependencies
7
+
3
8
  ## `1.18.4` – 2026-Mar-17
4
9
 
5
10
  - added: (ESLint/StyleLint) ignore top-level 'output' directory
@@ -3,7 +3,7 @@ import reactHooksPlugin from 'eslint-plugin-react-hooks';
3
3
  import { reactRefresh } from 'eslint-plugin-react-refresh';
4
4
  import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
5
5
  import { parser } from 'typescript-eslint';
6
- import { createConfig, customRules, convertRuleWarningsToErrors } from "../shared/env-utils.js";
6
+ import { createConfig, customRules, convertRuleWarningsToErrors, mergeSettings } from "../shared/env-utils.js";
7
7
  // functions ==================================================================
8
8
  /**
9
9
  * Creates configuration objects with linter rules for ReactJS.
@@ -22,6 +22,16 @@ import { createConfig, customRules, convertRuleWarningsToErrors } from "../share
22
22
  */
23
23
  export default function react(envOptions) {
24
24
  const reactConfig = reactPlugin.configs['strict-type-checked'];
25
+ // extend shared plugin settings
26
+ const settings = { ...reactConfig.settings };
27
+ if (envOptions.effectHooks?.length) {
28
+ const additionalEffectHooks = `^(${envOptions.effectHooks.join('|')})$`;
29
+ mergeSettings(settings, 'react-hooks', { additionalEffectHooks });
30
+ }
31
+ if (envOptions.stateHooks?.length) {
32
+ const additionalStateHooks = `^(${envOptions.stateHooks.join('|')})$`;
33
+ mergeSettings(settings, 'react-x', { additionalStateHooks });
34
+ }
25
35
  return [
26
36
  // configure 'react' plugin for all source files (JSX and TSX)
27
37
  createConfig('env.react.recommended', envOptions, {
@@ -33,21 +43,10 @@ export default function react(envOptions) {
33
43
  // register rule implementations and language settings, raise all recommended rules to 'error' level
34
44
  ...convertRuleWarningsToErrors(reactConfig),
35
45
  // additional settings
36
- settings: {
37
- ...reactConfig.settings,
38
- ...(envOptions.effectHooks?.length ? {
39
- 'react-hooks': {
40
- additionalEffectHooks: `^(${envOptions.effectHooks.join('|')})$`,
41
- },
42
- } : undefined),
43
- ...(envOptions.stateHooks?.length ? {
44
- 'react-x': {
45
- additionalStateHooks: `^(${envOptions.stateHooks.join('|')})$`,
46
- },
47
- } : undefined),
48
- },
46
+ settings,
49
47
  }, {
50
48
  // custom overrides
49
+ '@eslint-react/jsx-dollar': 'error',
51
50
  '@eslint-react/jsx-no-iife': 'error',
52
51
  '@eslint-react/jsx-no-undef': 'error',
53
52
  '@eslint-react/jsx-shorthand-boolean': 'error',
@@ -57,7 +56,9 @@ export default function react(envOptions) {
57
56
  '@eslint-react/no-useless-fragment': ['error', { allowEmptyFragment: true }],
58
57
  '@eslint-react/prefer-namespace-import': 'error',
59
58
  '@eslint-react/prefer-read-only-props': 'error',
59
+ // dom
60
60
  '@eslint-react/dom/no-unknown-property': 'error',
61
+ // naming-convention
61
62
  '@eslint-react/naming-convention/component-name': 'error',
62
63
  '@eslint-react/naming-convention/context-name': 'error',
63
64
  }),
@@ -284,6 +284,24 @@ export declare function fixMissingFilesOption(...configs: ConfigArg[]): Config[]
284
284
  export declare function convertRuleWarningsToErrors<T extends {
285
285
  rules?: Partial<RulesConfig>;
286
286
  }>(config: T): T;
287
+ /**
288
+ * Merges settings for a specific plugin in-place into a complete settings
289
+ * object.
290
+ *
291
+ * @param settings
292
+ * The settings object to be extended.
293
+ *
294
+ * @param plugin
295
+ * The name of the plugin whose settings will be extended (top-level property
296
+ * name in `settings`). Missing entries will be created on demand.
297
+ *
298
+ * @param props
299
+ * The settings properties to me merged into the plugin settings.
300
+ *
301
+ * @returns
302
+ * The extended settings object.
303
+ */
304
+ export declare function mergeSettings(settings: Record<string, unknown>, plugin: string, props: Record<string, unknown>): Record<string, unknown>;
287
305
  /**
288
306
  * Translates the stylistic option `dangle` to the configuration options for
289
307
  * 'comma-dangle' rules.
@@ -164,6 +164,28 @@ export function convertRuleWarningsToErrors(config) {
164
164
  })),
165
165
  } : config;
166
166
  }
167
+ /**
168
+ * Merges settings for a specific plugin in-place into a complete settings
169
+ * object.
170
+ *
171
+ * @param settings
172
+ * The settings object to be extended.
173
+ *
174
+ * @param plugin
175
+ * The name of the plugin whose settings will be extended (top-level property
176
+ * name in `settings`). Missing entries will be created on demand.
177
+ *
178
+ * @param props
179
+ * The settings properties to me merged into the plugin settings.
180
+ *
181
+ * @returns
182
+ * The extended settings object.
183
+ */
184
+ export function mergeSettings(settings, plugin, props) {
185
+ const pluginSettings = settings[plugin] ??= {};
186
+ Object.assign(pluginSettings, props);
187
+ return settings;
188
+ }
167
189
  /**
168
190
  * Translates the stylistic option `dangle` to the configuration options for
169
191
  * 'comma-dangle' rules.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/linter-presets",
3
- "version": "1.18.4",
3
+ "version": "1.18.5",
4
4
  "description": "Configuration presets for ESLint and StyleLint",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  "@stylistic/stylelint-config": "^4.0.0",
37
37
  "@stylistic/stylelint-plugin": "^5.0.1",
38
38
  "@types/picomatch": "^4.0.2",
39
- "@vitest/eslint-plugin": "^1.6.10",
39
+ "@vitest/eslint-plugin": "^1.6.12",
40
40
  "@vue/eslint-config-typescript": "^14.7.0",
41
41
  "confusing-browser-globals": "^1.0.11",
42
42
  "empathic": "^2.0.0",
@@ -48,7 +48,7 @@
48
48
  "eslint-plugin-jest-dom": "^5.5.0",
49
49
  "eslint-plugin-jest-extended": "^3.0.1",
50
50
  "eslint-plugin-jsdoc": "^62.8.0",
51
- "eslint-plugin-jsonc": "^3.1.1",
51
+ "eslint-plugin-jsonc": "^3.1.2",
52
52
  "eslint-plugin-jsx-a11y": "^6.10.2",
53
53
  "eslint-plugin-license-header": "^0.9.0",
54
54
  "eslint-plugin-n": "^17.24.0",
@@ -68,13 +68,13 @@
68
68
  "stylelint-config-standard-scss": "^17.0.0",
69
69
  "stylelint-config-standard-vue": "^1.0.0",
70
70
  "stylelint-plugin-license-header": "^1.0.3",
71
- "typescript-eslint": "^8.57.0"
71
+ "typescript-eslint": "^8.57.1"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@jest/globals": "^30.3.0",
75
75
  "@types/confusing-browser-globals": "^1.0.3",
76
76
  "@types/react": "^19.2.14",
77
- "@typescript-eslint/utils": "^8.57.0",
77
+ "@typescript-eslint/utils": "^8.57.1",
78
78
  "eslint": "^9.39.4",
79
79
  "jest": "^30.3.0",
80
80
  "stylelint": "^17.4.0",