mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-11-03 00:53:53 +00:00
Decomplect the half-finished fork so the dependency graph has ONE source with no posthog package identity, living under github.com/hanzoinsights. LAYER 1 (package identity): rename straggler package.json names — @posthog/next->@hanzo/insights-next (Next.js SDK; distinct from the existing @hanzo/insights-nextjs config helper), @posthog/mcp->@hanzo/insights-mcp, @posthog/plugin-utils->@hanzo/insights-plugin-utils, @posthog/react-slim->@hanzo/react-slim, @posthog-tooling/release-> @hanzo/insights-tooling-release, and the @posthog/rrweb* family->@hanzo/rrweb* (matching the already-published @hanzo/rrweb*@0.0.47 + minimumReleaseAgeExclude). Repoint every repository.url/homepage/bugs to github.com/hanzoinsights/insights-js and rebrand the PostHog author/description identity to Hanzo AI. LAYER 2 (cross-package imports): rewrite every internal @posthog/* import to its @hanzo/insights*|@hanzo/rrweb* equivalent and the bare module specifiers posthog-js->@hanzo/insights, posthog-node->@hanzo/insights-node, mirrored in package.json deps + the pnpm-lock importer keys. Result: 0 @posthog/* specifiers in packages/tooling/examples/playground source. LAYER 4 (wire protocol) PRESERVED: window.posthog global, ph_* keys, $-prefixed event names, distinct_id, /decide, /e/, /flags, and the __PosthogExtensions__ hook are left unchanged — the Insights server expects them. Also repair pre-existing fork merge damage that blocked compilation (unrelated to naming; identical to origin/main): restore the @hanzo/insights-core ./process subpath (spawn-local/utils, re-matching the published artifact), the lost constructor/var declarations in core + node clients, the mangled external-scripts-loader, the missing TreeShakeable/isPlainError imports, the DeviceId enum member, and stale ../posthog-core-stateless module paths. 26/34 turbo build tasks now pass; remaining failures (browser/react-native and their dependents) are pre-existing fork damage, not rebrand-caused.
133 lines
4.4 KiB
JavaScript
133 lines
4.4 KiB
JavaScript
// https://eslint.org/docs/v8.x/use/configure/configuration-files
|
|
const rules = {
|
|
'prettier/prettier': 'error',
|
|
'prefer-spread': 'off',
|
|
'@typescript-eslint/no-empty-function': 'off',
|
|
'@typescript-eslint/no-this-alias': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-unused-vars': ['error'],
|
|
'@typescript-eslint/no-unused-expressions': 'off',
|
|
'no-prototype-builtins': 'off',
|
|
'no-empty': 'off',
|
|
'no-console': 'error',
|
|
'no-only-tests/no-only-tests': 'error',
|
|
'@hanzo/insights/no-external-replay-imports': 'error',
|
|
'@typescript-eslint/naming-convention': [
|
|
'error',
|
|
{
|
|
selector: ['memberLike'],
|
|
modifiers: ['private'],
|
|
format: null,
|
|
leadingUnderscore: 'require',
|
|
},
|
|
],
|
|
}
|
|
|
|
const extend = [
|
|
'eslint:recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
'prettier',
|
|
'plugin:compat/recommended',
|
|
'plugin:@hanzo/insights/all',
|
|
]
|
|
|
|
module.exports = {
|
|
root: true,
|
|
env: {
|
|
browser: true,
|
|
es6: true,
|
|
'jest/globals': true,
|
|
},
|
|
globals: {
|
|
given: 'readonly',
|
|
global: 'readonly',
|
|
Buffer: 'readonly',
|
|
},
|
|
parser: '@typescript-eslint/parser',
|
|
plugins: [
|
|
'prettier',
|
|
'@typescript-eslint',
|
|
'eslint-plugin-react',
|
|
'eslint-plugin-react-hooks',
|
|
'jest',
|
|
'no-only-tests',
|
|
],
|
|
extends: extend,
|
|
rules,
|
|
overrides: [
|
|
{
|
|
files: ['rollup.config.*', '.eslintrc.*', 'jest.config.*', 'babel.config.*'],
|
|
parserOptions: {
|
|
project: null,
|
|
},
|
|
env: {
|
|
node: true,
|
|
},
|
|
},
|
|
{
|
|
files: [
|
|
'packages/core/**',
|
|
'packages/mcp/**',
|
|
'packages/nextjs-config/**',
|
|
'packages/nuxt/**',
|
|
'packages/react-native/**',
|
|
'packages/node/**',
|
|
'packages/web/**',
|
|
'packages/webpack-plugin/**',
|
|
'packages/rollup-plugin/**',
|
|
'examples/**',
|
|
'playground/**',
|
|
],
|
|
rules: {
|
|
'no-console': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
'@typescript-eslint/naming-convention': 'off',
|
|
'@hanzo/insights/no-direct-undefined-check': 'off',
|
|
'@hanzo/insights/no-direct-boolean-check': 'off',
|
|
'@hanzo/insights/no-direct-null-check': 'off',
|
|
'@hanzo/insights/no-direct-function-check': 'off',
|
|
'@hanzo/insights/no-direct-number-check': 'off',
|
|
'@hanzo/insights/no-direct-date-check': 'off',
|
|
'@hanzo/insights/no-direct-array-check': 'off',
|
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
'@hanzo/insights/no-add-event-listener': 'off',
|
|
'no-constant-condition': 'off',
|
|
'compat/compat': 'off',
|
|
},
|
|
},
|
|
{
|
|
// @hanzo/insights-core is shared by browser and React Native — Web API globals
|
|
// like Event, ErrorEvent, etc. don't exist in Hermes/JSC and referencing
|
|
// them as values throws a ReferenceError at runtime.
|
|
files: ['packages/core/src/**'],
|
|
excludedFiles: ['**/*.spec.*', '**/*.test.*'],
|
|
rules: {
|
|
'posthog-js/no-unsafe-web-global': 'error',
|
|
},
|
|
},
|
|
{
|
|
files: [
|
|
'packages/core/src/**',
|
|
'packages/react-native/src/**',
|
|
'packages/node/src/**',
|
|
'packages/web/src/**',
|
|
],
|
|
excludedFiles: ['**/*.spec.*', '**/*.test.*'],
|
|
rules: {
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
{
|
|
selector:
|
|
"CallExpression[callee.object.name='Promise'][callee.property.name='allSettled']",
|
|
message:
|
|
'Use `allSettled` from @hanzo/insights-core (packages/core/src/utils) instead of Promise.allSettled — Promise.allSettled can be broken by runtime Promise patching on some RN environments.',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
ignorePatterns: ['node_modules', 'dist', 'next-env.d.ts', '.next', 'packages/browser/playground/hydration/vendor'],
|
|
|
|
|
|
}
|