From c846cfd9ce852c41a0fe0992e5b93c934b34ff15 Mon Sep 17 00:00:00 2001 From: Joseph Marino Date: Sun, 25 Oct 2020 20:06:49 -0400 Subject: [PATCH 1/3] Added "Using your own rules files" to the README Added a "Using your own rules files" section to the README under the "Template rules" section. This section may help developers new to super-linter avoid running into issues #864 and #685. --- README.md | 7 +++++- docs/using-rules-files.md | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 docs/using-rules-files.md diff --git a/README.md b/README.md index 80385494..7cab415b 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ It is a simple combination of various linters, written in `bash`, to help valida - [Add Super-Linter badge in your repository README](#add-super-linter-badge-in-your-repository-readme) - [Environment variables](#environment-variables) - [Template rules files](#template-rules-files) + - [Using your own rules files](#using-your-own-rules-files) - [Disabling rules](#disabling-rules) - [Filter linted files](#filter-linted-files) - [Docker Hub](#docker-hub) @@ -296,7 +297,11 @@ You can use the **GitHub** **Super-Linter** _with_ or _without_ your own persona - Copy **any** or **all** template rules files from `TEMPLATES/` into your repository in the location: `.github/linters/` of your repository - If your repository does not have rules files, they will fall back to defaults in [this repository's `TEMPLATE` folder](https://github.com/github/super-linter/tree/master/TEMPLATES) -## Disabling rules +### Using your own rules files + +If your repository contains your own rules files that live outside of a ``.github/linters/`` directory, you will have to tell Super-Linter where your rules files are located in your repository, and what their file names are. To learn more, see [Using your own rules files](docs/using-rules-files.md). + +### Disabling rules If you need to disable certain _rules_ and _functionality_, you can view [Disable Rules](https://github.com/github/super-linter/blob/master/docs/disabling-linters.md) diff --git a/docs/using-rules-files.md b/docs/using-rules-files.md new file mode 100644 index 00000000..3d3dc32a --- /dev/null +++ b/docs/using-rules-files.md @@ -0,0 +1,45 @@ +# Using your own rules files + +If your repository contains your own rules files that live outside of a ``.github/linters/`` directory, you will have to tell Super-Linter where your rules files are located in your repository, and what their file names are. + +You can tell Super-Linter where your rules files are located with the ``LINTER_RULES_PATH`` ENV VAR, and you can tell Super-Linter what their file names are by using any of the ENV VARS from the table below. + +| ENV VARS that can be used with LINTER_RULES_PATH | +| --------------------------------- | +| CSS_FILE_NAME | +| DOCKERFILE_HADOLINT_FILE_NAME | +| EDITORCONFIG_FILE_NAME | +| JAVASCRIPT_ES_CONFIG_FILE | +| MARKDOWN_CONFIG_FILE | +| PYTHON_PYLINT_CONFIG_FILE | +| PYTHON_FLAKE8_CONFIG_FILE | +| PYTHON_BLACK_CONFIG_FILE | +| RUBY_CONFIG_FILE | +| SNAKEMAKE_SNAKEFMT_CONFIG_FILE | +| TYPESCRIPT_ES_CONFIG_FILE | +| JAVASCRIPT_ES_LINTER_RULES | + +### Here is an example + +Below is an example of how to configure the ``env`` section of Super-Linter's ``linter.yml`` to lint JavaScript and CSS code using ``eslint`` and ``stylelint`` with your own ``.eslintrc.json`` and ``.stylelintrc.json`` rules files that are located in the root directory of your repository. + +``` yaml + env: + VALIDATE_ALL_CODEBASE: false + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + LINTER_RULES_PATH: / + CSS_FILE_NAME: .styelintrc.json + JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json + VALIDATE_CSS: true + VALIDATE_JAVASCRIPT_ES: true +``` + +The above example tells Super-Linter: + +a) Your rules files are located in your repository's root directory using the ``LINTER_RULES_PATH: /`` ENV VAR. + +b) Your eslint and stylelint rules files are named ``.stylelintrc.json`` and ``.eslintrc.json`` using the ``CSS_FILE_NAME: .styelintrc.json`` and ``JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json`` ENV VARS. + +c) To use ``stylelint`` and ``eslint`` to lint all CSS and JavaScript code using the ``VALIDATE_CSS: true`` and ``VALIDATE_JAVASCRIPT_ES: true`` ENV VARS. \ No newline at end of file From a137b16ddc274338df34a35ca833741449bab26c Mon Sep 17 00:00:00 2001 From: Joseph Marino Date: Mon, 26 Oct 2020 22:57:10 -0400 Subject: [PATCH 2/3] Removed table Removed table containing ENV VARS that could be configured with LINTER_RULES_PATH from the "Using your own rules files" section. Added text letting users know that they should refer to the environment variables table in the README for a list of filename ENV VARS --- docs/using-rules-files.md | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/docs/using-rules-files.md b/docs/using-rules-files.md index 3d3dc32a..88791134 100644 --- a/docs/using-rules-files.md +++ b/docs/using-rules-files.md @@ -1,23 +1,8 @@ # Using your own rules files -If your repository contains your own rules files that live outside of a ``.github/linters/`` directory, you will have to tell Super-Linter where your rules files are located in your repository, and what their file names are. +If your repository contains your own rules files that live outside of a ``.github/linters/`` directory, you will have to tell Super-Linter where your rules files are located in your repository, and what their filenames are. -You can tell Super-Linter where your rules files are located with the ``LINTER_RULES_PATH`` ENV VAR, and you can tell Super-Linter what their file names are by using any of the ENV VARS from the table below. - -| ENV VARS that can be used with LINTER_RULES_PATH | -| --------------------------------- | -| CSS_FILE_NAME | -| DOCKERFILE_HADOLINT_FILE_NAME | -| EDITORCONFIG_FILE_NAME | -| JAVASCRIPT_ES_CONFIG_FILE | -| MARKDOWN_CONFIG_FILE | -| PYTHON_PYLINT_CONFIG_FILE | -| PYTHON_FLAKE8_CONFIG_FILE | -| PYTHON_BLACK_CONFIG_FILE | -| RUBY_CONFIG_FILE | -| SNAKEMAKE_SNAKEFMT_CONFIG_FILE | -| TYPESCRIPT_ES_CONFIG_FILE | -| JAVASCRIPT_ES_LINTER_RULES | +You can tell Super-Linter where your rules files are located with the ``LINTER_RULES_PATH`` ENV VAR, and you can tell Super-Linter what their filenames are by using any of the filename ENV VARS listed in the [Environment variables table](/README.md#Environment-variables). You can determine which ENV VARS are filename ENV VARS by looking in the notes column for the term "filename." ### Here is an example From 5da607d3007b4b111bcf0019e1195a2cd836b414 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 27 Oct 2020 13:26:42 -0500 Subject: [PATCH 3/3] fix rule --- docs/using-rules-files.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/using-rules-files.md b/docs/using-rules-files.md index 88791134..9c1fe052 100644 --- a/docs/using-rules-files.md +++ b/docs/using-rules-files.md @@ -4,7 +4,7 @@ If your repository contains your own rules files that live outside of a ``.githu You can tell Super-Linter where your rules files are located with the ``LINTER_RULES_PATH`` ENV VAR, and you can tell Super-Linter what their filenames are by using any of the filename ENV VARS listed in the [Environment variables table](/README.md#Environment-variables). You can determine which ENV VARS are filename ENV VARS by looking in the notes column for the term "filename." -### Here is an example +## Here is an example Below is an example of how to configure the ``env`` section of Super-Linter's ``linter.yml`` to lint JavaScript and CSS code using ``eslint`` and ``stylelint`` with your own ``.eslintrc.json`` and ``.stylelintrc.json`` rules files that are located in the root directory of your repository. @@ -27,4 +27,4 @@ a) Your rules files are located in your repository's root directory using the `` b) Your eslint and stylelint rules files are named ``.stylelintrc.json`` and ``.eslintrc.json`` using the ``CSS_FILE_NAME: .styelintrc.json`` and ``JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json`` ENV VARS. -c) To use ``stylelint`` and ``eslint`` to lint all CSS and JavaScript code using the ``VALIDATE_CSS: true`` and ``VALIDATE_JAVASCRIPT_ES: true`` ENV VARS. \ No newline at end of file +c) To use ``stylelint`` and ``eslint`` to lint all CSS and JavaScript code using the ``VALIDATE_CSS: true`` and ``VALIDATE_JAVASCRIPT_ES: true`` ENV VARS.