javascript deno lint + eslint + deno test container setup - useful to lint or test your repo's JS for a CI/CD [test] phase
- install deno
brew install node
DYNODIR=$(pwd)/dyno
git clone https://github.com/internetarchive/dyno
# setup "house" linting for any project you have checked out in your home dir:
cd $HOME
ln -s $DYNODIR/eslint.config.js .
ln -s $DYNODIR/package.json .
npm i
# cd [to some project with JS]
# add $DYNODIR/lint to your $PATH and `lint` or:
$DYNODIR/lint(For podman change docker to podman below)
# lint check all JS found in your CWD
docker run --rm --pull=always -v $(pwd):/code --workdir=/code ghcr.io/internetarchive/dyno:mainTo setup CI/CD lint testing of your repo's JS code,
you can use this for a GitHub Actions CI/CD pipeline:
on: push
jobs:
lint:
uses: internetarchive/dyno/.github/workflows/lint.yml@main
# optional -- but standard archive.org CI/CD build/test/deploy pipeline setup:
cicd:
uses: internetarchive/cicd/.github/workflows/cicd.yml@mainYou can copy that into your github repo into (likely new) subdir: .github/workflows/cicd.yml
lint is the actual script that runs various linters over your JS files.
You can also run mocha + expectations-like tests over your JS files.
Though this repo includes these 4 files with some customized eslint rules setup and more,
if your repo has any of these 4 files in the top of your repo, we'll use those instead.
You can test with an arbitrary docker image, the dyno docker image, split out multiple separate tests that can run in parallel, and more.
See this repo as a great base for you to consider:
- https://github.com/internetarchive/hello-js
- https://github.com/internetarchive/hello-js/blob/main/.github/workflows/cicd.yml
We use composite actions for minimizing boilerplate copying of our YAML into other repos.
This is our standard 'cicd' CI/CD action:
If your repo is using GitLab, you can create a .gitlab-ci.yml file at the top of your repo like this:
# standard archive.org CI/CD setup
include: https://nomad.archive.org/ci.yml
lint:
# lint your repo JS code
stage: test
image: ghcr.io/internetarchive/dyno:main
script: /app/lint
# If your tests *don't* require pkgs or non-repo files from your docker build image,
# then you can use this nicely for testing files in your repo like 'test/something.test.js'
# along with a full code coverage report.
test:
stage: test
image: ghcr.io/internetarchive/dyno:main
script: /app/test/test.sh-
dont love no column alignment, and it would thrash 2 big JS repos. but could potentially live w/ it
-
snake case needs to be allowed everywhere (not restricted)
-
import
.jsfiles with their extensions has to be ok -
no-param-assign (on the maybe list)
-
no-const-assign (should be on the list, but...🙃??)
-
prefer-template
-
no-shadow
-
no-unsed-vars
-
prefer-const
-
eqeqeq
-
no-dupe-args
-
no-dupe-keys
-
no-duplicate-case
-
arrow-body-style
-
arrow-parens
-
no-duplicate-imports
-
no-this-before-super
-
prefer-arrow-callback
-
comma-dangle
-
no-tabs
-
import/no-extraneous-dependencies
-
import/no-duplicates
