@imranbarbhuiya/oxc-config 0.0.1 → 0.1.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.
Files changed (69) hide show
  1. package/README.md +119 -156
  2. package/dist/api-error.d.ts +7 -2
  3. package/dist/api-error.js +6 -5
  4. package/dist/api-error.js.map +1 -1
  5. package/dist/central-icons.d.ts +7 -2
  6. package/dist/central-icons.js +6 -5
  7. package/dist/central-icons.js.map +1 -1
  8. package/dist/cli/index.d.ts +1 -0
  9. package/dist/cli/index.js +523 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/common.d.ts +8 -2
  12. package/dist/common.js +36 -52
  13. package/dist/common.js.map +1 -1
  14. package/dist/config.d.ts +8 -0
  15. package/dist/config.js +31 -0
  16. package/dist/config.js.map +1 -0
  17. package/dist/edge.d.ts +5 -2
  18. package/dist/edge.js +14 -10
  19. package/dist/edge.js.map +1 -1
  20. package/dist/i18n.d.ts +8 -2
  21. package/dist/i18n.js +6 -5
  22. package/dist/i18n.js.map +1 -1
  23. package/dist/jsdoc.d.ts +5 -2
  24. package/dist/jsdoc.js +18 -17
  25. package/dist/jsdoc.js.map +1 -1
  26. package/dist/jsx.d.ts +5 -2
  27. package/dist/jsx.js +24 -26
  28. package/dist/jsx.js.map +1 -1
  29. package/dist/module.d.ts +4 -2
  30. package/dist/module.js +6 -3
  31. package/dist/module.js.map +1 -1
  32. package/dist/native-tailwind.d.ts +7 -2
  33. package/dist/native-tailwind.js +6 -5
  34. package/dist/native-tailwind.js.map +1 -1
  35. package/dist/native.d.ts +51 -2
  36. package/dist/native.js +37 -43
  37. package/dist/native.js.map +1 -1
  38. package/dist/nest-plugin.d.ts +2 -0
  39. package/dist/nest-plugin.js +3 -0
  40. package/dist/nest.d.ts +5 -2
  41. package/dist/nest.js +7 -7
  42. package/dist/nest.js.map +1 -1
  43. package/dist/next.d.ts +4 -2
  44. package/dist/next.js +25 -25
  45. package/dist/next.js.map +1 -1
  46. package/dist/node.d.ts +8 -2
  47. package/dist/node.js +67 -74
  48. package/dist/node.js.map +1 -1
  49. package/dist/oxfmt.d.ts +13 -0
  50. package/dist/oxfmt.js +16 -0
  51. package/dist/oxfmt.js.map +1 -0
  52. package/dist/plugins/api-error.js +14 -14
  53. package/dist/plugins/api-error.js.map +1 -1
  54. package/dist/react.d.ts +14 -2
  55. package/dist/react.js +56 -58
  56. package/dist/react.js.map +1 -1
  57. package/dist/tailwind.d.ts +15 -2
  58. package/dist/tailwind.js +10 -9
  59. package/dist/tailwind.js.map +1 -1
  60. package/dist/tsdoc.d.ts +15 -2
  61. package/dist/tsdoc.js +14 -14
  62. package/dist/tsdoc.js.map +1 -1
  63. package/dist/typescript.d.ts +5 -2
  64. package/dist/typescript.js +155 -192
  65. package/dist/typescript.js.map +1 -1
  66. package/package.json +162 -178
  67. package/dist/mdx.d.ts +0 -6
  68. package/dist/mdx.js +0 -25
  69. package/dist/mdx.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"api-error.js","names":[],"sources":["../../src/plugins/api-error.ts"],"sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\n\nconst DEFAULT_ALLOWED_ERRORS = ['ApiError', 'FormValidationError'];\n\ntype Options = [\n\t{\n\t\tallowedErrors?: string[];\n\t},\n];\n\nconst requireApiError: TSESLint.RuleModule<'useApiError' | 'useApiErrorCall' | 'useApiErrorMember', Options> = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Require an allowed API error instead of Error inside queryFn/mutationFn so status codes propagate to QueryCache error handling',\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: 'object',\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tproperties: {\n\t\t\t\t\tallowedErrors: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { type: 'string', minLength: 1 },\n\t\t\t\t\t\tminItems: 1,\n\t\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tuseApiError:\n\t\t\t\t'Use `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of `new {{thrown}}(...)` inside {{fnType}}. This ensures the HTTP status code is available in QueryCache/retry/error reporting.',\n\t\t\tuseApiErrorCall:\n\t\t\t\t'Use `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of `{{thrown}}(...)` inside {{fnType}}. This ensures the HTTP status code is available in QueryCache/retry/error reporting.',\n\t\t\tuseApiErrorMember:\n\t\t\t\t'Throw `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of re-throwing `{{thrown}}` directly inside {{fnType}}. The client error object may lose its HTTP status code in QueryCache/retry/error reporting.',\n\t\t},\n\t},\n\tdefaultOptions: [{ allowedErrors: [...DEFAULT_ALLOWED_ERRORS] }],\n\tcreate(context) {\n\t\tconst sourceCode = context.sourceCode;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n\t\tconst allowedList = context.options[0]?.allowedErrors ?? DEFAULT_ALLOWED_ERRORS;\n\t\tconst allowedErrors = new Set(allowedList);\n\t\tconst allowedExample = allowedList[0] ?? DEFAULT_ALLOWED_ERRORS[0];\n\t\tconst fnStack: string[] = [];\n\t\tconst extractedRefs: { name: string; fnType: string }[] = [];\n\t\tconst moduleFns = new Map<string, TSESTree.Node>();\n\n\t\tfunction recordModuleFn(name: string | undefined, body: TSESTree.Node | null | undefined) {\n\t\t\tif (!name || !body) return;\n\t\t\tif (!moduleFns.has(name)) moduleFns.set(name, body);\n\t\t}\n\n\t\tfunction getStaticFactoryCallee(arg: TSESTree.ThrowStatement['argument']) {\n\t\t\tif (arg.type !== 'CallExpression') return undefined;\n\t\t\tconst { callee } = arg;\n\t\t\tif (callee.type !== 'MemberExpression' || callee.computed) return undefined;\n\t\t\tconst { object, property } = callee;\n\t\t\tif (object.type !== 'Identifier' || property.type !== 'Identifier') return undefined;\n\t\t\treturn { callee, name: object.name };\n\t\t}\n\n\t\tfunction isAllowedThrow(arg: TSESTree.ThrowStatement['argument']) {\n\t\t\tif (arg.type === 'NewExpression' && arg.callee.type === 'Identifier') return allowedErrors.has(arg.callee.name);\n\n\t\t\tconst factory = getStaticFactoryCallee(arg);\n\t\t\treturn factory !== undefined && allowedErrors.has(factory.name);\n\t\t}\n\n\t\tfunction checkThrowNode(node: TSESTree.ThrowStatement, fnType: string) {\n\t\t\tconst arg = node.argument;\n\t\t\tif (isAllowedThrow(arg)) return;\n\n\t\t\tif (arg.type === 'NewExpression' && arg.callee.type === 'Identifier') {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiError',\n\t\t\t\t\tdata: { thrown: arg.callee.name, fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst factory = getStaticFactoryCallee(arg);\n\t\t\tif (factory) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiErrorCall',\n\t\t\t\t\tdata: { thrown: sourceCode.getText(factory.callee), fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (arg.type === 'MemberExpression') {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiErrorMember',\n\t\t\t\t\tdata: { thrown: sourceCode.getText(arg), fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tfunction isAstNode(value: unknown): value is TSESTree.Node {\n\t\t\treturn typeof value === 'object' && value !== null && 'type' in value && typeof value.type === 'string';\n\t\t}\n\n\t\tfunction walkThrows(node: TSESTree.Node | null | undefined, fnType: string, visited = new Set<TSESTree.Node>()) {\n\t\t\tif (!node || visited.has(node)) return;\n\t\t\tvisited.add(node);\n\n\t\t\tif (node.type === 'ThrowStatement') {\n\t\t\t\tcheckThrowNode(node, fnType);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode.type === 'FunctionDeclaration' ||\n\t\t\t\tnode.type === 'FunctionExpression' ||\n\t\t\t\tnode.type === 'ArrowFunctionExpression'\n\t\t\t) {\n\t\t\t\twalkThrows(node.body, fnType, visited);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (const key of Object.keys(node)) {\n\t\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') continue;\n\t\t\t\tconst child = (node as unknown as Record<string, unknown>)[key];\n\t\t\t\tif (Array.isArray(child)) {\n\t\t\t\t\tfor (const c of child) if (isAstNode(c)) walkThrows(c, fnType, visited);\n\t\t\t\t} else if (isAstNode(child)) walkThrows(child, fnType, visited);\n\t\t\t}\n\t\t}\n\n\t\tfunction enterQueryOrMutationFn(node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression) {\n\t\t\tconst parent = node.parent;\n\t\t\tif (parent.type !== 'Property' || parent.key.type !== 'Identifier') return;\n\t\t\tconst name = parent.key.name;\n\t\t\tif (name === 'queryFn' || name === 'mutationFn') fnStack.push(name);\n\t\t}\n\n\t\tfunction exitQueryOrMutationFn(node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression) {\n\t\t\tconst parent = node.parent;\n\t\t\tif (parent.type !== 'Property' || parent.key.type !== 'Identifier') return;\n\t\t\tconst name = parent.key.name;\n\t\t\tif (name === 'queryFn' || name === 'mutationFn') fnStack.pop();\n\t\t}\n\n\t\tfunction checkThrowStatement(node: TSESTree.ThrowStatement) {\n\t\t\tif (fnStack.length === 0) return;\n\t\t\tcheckThrowNode(node, fnStack[fnStack.length - 1]);\n\t\t}\n\n\t\tfunction recordExtractedRef(prop: TSESTree.Property) {\n\t\t\tif (\n\t\t\t\tprop.key.type !== 'Identifier' ||\n\t\t\t\t(prop.key.name !== 'queryFn' && prop.key.name !== 'mutationFn') ||\n\t\t\t\tprop.value.type !== 'Identifier'\n\t\t\t)\n\t\t\t\treturn;\n\t\t\textractedRefs.push({ name: prop.value.name, fnType: prop.key.name });\n\t\t}\n\n\t\treturn {\n\t\t\t'Program > FunctionDeclaration'(node: TSESTree.FunctionDeclaration) {\n\t\t\t\trecordModuleFn(node.id?.name, node.body);\n\t\t\t},\n\t\t\t'Program > VariableDeclaration > VariableDeclarator'(node: TSESTree.VariableDeclarator) {\n\t\t\t\tif (\n\t\t\t\t\tnode.id.type === 'Identifier' &&\n\t\t\t\t\t(node.init?.type === 'ArrowFunctionExpression' || node.init?.type === 'FunctionExpression')\n\t\t\t\t)\n\t\t\t\t\trecordModuleFn(node.id.name, node.init.body);\n\t\t\t},\n\t\t\tArrowFunctionExpression: enterQueryOrMutationFn,\n\t\t\t'ArrowFunctionExpression:exit': exitQueryOrMutationFn,\n\t\t\tFunctionExpression: enterQueryOrMutationFn,\n\t\t\t'FunctionExpression:exit': exitQueryOrMutationFn,\n\t\t\tProperty: recordExtractedRef,\n\t\t\tThrowStatement: checkThrowStatement,\n\t\t\t'Program:exit'() {\n\t\t\t\tfor (const { name, fnType } of extractedRefs) {\n\t\t\t\t\tconst body = moduleFns.get(name);\n\t\t\t\t\tif (body) walkThrows(body, fnType);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst plugin: TSESLint.FlatConfig.Plugin = {\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-api-error',\n\t\tversion: '1.0.0',\n\t},\n\trules: {\n\t\t'require-api-error': requireApiError,\n\t},\n};\n\nexport default plugin;\n"],"mappings":";AAEA,MAAM,yBAAyB,CAAC,YAAY,qBAAqB;AA6LjE,MAAM,SAAqC;CAC1C,MAAM;EACL,MAAM;EACN,SAAS;CACV;CACA,OAAO,EACN,qBAAqB;EA1LtB,MAAM;GACL,MAAM;GACN,MAAM,EACL,aACC,iIACF;GACA,QAAQ,CACP;IACC,MAAM;IACN,sBAAsB;IACtB,YAAY,EACX,eAAe;KACd,MAAM;KACN,OAAO;MAAE,MAAM;MAAU,WAAW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TSESLint, TSESTree } from '@typescript-eslint/utils';\n\nconst DEFAULT_ALLOWED_ERRORS = ['ApiError', 'FormValidationError'];\n\nfunction getStaticFactoryCallee(arg: TSESTree.ThrowStatement['argument']) {\n\tif (arg.type !== 'CallExpression') return undefined;\n\tconst { callee } = arg;\n\tif (callee.type !== 'MemberExpression' || callee.computed) return undefined;\n\tconst { object, property } = callee;\n\tif (object.type !== 'Identifier' || property.type !== 'Identifier') return undefined;\n\treturn { callee, name: object.name };\n}\n\nfunction isAstNode(value: unknown): value is TSESTree.Node {\n\treturn typeof value === 'object' && value !== null && 'type' in value && typeof value.type === 'string';\n}\n\ntype Options = [\n\t{\n\t\tallowedErrors?: string[];\n\t},\n];\n\nconst requireApiError: TSESLint.RuleModule<'useApiError' | 'useApiErrorCall' | 'useApiErrorMember', Options> = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Require an allowed API error instead of Error inside queryFn/mutationFn so status codes propagate to QueryCache error handling',\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: 'object',\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tproperties: {\n\t\t\t\t\tallowedErrors: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { type: 'string', minLength: 1 },\n\t\t\t\t\t\tminItems: 1,\n\t\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tuseApiError:\n\t\t\t\t'Use `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of `new {{thrown}}(...)` inside {{fnType}}. This ensures the HTTP status code is available in QueryCache/retry/error reporting.',\n\t\t\tuseApiErrorCall:\n\t\t\t\t'Use `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of `{{thrown}}(...)` inside {{fnType}}. This ensures the HTTP status code is available in QueryCache/retry/error reporting.',\n\t\t\tuseApiErrorMember:\n\t\t\t\t'Throw `new {{allowed}}(...)` or `{{allowed}}.from(...)` instead of re-throwing `{{thrown}}` directly inside {{fnType}}. The client error object may lose its HTTP status code in QueryCache/retry/error reporting.',\n\t\t},\n\t},\n\tdefaultOptions: [{ allowedErrors: [...DEFAULT_ALLOWED_ERRORS] }],\n\tcreate(context) {\n\t\tconst sourceCode = context.sourceCode;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n\t\tconst allowedList = context.options[0]?.allowedErrors ?? DEFAULT_ALLOWED_ERRORS;\n\t\tconst allowedErrors = new Set(allowedList);\n\t\tconst allowedExample = allowedList[0] ?? DEFAULT_ALLOWED_ERRORS[0];\n\t\tconst fnStack: string[] = [];\n\t\tconst extractedRefs: { name: string; fnType: string }[] = [];\n\t\tconst moduleFns = new Map<string, TSESTree.Node>();\n\n\t\tfunction recordModuleFn(name: string | undefined, body: TSESTree.Node | null | undefined) {\n\t\t\tif (!name || !body) return;\n\t\t\tif (!moduleFns.has(name)) moduleFns.set(name, body);\n\t\t}\n\n\t\tfunction isAllowedThrow(arg: TSESTree.ThrowStatement['argument']) {\n\t\t\tif (arg.type === 'NewExpression' && arg.callee.type === 'Identifier') return allowedErrors.has(arg.callee.name);\n\n\t\t\tconst factory = getStaticFactoryCallee(arg);\n\t\t\treturn factory !== undefined && allowedErrors.has(factory.name);\n\t\t}\n\n\t\tfunction checkThrowNode(node: TSESTree.ThrowStatement, fnType: string) {\n\t\t\tconst arg = node.argument;\n\t\t\tif (isAllowedThrow(arg)) return;\n\n\t\t\tif (arg.type === 'NewExpression' && arg.callee.type === 'Identifier') {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiError',\n\t\t\t\t\tdata: { thrown: arg.callee.name, fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst factory = getStaticFactoryCallee(arg);\n\t\t\tif (factory) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiErrorCall',\n\t\t\t\t\tdata: { thrown: sourceCode.getText(factory.callee), fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (arg.type === 'MemberExpression') {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: arg,\n\t\t\t\t\tmessageId: 'useApiErrorMember',\n\t\t\t\t\tdata: { thrown: sourceCode.getText(arg), fnType, allowed: allowedExample },\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tfunction walkThrows(node: TSESTree.Node | null | undefined, fnType: string, visited = new Set<TSESTree.Node>()) {\n\t\t\tif (!node || visited.has(node)) return;\n\t\t\tvisited.add(node);\n\n\t\t\tif (node.type === 'ThrowStatement') {\n\t\t\t\tcheckThrowNode(node, fnType);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode.type === 'FunctionDeclaration' ||\n\t\t\t\tnode.type === 'FunctionExpression' ||\n\t\t\t\tnode.type === 'ArrowFunctionExpression'\n\t\t\t) {\n\t\t\t\twalkThrows(node.body, fnType, visited);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (const key of Object.keys(node)) {\n\t\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') continue;\n\t\t\t\tconst child = (node as unknown as Record<string, unknown>)[key];\n\t\t\t\tif (Array.isArray(child)) {\n\t\t\t\t\tfor (const c of child) if (isAstNode(c)) walkThrows(c, fnType, visited);\n\t\t\t\t} else if (isAstNode(child)) walkThrows(child, fnType, visited);\n\t\t\t}\n\t\t}\n\n\t\tfunction enterQueryOrMutationFn(node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression) {\n\t\t\tconst parent = node.parent;\n\t\t\tif (parent.type !== 'Property' || parent.key.type !== 'Identifier') return;\n\t\t\tconst name = parent.key.name;\n\t\t\tif (name === 'queryFn' || name === 'mutationFn') fnStack.push(name);\n\t\t}\n\n\t\tfunction exitQueryOrMutationFn(node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression) {\n\t\t\tconst parent = node.parent;\n\t\t\tif (parent.type !== 'Property' || parent.key.type !== 'Identifier') return;\n\t\t\tconst name = parent.key.name;\n\t\t\tif (name === 'queryFn' || name === 'mutationFn') fnStack.pop();\n\t\t}\n\n\t\tfunction checkThrowStatement(node: TSESTree.ThrowStatement) {\n\t\t\tif (fnStack.length === 0) return;\n\t\t\tcheckThrowNode(node, fnStack[fnStack.length - 1]);\n\t\t}\n\n\t\tfunction recordExtractedRef(prop: TSESTree.Property) {\n\t\t\tif (\n\t\t\t\tprop.key.type !== 'Identifier' ||\n\t\t\t\t(prop.key.name !== 'queryFn' && prop.key.name !== 'mutationFn') ||\n\t\t\t\tprop.value.type !== 'Identifier'\n\t\t\t)\n\t\t\t\treturn;\n\t\t\textractedRefs.push({ name: prop.value.name, fnType: prop.key.name });\n\t\t}\n\n\t\treturn {\n\t\t\t'Program > FunctionDeclaration'(node: TSESTree.FunctionDeclaration) {\n\t\t\t\trecordModuleFn(node.id?.name, node.body);\n\t\t\t},\n\t\t\t'Program > VariableDeclaration > VariableDeclarator'(node: TSESTree.VariableDeclarator) {\n\t\t\t\tif (\n\t\t\t\t\tnode.id.type === 'Identifier' &&\n\t\t\t\t\t(node.init?.type === 'ArrowFunctionExpression' || node.init?.type === 'FunctionExpression')\n\t\t\t\t)\n\t\t\t\t\trecordModuleFn(node.id.name, node.init.body);\n\t\t\t},\n\t\t\tArrowFunctionExpression: enterQueryOrMutationFn,\n\t\t\t'ArrowFunctionExpression:exit': exitQueryOrMutationFn,\n\t\t\tFunctionExpression: enterQueryOrMutationFn,\n\t\t\t'FunctionExpression:exit': exitQueryOrMutationFn,\n\t\t\tProperty: recordExtractedRef,\n\t\t\tThrowStatement: checkThrowStatement,\n\t\t\t'Program:exit'() {\n\t\t\t\tfor (const { name, fnType } of extractedRefs) {\n\t\t\t\t\tconst body = moduleFns.get(name);\n\t\t\t\t\tif (body) walkThrows(body, fnType);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst plugin: TSESLint.FlatConfig.Plugin = {\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-api-error',\n\t\tversion: '1.0.0',\n\t},\n\trules: {\n\t\t'require-api-error': requireApiError,\n\t},\n};\n\nexport default plugin;\n"],"mappings":";AAEA,MAAM,yBAAyB,CAAC,YAAY,qBAAqB;AAEjE,SAAS,uBAAuB,KAA0C;CACzE,IAAI,IAAI,SAAS,kBAAkB,OAAO;CAC1C,MAAM,EAAE,WAAW;CACnB,IAAI,OAAO,SAAS,sBAAsB,OAAO,UAAU,OAAO;CAClE,MAAM,EAAE,QAAQ,aAAa;CAC7B,IAAI,OAAO,SAAS,gBAAgB,SAAS,SAAS,cAAc,OAAO;CAC3E,OAAO;EAAE;EAAQ,MAAM,OAAO;CAAK;AACpC;AAEA,SAAS,UAAU,OAAwC;CAC1D,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,OAAO,MAAM,SAAS;AAChG;AAgLA,MAAM,SAAqC;CAC1C,MAAM;EACL,MAAM;EACN,SAAS;CACV;CACA,OAAO,EACN,qBAAqB;EA7KtB,MAAM;GACL,MAAM;GACN,MAAM,EACL,aACC,iIACF;GACA,QAAQ,CACP;IACC,MAAM;IACN,sBAAsB;IACtB,YAAY,EACX,eAAe;KACd,MAAM;KACN,OAAO;MAAE,MAAM;MAAU,WAAW;KAAE;KACtC,UAAU;KACV,aAAa;IACd,EACD;GACD,CACD;GACA,UAAU;IACT,aACC;IACD,iBACC;IACD,mBACC;GACF;EACD;EACA,gBAAgB,CAAC,EAAE,eAAe,CAAC,GAAG,sBAAsB,EAAE,CAAC;EAC/D,OAAO,SAAS;GACf,MAAM,aAAa,QAAQ;GAE3B,MAAM,cAAc,QAAQ,QAAQ,EAAE,EAAE,iBAAiB;GACzD,MAAM,gBAAgB,IAAI,IAAI,WAAW;GACzC,MAAM,iBAAiB,YAAY,MAAM,uBAAuB;GAChE,M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K,IAAI;IACxC;IACA,qDAAqD,MAAmC;KACvF,IACC,KAAK,GAAG,SAAS,iBAChB,KAAK,MAAM,SAAS,6BAA6B,KAAK,MAAM,SAAS,uBAEtE,eAAe,KAAK,GAAG,MAAM,KAAK,KAAK,IAAI;IAC7C;IACA,yBAAyB;IACzB,gCAAgC;IAChC,oBAAoB;IACpB,2BAA2B;IAC3B,UAAU;IACV,gBAAgB;IAChB,iBAAiB;KAChB,KAAK,MAAM,EAAE,MAAM,YAAY,eAAe;MAC7C,MAAM,OAAO,UAAU,IAAI,IAAI;MAC/B,IAAI,MAAM,WAAW,MAAM,MAAM;KAClC;IACD;GACD;EACD;CASoC,EACpC;AACD"}
package/dist/react.d.ts CHANGED
@@ -1,6 +1,18 @@
1
- import { TSESLint } from "@typescript-eslint/utils";
2
1
  //#region src/react.d.ts
3
- declare const config: TSESLint.FlatConfig.ConfigArray;
2
+ declare const config: {
3
+ extends: {
4
+ plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue")[];
5
+ jsPlugins: import("oxlint").ExternalPluginEntry[];
6
+ rules: import("oxlint").DummyRuleMap;
7
+ }[];
8
+ plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue")[];
9
+ jsPlugins: import("oxlint").ExternalPluginEntry[];
10
+ env: {
11
+ browser: true;
12
+ serviceworker: true;
13
+ };
14
+ rules: import("oxlint").DummyRuleMap;
15
+ };
4
16
  //#endregion
5
17
  export { config as default };
6
18
  //# sourceMappingURL=react.d.ts.map
package/dist/react.js CHANGED
@@ -1,64 +1,62 @@
1
+ import { nativePlugins, packagePlugin } from "./config.js";
1
2
  import config$1 from "./jsx.js";
2
- import globals from "globals";
3
- import eslintPluginReactHooks from "eslint-plugin-react-hooks";
3
+ import { defineConfig } from "oxlint";
4
4
 
5
5
  //#region src/react.ts
6
- const rules = {
7
- "react-hooks/exhaustive-deps": 2,
8
- "react-hooks/rules-of-hooks": 2,
9
- "react-hooks/immutability": 2,
10
- "react-hooks/purity": 2,
11
- "react-hooks/refs": 2,
12
- "react-hooks/set-state-in-render": 2,
13
- "react/boolean-prop-naming": 2,
14
- "react/button-has-type": 2,
15
- "react/hook-use-state": 2,
16
- "react/iframe-missing-sandbox": 2,
17
- "react/no-access-state-in-setstate": 2,
18
- "react/no-arrow-function-lifecycle": 2,
19
- "react/no-children-prop": 2,
20
- "react/no-danger": 2,
21
- "react/no-danger-with-children": 2,
22
- "react/no-deprecated": 2,
23
- "react/no-did-mount-set-state": 2,
24
- "react/no-did-update-set-state": 2,
25
- "react/no-direct-mutation-state": 2,
26
- "react/no-find-dom-node": 2,
27
- "react/no-invalid-html-attribute": 2,
28
- "react/no-is-mounted": 2,
29
- "react/no-namespace": 2,
30
- "react/no-redundant-should-component-update": 2,
31
- "react/no-render-return-value": 2,
32
- "react/no-set-state": 2,
33
- "react/no-string-refs": 2,
34
- "react/no-this-in-sfc": 2,
35
- "react/no-typos": 2,
36
- "react/no-unknown-property": 2,
37
- "react/no-unsafe": 2,
38
- "react/no-unstable-nested-components": 2,
39
- "react/no-unused-class-component-methods": 2,
40
- "react/no-unused-state": 2,
41
- "react/no-will-update-set-state": 2,
42
- "react/prefer-es6-class": 2,
43
- "react/prefer-read-only-props": 2,
44
- "react/prefer-stateless-function": [2, { ignorePureComponents: true }],
45
- "react/require-render-return": 2,
46
- "react/sort-comp": 2,
47
- "react/state-in-constructor": [2, "always"],
48
- "react/static-property-placement": 2,
49
- "react/void-dom-elements-no-children": 2
50
- };
51
- const settings = { react: { version: "detect" } };
52
- const config = [...config$1, {
53
- name: "mahir/react",
54
- languageOptions: { globals: {
55
- ...globals.serviceworker,
56
- ...globals.browser
57
- } },
58
- plugins: { "react-hooks": eslintPluginReactHooks },
59
- rules,
60
- settings
61
- }];
6
+ const config = defineConfig({
7
+ extends: [config$1],
8
+ plugins: nativePlugins,
9
+ jsPlugins: [packagePlugin("react-js", "eslint-plugin-react")],
10
+ env: {
11
+ browser: true,
12
+ serviceworker: true
13
+ },
14
+ rules: {
15
+ "react/exhaustive-deps": 2,
16
+ "react/rules-of-hooks": 2,
17
+ "react/immutability": 2,
18
+ "react/purity": 2,
19
+ "react/refs": 2,
20
+ "react/set-state-in-render": 2,
21
+ "react-js/boolean-prop-naming": 2,
22
+ "react/button-has-type": 2,
23
+ "react/hook-use-state": 2,
24
+ "react/iframe-missing-sandbox": 2,
25
+ "react-js/no-access-state-in-setstate": 2,
26
+ "react-js/no-arrow-function-lifecycle": 2,
27
+ "react/no-children-prop": 2,
28
+ "react/no-danger": 2,
29
+ "react/no-danger-with-children": 2,
30
+ "react-js/no-deprecated": 2,
31
+ "react/no-did-mount-set-state": 2,
32
+ "react/no-did-update-set-state": 2,
33
+ "react/no-direct-mutation-state": 2,
34
+ "react/no-find-dom-node": 2,
35
+ "react-js/no-invalid-html-attribute": 2,
36
+ "react/no-is-mounted": 2,
37
+ "react/no-namespace": 2,
38
+ "react/no-redundant-should-component-update": 2,
39
+ "react/no-render-return-value": 2,
40
+ "react/no-set-state": 2,
41
+ "react/no-string-refs": 2,
42
+ "react/no-this-in-sfc": 2,
43
+ "react-js/no-typos": 2,
44
+ "react/no-unknown-property": 2,
45
+ "react/no-unsafe": 2,
46
+ "react/no-unstable-nested-components": 2,
47
+ "react-js/no-unused-class-component-methods": 2,
48
+ "react-js/no-unused-state": 2,
49
+ "react/no-will-update-set-state": 2,
50
+ "react/prefer-es6-class": 2,
51
+ "react-js/prefer-read-only-props": 2,
52
+ "react-js/prefer-stateless-function": [2, { ignorePureComponents: true }],
53
+ "react/require-render-return": 2,
54
+ "react-js/sort-comp": 2,
55
+ "react/state-in-constructor": [2, "always"],
56
+ "react-js/static-property-placement": 2,
57
+ "react/void-dom-elements-no-children": 2
58
+ }
59
+ });
62
60
 
63
61
  //#endregion
64
62
  export { config as default };
package/dist/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","names":["jsx"],"sources":["../src/react.ts"],"sourcesContent":["import eslintPluginReactHooks from 'eslint-plugin-react-hooks';\nimport globals from 'globals';\n\nimport jsx from './jsx.js';\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nconst rules: TSESLint.FlatConfig.Rules = {\n\t'react-hooks/exhaustive-deps': 2,\n\t'react-hooks/rules-of-hooks': 2,\n\t'react-hooks/immutability': 2,\n\t'react-hooks/purity': 2,\n\t'react-hooks/refs': 2,\n\t// 'react-hooks/set-state-in-effect': 2,\n\t'react-hooks/set-state-in-render': 2,\n\t'react/boolean-prop-naming': 2,\n\t'react/button-has-type': 2,\n\t'react/hook-use-state': 2,\n\t'react/iframe-missing-sandbox': 2,\n\t'react/no-access-state-in-setstate': 2,\n\t'react/no-arrow-function-lifecycle': 2,\n\t'react/no-children-prop': 2,\n\t'react/no-danger': 2,\n\t'react/no-danger-with-children': 2,\n\t'react/no-deprecated': 2,\n\t'react/no-did-mount-set-state': 2,\n\t'react/no-did-update-set-state': 2,\n\t'react/no-direct-mutation-state': 2,\n\t'react/no-find-dom-node': 2,\n\t'react/no-invalid-html-attribute': 2,\n\t'react/no-is-mounted': 2,\n\t'react/no-namespace': 2,\n\t'react/no-redundant-should-component-update': 2,\n\t'react/no-render-return-value': 2,\n\t'react/no-set-state': 2,\n\t'react/no-string-refs': 2,\n\t'react/no-this-in-sfc': 2,\n\t'react/no-typos': 2,\n\t'react/no-unknown-property': 2,\n\t'react/no-unsafe': 2,\n\t'react/no-unstable-nested-components': 2,\n\t'react/no-unused-class-component-methods': 2,\n\t'react/no-unused-state': 2,\n\t'react/no-will-update-set-state': 2,\n\t'react/prefer-es6-class': 2,\n\t'react/prefer-read-only-props': 2,\n\t'react/prefer-stateless-function': [\n\t\t2,\n\t\t{\n\t\t\tignorePureComponents: true,\n\t\t},\n\t],\n\t'react/require-render-return': 2,\n\t'react/sort-comp': 2,\n\t'react/state-in-constructor': [2, 'always'],\n\t'react/static-property-placement': 2,\n\t'react/void-dom-elements-no-children': 2,\n};\n\nconst settings: TSESLint.FlatConfig.Settings = {\n\treact: {\n\t\tversion: 'detect',\n\t},\n};\n\nconst config: TSESLint.FlatConfig.ConfigArray = [\n\t...jsx,\n\t{\n\t\tname: 'mahir/react',\n\t\tlanguageOptions: {\n\t\t\tglobals: {\n\t\t\t\t...globals.serviceworker,\n\t\t\t\t...globals.browser,\n\t\t\t},\n\t\t},\n\t\tplugins: {\n\t\t\t'react-hooks': eslintPluginReactHooks,\n\t\t},\n\t\trules,\n\t\tsettings,\n\t},\n];\n\nexport default config;\n"],"mappings":";;;;;AAOA,MAAM,QAAmC;CACxC,+BAA+B;CAC/B,8BAA8B;CAC9B,4BAA4B;CAC5B,sBAAsB;CACtB,oBAAoB;CAEpB,mCAAmC;CACnC,6BAA6B;CAC7B,yBAAyB;CACzB,wBAAwB;CACxB,gCAAgC;CAChC,qCAAqC;CACrC,qCAAqC;CACrC,0BAA0B;CAC1B,mBAAmB;CACnB,iCAAiC;CACjC,uBAAuB;CACvB,gCAAgC;CAChC,iCAAiC;CACjC,kCAAkC;CAClC,0BAA0B;CAC1B,mCAAmC;CACnC,uBAAuB;CACvB,sBAAsB;CACtB,8CAA8C;CAC9C,gCAAgC;CAChC,sBAAsB;CACtB,wBAAwB;CACxB,wBAAwB;CACxB,kBAAkB;CAClB,6BAA6B;CAC7B,mBAAmB;CACnB,uCAAuC;CACvC,2CAA2C;CAC3C,yBAAyB;CACzB,kCAAkC;CAClC,0BAA0B;CAC1B,gCAAgC;CAChC,mCAAmC,CAClC,GACA,EACC,sBAAsB,KACvB,CACD;CACA,+BAA+B;CAC/B,mBAAmB;CACnB,8BAA8B,CAAC,GAAG,QAAQ;CAC1C,mCAAmC;CACnC,uCAAuC;AACxC;AAEA,MAAM,WAAyC,EAC9C,OAAO,EACN,SAAS,SACV,EACD;AAEA,MAAM,SAA0C,CAC/C,GAAGA,UACH;CACC,MAAM;CACN,iBAAiB,EAChB,SAAS;EACR,GAAG,QAAQ;EACX,GAAG,QAAQ;CACZ,EACD;CACA,SAAS,EACR,eAAe,uBAChB;CACA;CACA;AACD,CACD"}
1
+ {"version":3,"file":"react.js","names":["jsx"],"sources":["../src/react.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { nativePlugins, packagePlugin } from './config.js';\nimport jsx from './jsx.js';\n\nimport type { OxlintConfig } from 'oxlint';\n\nconst rules: NonNullable<OxlintConfig['rules']> = {\n\t'react/exhaustive-deps': 2,\n\t'react/rules-of-hooks': 2,\n\t'react/immutability': 2,\n\t'react/purity': 2,\n\t'react/refs': 2,\n\t'react/set-state-in-render': 2,\n\t'react-js/boolean-prop-naming': 2,\n\t'react/button-has-type': 2,\n\t'react/hook-use-state': 2,\n\t'react/iframe-missing-sandbox': 2,\n\t'react-js/no-access-state-in-setstate': 2,\n\t'react-js/no-arrow-function-lifecycle': 2,\n\t'react/no-children-prop': 2,\n\t'react/no-danger': 2,\n\t'react/no-danger-with-children': 2,\n\t'react-js/no-deprecated': 2,\n\t'react/no-did-mount-set-state': 2,\n\t'react/no-did-update-set-state': 2,\n\t'react/no-direct-mutation-state': 2,\n\t'react/no-find-dom-node': 2,\n\t'react-js/no-invalid-html-attribute': 2,\n\t'react/no-is-mounted': 2,\n\t'react/no-namespace': 2,\n\t'react/no-redundant-should-component-update': 2,\n\t'react/no-render-return-value': 2,\n\t'react/no-set-state': 2,\n\t'react/no-string-refs': 2,\n\t'react/no-this-in-sfc': 2,\n\t'react-js/no-typos': 2,\n\t'react/no-unknown-property': 2,\n\t'react/no-unsafe': 2,\n\t'react/no-unstable-nested-components': 2,\n\t'react-js/no-unused-class-component-methods': 2,\n\t'react-js/no-unused-state': 2,\n\t'react/no-will-update-set-state': 2,\n\t'react/prefer-es6-class': 2,\n\t'react-js/prefer-read-only-props': 2,\n\t'react-js/prefer-stateless-function': [\n\t\t2,\n\t\t{\n\t\t\tignorePureComponents: true,\n\t\t},\n\t],\n\t'react/require-render-return': 2,\n\t'react-js/sort-comp': 2,\n\t'react/state-in-constructor': [2, 'always'],\n\t'react-js/static-property-placement': 2,\n\t'react/void-dom-elements-no-children': 2,\n};\n\nconst config = defineConfig({\n\textends: [jsx],\n\tplugins: nativePlugins,\n\tjsPlugins: [packagePlugin('react-js', 'eslint-plugin-react')],\n\tenv: {\n\t\tbrowser: true,\n\t\tserviceworker: true,\n\t},\n\trules,\n});\n\nexport default config;\n"],"mappings":";;;;;AA0DA,MAAM,SAAS,aAAa;CAC3B,SAAS,CAACA,QAAG;CACb,SAAS;CACT,WAAW,CAAC,cAAc,YAAY,qBAAqB,CAAC;CAC5D,KAAK;EACJ,SAAS;EACT,eAAe;CAChB;CACA;EA1DA,yBAAyB;EACzB,wBAAwB;EACxB,sBAAsB;EACtB,gBAAgB;EAChB,cAAc;EACd,6BAA6B;EAC7B,gCAAgC;EAChC,yBAAyB;EACzB,wBAAwB;EACxB,gCAAgC;EAChC,wCAAwC;EACxC,wCAAwC;EACxC,0BAA0B;EAC1B,mBAAmB;EACnB,iCAAiC;EACjC,0BAA0B;EAC1B,gCAAgC;EAChC,iCAAiC;EACjC,kCAAkC;EAClC,0BAA0B;EAC1B,sCAAsC;EACtC,uBAAuB;EACvB,sBAAsB;EACtB,8CAA8C;EAC9C,gCAAgC;EAChC,sBAAsB;EACtB,wBAAwB;EACxB,wBAAwB;EACxB,qBAAqB;EACrB,6BAA6B;EAC7B,mBAAmB;EACnB,uCAAuC;EACvC,8CAA8C;EAC9C,4BAA4B;EAC5B,kCAAkC;EAClC,0BAA0B;EAC1B,mCAAmC;EACnC,sCAAsC,CACrC,GACA,EACC,sBAAsB,KACvB,CACD;EACA,+BAA+B;EAC/B,sBAAsB;EACtB,8BAA8B,CAAC,GAAG,QAAQ;EAC1C,sCAAsC;EACtC,uCAAuC;CAWnC;AACL,CAAC"}
@@ -1,6 +1,19 @@
1
- import { TSESLint } from "@typescript-eslint/utils";
2
1
  //#region src/tailwind.d.ts
3
- declare const config: TSESLint.FlatConfig.ConfigArray;
2
+ declare const config: {
3
+ plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue")[];
4
+ jsPlugins: import("oxlint").ExternalPluginEntry[];
5
+ settings: {
6
+ 'better-tailwindcss': {
7
+ entryPoint: string;
8
+ };
9
+ };
10
+ rules: {
11
+ 'better-tailwindcss-js/enforce-consistent-class-order': "warn";
12
+ 'better-tailwindcss-js/no-unnecessary-whitespace': "warn";
13
+ 'better-tailwindcss-js/enforce-canonical-classes': "warn";
14
+ 'better-tailwindcss-js/no-unknown-classes': "error";
15
+ };
16
+ };
4
17
  //#endregion
5
18
  export { config as default };
6
19
  //# sourceMappingURL=tailwind.d.ts.map
package/dist/tailwind.js CHANGED
@@ -1,17 +1,18 @@
1
- import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
1
+ import { nativePlugins, packagePlugin } from "./config.js";
2
+ import { defineConfig } from "oxlint";
2
3
 
3
4
  //#region src/tailwind.ts
4
- const config = [{
5
- name: "mahir/tailwind",
5
+ const config = defineConfig({
6
+ plugins: nativePlugins,
7
+ jsPlugins: [packagePlugin("better-tailwindcss-js", "eslint-plugin-better-tailwindcss")],
6
8
  settings: { "better-tailwindcss": { entryPoint: "app/globals.css" } },
7
- plugins: { "better-tailwindcss": eslintPluginBetterTailwindcss },
8
9
  rules: {
9
- "better-tailwindcss/enforce-consistent-class-order": "warn",
10
- "better-tailwindcss/no-unnecessary-whitespace": "warn",
11
- "better-tailwindcss/enforce-canonical-classes": "warn",
12
- "better-tailwindcss/no-unknown-classes": "error"
10
+ "better-tailwindcss-js/enforce-consistent-class-order": "warn",
11
+ "better-tailwindcss-js/no-unnecessary-whitespace": "warn",
12
+ "better-tailwindcss-js/enforce-canonical-classes": "warn",
13
+ "better-tailwindcss-js/no-unknown-classes": "error"
13
14
  }
14
- }];
15
+ });
15
16
 
16
17
  //#endregion
17
18
  export { config as default };
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind.js","names":[],"sources":["../src/tailwind.ts"],"sourcesContent":["import eslintPluginBetterTailwindcss from 'eslint-plugin-better-tailwindcss';\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nconst config: TSESLint.FlatConfig.ConfigArray = [\n\t{\n\t\tname: 'mahir/tailwind',\n\t\tsettings: {\n\t\t\t'better-tailwindcss': {\n\t\t\t\tentryPoint: 'app/globals.css',\n\t\t\t},\n\t\t},\n\t\tplugins: {\n\t\t\t'better-tailwindcss': eslintPluginBetterTailwindcss,\n\t\t},\n\t\trules: {\n\t\t\t'better-tailwindcss/enforce-consistent-class-order': 'warn',\n\t\t\t'better-tailwindcss/no-unnecessary-whitespace': 'warn',\n\t\t\t'better-tailwindcss/enforce-canonical-classes': 'warn',\n\t\t\t'better-tailwindcss/no-unknown-classes': 'error',\n\t\t},\n\t},\n];\n\nexport default config;\n"],"mappings":";;;AAIA,MAAM,SAA0C,CAC/C;CACC,MAAM;CACN,UAAU,EACT,sBAAsB,EACrB,YAAY,kBACb,EACD;CACA,SAAS,EACR,sBAAsB,8BACvB;CACA,OAAO;EACN,qDAAqD;EACrD,gDAAgD;EAChD,gDAAgD;EAChD,yCAAyC;CAC1C;AACD,CACD"}
1
+ {"version":3,"file":"tailwind.js","names":[],"sources":["../src/tailwind.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { nativePlugins, packagePlugin } from './config.js';\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\tjsPlugins: [packagePlugin('better-tailwindcss-js', 'eslint-plugin-better-tailwindcss')],\n\tsettings: {\n\t\t'better-tailwindcss': {\n\t\t\tentryPoint: 'app/globals.css',\n\t\t},\n\t},\n\trules: {\n\t\t'better-tailwindcss-js/enforce-consistent-class-order': 'warn',\n\t\t'better-tailwindcss-js/no-unnecessary-whitespace': 'warn',\n\t\t'better-tailwindcss-js/enforce-canonical-classes': 'warn',\n\t\t'better-tailwindcss-js/no-unknown-classes': 'error',\n\t},\n});\n\nexport default config;\n"],"mappings":";;;;AAIA,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,WAAW,CAAC,cAAc,yBAAyB,kCAAkC,CAAC;CACtF,UAAU,EACT,sBAAsB,EACrB,YAAY,kBACb,EACD;CACA,OAAO;EACN,wDAAwD;EACxD,mDAAmD;EACnD,mDAAmD;EACnD,4CAA4C;CAC7C;AACD,CAAC"}
package/dist/tsdoc.d.ts CHANGED
@@ -1,6 +1,19 @@
1
- import { TSESLint } from "@typescript-eslint/utils";
2
1
  //#region src/tsdoc.d.ts
3
- declare const config: TSESLint.FlatConfig.ConfigArray;
2
+ declare const config: {
3
+ extends: {
4
+ plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue")[];
5
+ jsPlugins: import("oxlint").ExternalPluginEntry[];
6
+ rules: import("oxlint").DummyRuleMap;
7
+ }[];
8
+ plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue")[];
9
+ jsPlugins: import("oxlint").ExternalPluginEntry[];
10
+ rules: import("oxlint").DummyRuleMap;
11
+ settings: {
12
+ jsdoc: {
13
+ mode: string;
14
+ };
15
+ };
16
+ };
4
17
  //#endregion
5
18
  export { config as default };
6
19
  //# sourceMappingURL=tsdoc.d.ts.map
package/dist/tsdoc.js CHANGED
@@ -1,20 +1,20 @@
1
+ import { nativePlugins, packagePlugin } from "./config.js";
1
2
  import config$1 from "./jsdoc.js";
2
- import eslintPluginTsdoc from "eslint-plugin-tsdoc";
3
+ import { defineConfig } from "oxlint";
3
4
 
4
5
  //#region src/tsdoc.ts
5
- const rules = {
6
- "jsdoc/check-tag-names": 0,
7
- "jsdoc/require-property-type": 0,
8
- "jsdoc/no-undefined-types": 0,
9
- "tsdoc/syntax": 1
10
- };
11
- const settings = { jsdoc: { mode: "typescript" } };
12
- const config = [...config$1, {
13
- name: "mahir/tsdoc",
14
- plugins: { tsdoc: eslintPluginTsdoc },
15
- rules,
16
- settings
17
- }];
6
+ const config = defineConfig({
7
+ extends: [config$1],
8
+ plugins: nativePlugins,
9
+ jsPlugins: [packagePlugin("tsdoc-js", "eslint-plugin-tsdoc")],
10
+ rules: {
11
+ "jsdoc/check-tag-names": 0,
12
+ "jsdoc/require-property-type": 0,
13
+ "jsdoc-js/no-undefined-types": 0,
14
+ "tsdoc-js/syntax": 1
15
+ },
16
+ settings: { jsdoc: { mode: "typescript" } }
17
+ });
18
18
 
19
19
  //#endregion
20
20
  export { config as default };
package/dist/tsdoc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc.js","names":["jsdoc"],"sources":["../src/tsdoc.ts"],"sourcesContent":["import eslintPluginTsdoc from 'eslint-plugin-tsdoc';\n\nimport jsdoc from './jsdoc.js';\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nconst rules: TSESLint.FlatConfig.Rules = {\n\t'jsdoc/check-tag-names': 0,\n\t'jsdoc/require-property-type': 0,\n\t'jsdoc/no-undefined-types': 0,\n\t'tsdoc/syntax': 1,\n};\n\nconst settings: TSESLint.FlatConfig.Settings = {\n\tjsdoc: {\n\t\tmode: 'typescript',\n\t},\n};\n\nconst config: TSESLint.FlatConfig.ConfigArray = [\n\t...jsdoc,\n\t{\n\t\tname: 'mahir/tsdoc',\n\t\tplugins: {\n\t\t\ttsdoc: eslintPluginTsdoc,\n\t\t},\n\t\trules,\n\t\tsettings,\n\t},\n];\n\nexport default config;\n"],"mappings":";;;;AAMA,MAAM,QAAmC;CACxC,yBAAyB;CACzB,+BAA+B;CAC/B,4BAA4B;CAC5B,gBAAgB;AACjB;AAEA,MAAM,WAAyC,EAC9C,OAAO,EACN,MAAM,aACP,EACD;AAEA,MAAM,SAA0C,CAC/C,GAAGA,UACH;CACC,MAAM;CACN,SAAS,EACR,OAAO,kBACR;CACA;CACA;AACD,CACD"}
1
+ {"version":3,"file":"tsdoc.js","names":["jsdoc"],"sources":["../src/tsdoc.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { nativePlugins, packagePlugin } from './config.js';\nimport jsdoc from './jsdoc.js';\n\nimport type { OxlintConfig } from 'oxlint';\n\nconst rules: NonNullable<OxlintConfig['rules']> = {\n\t'jsdoc/check-tag-names': 0,\n\t'jsdoc/require-property-type': 0,\n\t'jsdoc-js/no-undefined-types': 0,\n\t'tsdoc-js/syntax': 1,\n};\n\nconst config = defineConfig({\n\textends: [jsdoc],\n\tplugins: nativePlugins,\n\tjsPlugins: [packagePlugin('tsdoc-js', 'eslint-plugin-tsdoc')],\n\trules,\n\tsettings: {\n\t\tjsdoc: {\n\t\t\tmode: 'typescript',\n\t\t},\n\t},\n});\n\nexport default config;\n"],"mappings":";;;;;AAcA,MAAM,SAAS,aAAa;CAC3B,SAAS,CAACA,QAAK;CACf,SAAS;CACT,WAAW,CAAC,cAAc,YAAY,qBAAqB,CAAC;CAC5D;EAVA,yBAAyB;EACzB,+BAA+B;EAC/B,+BAA+B;EAC/B,mBAAmB;CAOf;CACJ,UAAU,EACT,OAAO,EACN,MAAM,aACP,EACD;AACD,CAAC"}
@@ -1,6 +1,9 @@
1
- import { TSESLint } from "@typescript-eslint/utils";
2
1
  //#region src/typescript.d.ts
3
- declare const config: TSESLint.FlatConfig.ConfigArray;
2
+ declare const config: {
3
+ plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue")[];
4
+ jsPlugins: import("oxlint").ExternalPluginEntry[];
5
+ rules: import("oxlint").DummyRuleMap;
6
+ };
4
7
  //#endregion
5
8
  export { config as default };
6
9
  //# sourceMappingURL=typescript.d.ts.map