my fork of the bluesky client
1'use strict'
2
3exports.create = function create(context) {
4 return {
5 ImportSpecifier(node) {
6 if (
7 !node.local ||
8 node.local.type !== 'Identifier' ||
9 node.local.name !== 'useGate'
10 ) {
11 return
12 }
13 if (
14 node.parent.type !== 'ImportDeclaration' ||
15 !node.parent.source ||
16 node.parent.source.type !== 'Literal'
17 ) {
18 return
19 }
20 const source = node.parent.source.value
21 if (source.startsWith('statsig') || source.startsWith('@statsig')) {
22 context.report({
23 node,
24 message:
25 "Use useGate() from '#/lib/statsig/statsig' instead of the one on npm.",
26 })
27 }
28 // TODO: Verify gate() call results aren't stored in variables.
29 },
30 }
31}