CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel--plugin-syntax-class-properties

Babel syntax plugin that enables parsing of class properties, private properties, and private methods

94

1.04x
Overview
Eval results
Files

task.mdevals/scenario-4/

Private Method Syntax Analyzer

Build a utility that parses JavaScript source to extract metadata about private class methods, relying on Babel configuration that accepts the syntax without transforming it.

Capabilities

Collects private instance methods

  • When the source has a class containing private instance methods #start and #stop alongside public methods, the analyzer returns both private method names with isStatic=false and source locations, leaving errors empty. @test

Collects private static methods

  • When the source has static private methods #init and #reset plus other class members, the analyzer marks them with isStatic=true, preserves their order of appearance, and reports no errors. @test

Surfaces syntax issues

  • When the source includes malformed private method syntax such as class Broken { #bad; }, the analyzer returns a single error message mentioning private methods and the offending line number instead of throwing unhandled exceptions. @test

Implementation

@generates

API

/**
 * Parses JavaScript source that may contain private class methods and reports their metadata.
 *
 * @param {string} source - JS code to inspect. Must be a string.
 * @returns {{
 *   privateMethods: Array<{ name: string, isStatic: boolean, loc: { line: number, column: number } }>,
 *   errors: Array<{ message: string, line: number, column: number }>
 * }}
 * @throws {TypeError} when source is not a string
 */
function analyzePrivateMethods(source) {}

module.exports = { analyzePrivateMethods };

Dependencies { .dependencies }

@babel/plugin-syntax-class-properties { .dependency }

Registers Babel parser plugins for class fields and private methods so the input code parses without transforms.

@satisfied-by

@babel/core { .dependency }

Provides the Babel parsing entrypoints used to build the analysis.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-babel--plugin-syntax-class-properties

tile.json