2024-08-05-1217Z


For some time now (years?) I've wanted to run jslint on my JavaScript code, but after that last project a few years back with Node.js, I wanted nothing more to do with npm and node polluting my Linux development box (laptop).

Finally this morning I googled and stackoverflowed around a bit, and decided on eslint, a newer open-source project with a runnable docker image.

So I fetched it: docker pull cytopia/eslint; created $HOME/.local/bin/eslint with the following contents:

#!/bin/sh
docker run --interactive --tty --rm --volume $PWD:/data cytopia/eslint $*

And copied the following sample config from eslint.org into a new file, eslint.config.js, in my project directory:

module.exports = [
    {
        rules: {
            semi: "error",
            "prefer-const": "error"
        }
    }
];

Now I can run it normally:

jcomeau@bendergift:/usr/src/jcomeauictx/cardboard-editor/stopgap$ eslint stopgap.js

/data/stopgap.js 173:9 error Parsing error: Missing catch or finally clause * 1 problem (1 error, 0 warnings)

It works!

Back to blog or home page

last updated 2024-08-05 08:34:57. served from tektonic.jcomeau.com