mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
Bulk rename across 989 files: - Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc. - Repository URLs: posthog/posthog-js → hanzoai/insights-js - Brand names: PostHog → Insights - File renames: 259 reference JSON files, source files, workflow files - Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
module.exports = {
|
|
create(context) {
|
|
return {
|
|
BinaryExpression: function (node) {
|
|
// Check if the operator is '==='
|
|
if (node.operator === '===') {
|
|
// Check if left operand is an Identifier (e.g., 'obj')
|
|
const isLeftIdentifier = node.left.type === 'Identifier'
|
|
|
|
// Check if right operand is a CallExpression with the Object constructor
|
|
const isRightObjectCall =
|
|
node.right.type === 'CallExpression' &&
|
|
node.right.callee.type === 'Identifier' &&
|
|
node.right.callee.name === 'Object' &&
|
|
node.right.arguments.length === 1 &&
|
|
node.right.arguments[0].type === 'Identifier' &&
|
|
node.right.arguments[0].name === node.left.name
|
|
|
|
if (isLeftIdentifier && isRightObjectCall) {
|
|
context.report({
|
|
node,
|
|
message: "Do not use 'obj === Object(obj)'. Use isObject instead.",
|
|
})
|
|
}
|
|
}
|
|
},
|
|
}
|
|
},
|
|
}
|