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)
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
module.exports = {
|
|
create(context) {
|
|
return {
|
|
BinaryExpression: function (node) {
|
|
// Check for `toString.call(x) == '[object String]'`
|
|
if (
|
|
(node.operator === '==' || node.operator === '===') &&
|
|
node.left.type === 'CallExpression' &&
|
|
node.left.callee.property &&
|
|
node.left.callee.property.name === 'call' &&
|
|
node.left.callee.object &&
|
|
node.left.callee.object.name === 'toString' &&
|
|
node.right.type === 'Literal' &&
|
|
node.right.value === '[object String]'
|
|
) {
|
|
context.report({
|
|
node,
|
|
message: 'Use isString instead of direct string checks.',
|
|
})
|
|
}
|
|
|
|
// Check for `x instanceof String`
|
|
if (
|
|
node.operator === 'instanceof' &&
|
|
node.right.type === 'Identifier' &&
|
|
node.right.name === 'String'
|
|
) {
|
|
context.report({
|
|
node,
|
|
message: 'Use isString instead of direct string checks.',
|
|
})
|
|
}
|
|
},
|
|
}
|
|
},
|
|
}
|