From bdd8e25e59c7471e9b7ec2c2f8039ca0ffc3b56a Mon Sep 17 00:00:00 2001 From: Inacio Cerqueira Date: Fri, 18 Sep 2020 19:16:20 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Adiciona=20se=C3=A7=C3=A3o=20sobre=20como?= =?UTF-8?q?=20configurar=20a=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 452be55..96d3467 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,92 @@ This action accepts the following configuration parameters via `with:` ```yaml steps: + - uses: actions/setup-node@v1.4.3 + with: + node-version: '12' - name: Static code analysis step - uses: betrybe/eslint-linter-action + uses: betrybe/eslint-linter-action@v2 with: token: ${{ secrets.GITHUB_TOKEN }} ``` +Check the latest version to use [here](https://github.com/betrybe/eslint-linter-action/releases). + +## Project constraints + +In order for the action to comment the `ESLint` analysis on the pull request, you must: + +1. Add `ESLint` into your project's dependencies. + +1. Configure the `ESLint` analysis **exclusively** via `.eslintrc.json`. + +### Add `ESLint` into your project's dependencies + +In order to add `ESLint` into your project you must add `ESLint` as a `dev` dependency: + +```shell +npm install eslint --save-dev +``` + +If you have multiple projects to be evaluated with `ESLint` in the repository, you must add `ESLint` to each project. Beware that each project must have the **same** `ESLint` version, in order to **ensure** that **all** projects are being evaluated under the same conditions (i.e., the same `ESLint` version). + +### Configure the `ESLint` analysis **exclusively** via `.eslintrc.json` + +In order to configure the `ESLint` analysis for your project, you must create a `.eslintrc.json` file at the root of your project. Therefore, beware the following: + +- There cannot be present `ESLint` configurations in the `package.json` of the project; + +- There cannot be present inline configurations. + +Here follows an example for `.eslintrc.json`: + +```json +{ + "env": { + "es6": true + }, + "parserOptions": { + "ecmaVersion": 6 + }, + "rules": { + "no-console": "error", + "semi": "error", + "max-params": ["error", 2] + } +} +``` + +If you have multiple projects to be evaluated with `ESLint` in the repository, you must do the following: + +- Create a `.eslintrc.json` file **at the root of each project**. There cannot be present a `.eslintrc.json` at **the root of the repository**; + +- Add `"root": true` for each `.eslintrc.json`, in order to **ensure** the `ESLint` analysis for one project does not use `ESLint` configured in another project in your repository. + +Here follows an example for `.eslintrc.json` defined in one of the projects in your repository: + +```json +{ + "root": true, + "env": { + "es6": true + }, + "parserOptions": { + "ecmaVersion": 6 + }, + "rules": { + "no-console": "error", + "semi": "error", + "max-params": ["error", 2] + } +} +``` + +#### Using plugins + +You can use plugins in the configuration file `.eslintrc.json`. However, beware to follow the instructions as stated in the plugin's documentation and install all dependencies associated with the plugin. There cannot be any warning raised by `npm` stating uninstalled plugin dependencies when installing a project; otherwise you will have an incomplete `ESLint` analysis environment. + +For more information related to configuring `ESLint` with `.eslintrc.json`, read its [guide](https://eslint.org/docs/user-guide/configuring). + ## Development Install the dependencies From 82af637f391e223b0a6010a14af47f559e2a41f8 Mon Sep 17 00:00:00 2001 From: Inacio Cerqueira Date: Mon, 21 Sep 2020 10:06:40 -0300 Subject: [PATCH 2/2] =?UTF-8?q?Ajusta=20t=C3=ADtulo=20da=20se=C3=A7=C3=A3o?= =?UTF-8?q?=20e=20nome=20do=20link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 96d3467..263d893 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# GitHub Action: Linter evaluator action +# ESLint Linter Action -A GitHub action that evaluates projects with [eslint](https://eslint.org/) and comments the evaluation outcome on the student's pull request. +A GitHub action that evaluates projects with [ESLint](https://eslint.org/) and comments the evaluation outcome on the student's pull request. ## Inputs