pyjslint - JSLint Wrapper

0.3.4 · abandoned · verified Fri Apr 17

pyjslint is a Python wrapper for JSLint, designed to integrate JavaScript linting into Python projects. It bundles an old version of JSLint and appears to be unmaintained. The current version is 0.3.4, released in 2013, indicating an abandoned project.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize `PyJsLint` and use its `lint()` method to analyze a string of JavaScript code. The method returns a list of error dictionaries or `None` if no errors are found.

from pyjslint.pyjslint import PyJsLint

# Example JavaScript code to lint
code_to_lint = """
var a = 1;
var b = 2;
var c = a + b // Missing semicolon, will be flagged
"""

# Initialize the linter
linter = PyJsLint()

# Lint the code
result = linter.lint(code_to_lint)

if result:
    print("Linting errors found:")
    for error in result:
        print(f"  Line {error.get('line')}, Character {error.get('character')}: {error.get('reason')}")
else:
    print("No linting errors.")

view raw JSON →