Skip to main content

gocept.jslint

This package integrates the JSHint code analysis tool (http://jshint.com) with Python’s unittest module. (The name is left over from when JSHint didn’t exist and only Douglas Crockford’s JSLint was available.)

It provides a special JSLint-TestCase class that collects JavaScript files (in a configurable manner) and dynamically generates a test method for each file that calls jshint on that file.

To use it, create a test class like this:

class MyJSLintTest(gocept.jslint.TestCase):

    include = ('my.package.browser:js',
               'my.package.browser:js/lib')
    options = (gocept.jslint.TestCase.options +
               ('browser', 'jquery',))

include is a list of “resource paths” of the form packagename:path (passed to pkg_resources).

options is a list of arguments that are passed to JSHint (see its documentation for details).

predefined is a list of global names that should be considered predefined (for use with the undef option).

exclude can be a list of filenames (without path) that will not be collected.

All files ending in .js contained in each of these paths will be collected, and the test class will grow a method named test_jslint_filename.js.

You can ignore JSLint error by setting ignore on the test class (a list of substrings that are matched against each JSLint output line):

ignore = (

“Use a named parameter”, )

Requirements

gocept.jslint is tested with Python 3.6, 3.7 and 3.8.

gocept.jslint uses node.js to run jshint, so you need to have node.js (version 0.3 or later) with the jshint npm module installed and the jshint binary available on your $PATH.

You can customize the name of the jshint binary by setting jshint_command on the TestCase, or set the environment variable JSHINT_COMMAND.

CHANGES

3.0 (2021-05-07)

  • Drop support for Python 2.

  • Add support for Python 3.9.

  • Fix output/encoding handling for Python 3, especially regarding the ignore setting.

2.1 (2021-01-07)

  • Add support for Python 3.8.

  • Migrate to GitHub and GitHub Actions.

2.0 (2019-02-25)

  • Add support for Python 3.6 and 3.7.

  • Stop testing with Python 2.6.

  • Run the tests against currently most recent versions of the dependencies.

  • Change testrunner to py.test.

1.1.1 (2014-10-22)

  • Get jshint command from environment (#13073).

1.1 (2012-05-21)

  • Use jshint instead of jslint.

1.0.1 (2012-04-18)

  • Uniquify duplicate file names in a prettier way: increment a counter, don’t just blindly append ‘_1’ (#9454).

1.0 (2011-08-25)

  • Add support for linting JS files contained in zipped eggs (#9453).

  • Add an entry point for running jslint from the command line (#9449).

  • Skip tests if node.js is not available. Skipping tests only works properly in Python >= 2.7, though. (#9458)

0.2 (2011-08-24)

  • Implement custom error ignores (#9456).

0.1 (2011-08-10)

  • first release.

Metadata

Release files for gocept.jslint 3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gocept.jslint 3.0
File Size Uploaded
gocept.jslint-3.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gocept.jslint 3.0
File Interpreter ABI Platform
gocept.jslint-3.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.0 kB

Release files / gocept.jslint-3.0.tar.gz

Download URL gocept.jslint-3.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0225dcdba33c0032dca5f0d65af5b6dfa31ff50533569d08d1cd63b963155ec9
BLAKE2b-256 checksum
How to use checksums
578ee6623d17ed9979bc33cb80414a80e37b90e86dabbdeadeae5b2a4da0d9d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/None requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.10

Release files / gocept.jslint-3.0-py3-none-any.whl

Download URL gocept.jslint-3.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af8a497b704a74019c1d846f2883e528e0b5b173b7f2ec2975d647a893879b35
BLAKE2b-256 checksum
How to use checksums
4839832cdac4a5cd40341276e2653f6200b142c00d639b755a1959cd564aa07b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/None requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.10

Release history Release notifications | RSS feed

This release

3.0 This release

2 release files

2.1

2 release files

2.0

1 release file

1.1.1

1 release file

1.1

1 release file

1.0.1

1 release file

1.0

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page