Skip to content

Latest commit

 

History

History
93 lines (58 loc) · 3.53 KB

check-javascript-task.md

File metadata and controls

93 lines (58 loc) · 3.53 KB

"Check JavaScript" workflow (Task)

Workflow file: check-javascript-task.yml

Use ESLint to lint the repository's JavaScript files.

Note: This workflow is focused on linting. Formatting checks for JavaScript are provided by the "Check Prettier Formatting" workflow (Task), so both should be used.

This is the version of the workflow for projects using the Task task runner tool.

Installation

Workflow

Install the check-javascript-task.yml GitHub Actions workflow to .github/workflows/

Assets

  • .eslintrc.yml - ESLint configuration file. ❗ The code style defined in this file is the official standardized style to be used in all Arduino projects and should not be modified.
    • Install to: repository root
  • Taskfile.yml - JavaScript linting tasks.
    • Install to: repository root (or merge into the existing Taskfile.yml).
  • Taskfile.yml - npm tasks.
    • Install to: repository root (or merge into the existing Taskfile.yml).

Dependencies

The tool dependencies of this workflow are managed by npm.

Add the dependencies by running this command:

npm install --save-dev eslint@^8.24.0 eslint-config-prettier@^8.5.0
npx install-peerdeps --dev eslint-config-airbnb-base

Commit the resulting changes to the package.json and package-lock.json files.

Configuration

Workflow

Configure the version of Node.js used for development of the project in the env.NODE_VERSION field of check-javascript-task.yml.

.gitignore

Add the following to /.gitignore:

/node_modules/

Readme badge

Markdown badge:

[![Check JavaScript status](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/check-javascript-task.yml/badge.svg)](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/check-javascript-task.yml)

Replace the TODO_REPO_OWNER and TODO_REPO_NAME placeholders in the URLs with the final repository owner and name (example).


Asciidoc badge:

image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-javascript-task.yml/badge.svg["Check JavaScript status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-javascript-task.yml"]

Define the {repository-owner} and {repository-name} attributes and use them throughout the readme (example).

Commit message

Add CI workflow to lint JavaScript code

On every push and pull request that affects relevant files, and periodically, run ESLint on the repository's JavaScript
files.

ESLint is configured via the .eslintrc.yml file:
https://eslint.org/docs/user-guide/configuring/configuration-files

PR message

On every push and pull request that affects relevant files, and periodically, run [**ESLint**](https://eslint.org/) on the repository's JavaScript files.

**ESLint** is configured via the `.eslintrc.yml` file:
https://eslint.org/docs/latest/user-guide/configuring/configuration-files