How to use @hint/parser-javascript - 1 common examples

To help you get started, we’ve selected a few @hint/parser-javascript 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 webhintio / hint / packages / parser-typescript / src / parser.ts View on Github external
if (TypeScriptESTree) {
    // Extend `walk` to skip over most TS-specific nodes.
    for (const type of Object.keys(TypeScriptESTree.AST_NODE_TYPES)) {
        // Ensure `value` of `ClassProperty` instances is walked.
        if (type === 'ClassProperty') {
            base[type] = (node: any, st: any, c: any) => {
                if (node.value) {
                    c(node.value, st);
                }
            };
        }

        // Just ignore anything else
        if (!base[type]) {
            base[type] = base.Identifier;
        }
    }
}

export default class TypeScriptParser extends Parser {

    public constructor(engine: Engine) {
        super(engine, 'typescript');

        engine.on('fetch::end::unknown', async ({ resource, response }) => {
            if (!resource.endsWith('.ts') && !resource.endsWith('.tsx')) {
                return;
            }

            if (!TypeScriptESTree) {
                return;

@hint/parser-javascript

webhint parser needed to analyze JavaScript files

Apache-2.0
Latest version published 4 months ago

Package Health Score

89 / 100
Full package analysis

Popular @hint/parser-javascript functions