diff options
Diffstat (limited to 'eslint/use-typed-gates.js')
-rw-r--r-- | eslint/use-typed-gates.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/eslint/use-typed-gates.js b/eslint/use-typed-gates.js new file mode 100644 index 000000000..3625a7da3 --- /dev/null +++ b/eslint/use-typed-gates.js @@ -0,0 +1,31 @@ +'use strict' + +exports.create = function create(context) { + return { + ImportSpecifier(node) { + if ( + !node.local || + node.local.type !== 'Identifier' || + node.local.name !== 'useGate' + ) { + return + } + if ( + node.parent.type !== 'ImportDeclaration' || + !node.parent.source || + node.parent.source.type !== 'Literal' + ) { + return + } + const source = node.parent.source.value + if (source.startsWith('.') || source.startsWith('#')) { + return + } + context.report({ + node, + message: + "Use useGate() from '#/lib/statsig/statsig' instead of the one on npm.", + }) + }, + } +} |