@comment-labs/oxlint-config 1.0.5 → 1.0.7

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.
Files changed (49) hide show
  1. package/dist/index.d.mts +0 -2
  2. package/dist/index.mjs +17 -27
  3. package/dist/index.mjs.map +1 -1
  4. package/dist/plugins/brettz9.d.mts +4 -2
  5. package/dist/plugins/brettz9.mjs +7 -1
  6. package/dist/plugins/brettz9.mjs.map +1 -0
  7. package/dist/plugins/e18e.d.mts +4 -2
  8. package/dist/plugins/e18e.mjs +7 -1
  9. package/dist/plugins/e18e.mjs.map +1 -0
  10. package/dist/plugins/i18next.d.mts +0 -2
  11. package/dist/plugins/i18next.mjs +5 -10
  12. package/dist/plugins/i18next.mjs.map +1 -1
  13. package/dist/plugins/import-zod.d.mts +4 -2
  14. package/dist/plugins/import-zod.mjs +7 -1
  15. package/dist/plugins/import-zod.mjs.map +1 -0
  16. package/dist/plugins/jsdoc.d.mts +4 -2
  17. package/dist/plugins/jsdoc.mjs +7 -1
  18. package/dist/plugins/jsdoc.mjs.map +1 -0
  19. package/dist/plugins/labs.d.mts +0 -2
  20. package/dist/plugins/labs.mjs +2 -4
  21. package/dist/plugins/labs.mjs.map +1 -1
  22. package/dist/plugins/playwright.d.mts +4 -2
  23. package/dist/plugins/playwright.mjs +7 -1
  24. package/dist/plugins/playwright.mjs.map +1 -0
  25. package/dist/plugins/react-hooks.d.mts +4 -2
  26. package/dist/plugins/react-hooks.mjs +7 -1
  27. package/dist/plugins/react-hooks.mjs.map +1 -0
  28. package/dist/plugins/react-native.d.mts +4 -2
  29. package/dist/plugins/react-native.mjs +7 -1
  30. package/dist/plugins/react-native.mjs.map +1 -0
  31. package/dist/plugins/react-refresh.d.mts +4 -2
  32. package/dist/plugins/react-refresh.mjs +7 -1
  33. package/dist/plugins/react-refresh.mjs.map +1 -0
  34. package/dist/plugins/regexp.d.mts +4 -2
  35. package/dist/plugins/regexp.mjs +7 -1
  36. package/dist/plugins/regexp.mjs.map +1 -0
  37. package/dist/plugins/security.d.mts +4 -2
  38. package/dist/plugins/security.mjs +7 -1
  39. package/dist/plugins/security.mjs.map +1 -0
  40. package/dist/plugins/stylistic.d.mts +4 -2
  41. package/dist/plugins/stylistic.mjs +7 -1
  42. package/dist/plugins/stylistic.mjs.map +1 -0
  43. package/dist/plugins/unicorn.d.mts +4 -2
  44. package/dist/plugins/unicorn.mjs +7 -1
  45. package/dist/plugins/unicorn.mjs.map +1 -0
  46. package/dist/sanitize-plugin-DZgftcJx.mjs +38 -0
  47. package/dist/sanitize-plugin-DZgftcJx.mjs.map +1 -0
  48. package/dist/sanitize-plugin-DfbJP7oI.d.mts +10 -0
  49. package/package.json +12 -12
@@ -0,0 +1,38 @@
1
+ // src/sanitize-plugin.ts
2
+ function truncateDefaultOptions(rule) {
3
+ const defaultOptions = rule?.meta?.defaultOptions;
4
+ if (!Array.isArray(defaultOptions)) return rule;
5
+ const index = defaultOptions.findIndex((option) => option === null || option === void 0);
6
+ if (index === -1) return rule;
7
+ return {
8
+ ...rule,
9
+ meta: {
10
+ ...rule?.meta,
11
+ defaultOptions: defaultOptions.slice(0, index)
12
+ }
13
+ };
14
+ }
15
+ /**
16
+ * Wraps an ESLint plugin so oxlint can register it regardless of which ESLint
17
+ * version the consumer resolves. Some plugins derive `meta.defaultOptions` from
18
+ * a peer ESLint core rule at runtime (e.g. eslint-plugin-unicorn's
19
+ * `logical-assignment-operators` reads `baseRule.meta.defaultOptions?.[0]`),
20
+ * which yields `[undefined]` — serialized as `[null]` — when that core rule has
21
+ * no `defaultOptions` (ESLint 9 and older). oxlint validates rule defaults
22
+ * against the rule schema at plugin registration and refuses to load the whole
23
+ * plugin over it. Each rule's `defaultOptions` is truncated at the first
24
+ * nullish entry, preserving the valid prefix; rules without nullish entries
25
+ * are kept as-is, by reference.
26
+ */
27
+ function sanitizePlugin(plugin) {
28
+ const { rules } = plugin;
29
+ if (rules === void 0) return plugin;
30
+ const sanitizedRules = Object.fromEntries(Object.entries(rules).map(([name, rule]) => [name, truncateDefaultOptions(rule)]));
31
+ return {
32
+ ...plugin,
33
+ rules: sanitizedRules
34
+ };
35
+ }
36
+ export { sanitizePlugin as t };
37
+
38
+ //# sourceMappingURL=sanitize-plugin-DZgftcJx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-plugin-DZgftcJx.mjs","names":[],"sources":["../src/sanitize-plugin.ts"],"sourcesContent":["export interface SanitizableRule {\n meta?: { defaultOptions?: unknown[] } | null\n}\n\nexport interface SanitizablePlugin {\n rules?: Record<string, SanitizableRule | undefined>\n}\n\nfunction truncateDefaultOptions(rule: SanitizableRule | undefined): SanitizableRule | undefined {\n const defaultOptions = rule?.meta?.defaultOptions\n\n if (!Array.isArray(defaultOptions)) {\n return rule\n }\n\n const index = defaultOptions.findIndex(option => option === null || option === undefined)\n\n if (index === -1) {\n return rule\n }\n\n return { ...rule, meta: { ...rule?.meta, defaultOptions: defaultOptions.slice(0, index) } }\n}\n\n/**\n * Wraps an ESLint plugin so oxlint can register it regardless of which ESLint\n * version the consumer resolves. Some plugins derive `meta.defaultOptions` from\n * a peer ESLint core rule at runtime (e.g. eslint-plugin-unicorn's\n * `logical-assignment-operators` reads `baseRule.meta.defaultOptions?.[0]`),\n * which yields `[undefined]` — serialized as `[null]` — when that core rule has\n * no `defaultOptions` (ESLint 9 and older). oxlint validates rule defaults\n * against the rule schema at plugin registration and refuses to load the whole\n * plugin over it. Each rule's `defaultOptions` is truncated at the first\n * nullish entry, preserving the valid prefix; rules without nullish entries\n * are kept as-is, by reference.\n */\nexport function sanitizePlugin(plugin: unknown): SanitizablePlugin {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const { rules } = plugin as SanitizablePlugin\n\n if (rules === undefined) {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return plugin as SanitizablePlugin\n }\n\n const sanitizedRules = Object.fromEntries(\n Object.entries(rules).map(([ name, rule ]) => [ name, truncateDefaultOptions(rule) ])\n )\n\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return { ...(plugin as SanitizablePlugin), rules: sanitizedRules }\n}\n"],"mappings":";AAQA,SAAS,uBAAuB,MAAgE;CAC9F,MAAM,iBAAiB,MAAM,MAAM;CAEnC,IAAI,CAAC,MAAM,QAAQ,cAAc,GAC/B,OAAO;CAGT,MAAM,QAAQ,eAAe,WAAU,WAAU,WAAW,QAAQ,WAAW,KAAA,CAAS;CAExF,IAAI,UAAU,IACZ,OAAO;CAGT,OAAO;EAAE,GAAG;EAAM,MAAM;GAAE,GAAG,MAAM;GAAM,gBAAgB,eAAe,MAAM,GAAG,KAAK;EAAE;CAAE;AAC5F;;;;;;;;;;;;;AAcA,SAAgB,eAAe,QAAoC;CAEjE,MAAM,EAAE,UAAU;CAElB,IAAI,UAAU,KAAA,GAEZ,OAAO;CAGT,MAAM,iBAAiB,OAAO,YAC5B,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAE,MAAM,UAAW,CAAE,MAAM,uBAAuB,IAAI,CAAE,CAAC,CACtF;CAGA,OAAO;EAAE,GAAI;EAA8B,OAAO;CAAe;AACnE"}
@@ -0,0 +1,10 @@
1
+ interface SanitizableRule {
2
+ meta?: {
3
+ defaultOptions?: unknown[];
4
+ } | null;
5
+ }
6
+ interface SanitizablePlugin {
7
+ rules?: Record<string, SanitizableRule | undefined>;
8
+ }
9
+ export { SanitizablePlugin as t };
10
+ //# sourceMappingURL=sanitize-plugin-DfbJP7oI.d.mts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@comment-labs/oxlint-config",
4
- "version": "1.0.5",
4
+ "version": "1.0.7",
5
5
  "description": "Oxlint configuration for comment-labs projects",
6
6
  "license": "Apache-2.0",
7
7
  "author": "CommEnt Team",
@@ -18,33 +18,33 @@
18
18
  "dependencies": {
19
19
  "@brettz9/eslint-plugin": "^3.0.0",
20
20
  "@e18e/eslint-plugin": "^0.8.1",
21
- "@stylistic/eslint-plugin": "^5.10.0",
21
+ "@stylistic/eslint-plugin": "^6.0.1",
22
22
  "empathic": "^2.1.0",
23
23
  "eslint-plugin-import-zod": "^1.2.1",
24
- "eslint-plugin-jsdoc": "^64.5.4",
25
- "eslint-plugin-playwright": "^2.12.0",
24
+ "eslint-plugin-jsdoc": "^65.5.0",
25
+ "eslint-plugin-playwright": "^2.12.2",
26
26
  "eslint-plugin-react-hooks": "^7.1.1",
27
27
  "eslint-plugin-react-native": "^5.0.0",
28
- "eslint-plugin-react-refresh": "^0.5.7",
29
- "eslint-plugin-regexp": "^3.3.1",
30
- "eslint-plugin-security": "^4.2.0",
28
+ "eslint-plugin-react-refresh": "^0.5.8",
29
+ "eslint-plugin-regexp": "^3.3.3",
30
+ "eslint-plugin-security": "^4.2.1",
31
31
  "eslint-plugin-unicorn": "^74.0.0",
32
- "globals": "^17.13.0"
32
+ "globals": "^17.14.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@comment-labs/tsconfig": "1.0.0-beta.8",
36
36
  "@types/eslint-plugin-security": "3.0.1",
37
37
  "@types/node": "25.9.5",
38
38
  "eslint": "10.11.0",
39
- "oxlint": "1.83.0",
40
- "oxlint-tsgolint": "7.0.2002",
39
+ "oxlint": "1.95.0",
40
+ "oxlint-tsgolint": "7.0.2008",
41
41
  "tsdown": "0.23.1",
42
42
  "typescript": "npm:typescript-native-bridge@6.0.3-bridge.12.tsgo.7.0.2",
43
43
  "vitest": "4.1.11"
44
44
  },
45
45
  "peerDependencies": {
46
- "oxlint": "^1.83.0",
47
- "oxlint-tsgolint": "^7.0.2002"
46
+ "oxlint": "^1.95.0",
47
+ "oxlint-tsgolint": "^7.0.2008"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"