How to use the eslint-scope/lib/reference.WRITE function in eslint-scope

To help you get started, we’ve selected a few eslint-scope examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eslint / typescript-eslint-parser / analyze-scope.js View on Github external
TSEnumMember(node) {
        const { id, initializer } = node;
        const scope = this.currentScope();

        scope.__define(id, new Definition("EnumMemberName", id, node));

        // Set `eslintUsed` flag to the defined variable because the enum member is obviously exported.
        const variable = scope.set.get(id.name);
        variable.eslintUsed = true;

        if (initializer) {
            scope.__referencing(
                id,
                Reference.WRITE,
                initializer,
                null,
                false,
                true
            );
            this.visit(initializer);
        }
    }