From 70f51ccd8fafdd647fa7846f8197efe0379100e9 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Thu, 25 Jun 2020 22:54:56 -0400 Subject: [PATCH 1/2] Add JAVASCRIPT_ES_CONFIG_FILE to specify eslintrc filename See: https://eslint.org/docs/user-guide/configuring#configuration-file-formats --- README.md | 1 + lib/linter.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index d21b666b..19a816cd 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ and won't run anything unexpected. | **VALIDATE_COFFEE** | `true` | Flag to enable or disable the linting process of the language . | | **VALIDATE_ANSIBLE** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_JAVASCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | +| **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`)| | **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | | **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | | **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | diff --git a/lib/linter.sh b/lib/linter.sh index e422ad9d..41d36428 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -92,6 +92,7 @@ VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate lang VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language +JAVASCRIPT_ES_CONFIG_FILE="${JAVASCRIPT_ES_CONFIG_FILE}" # Filename for eslint configuration (ex: .eslintrc.yml, .eslintrc.json) VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language @@ -117,6 +118,7 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory +DEFAULT_JAVASCRIPT_ES_CONFIG_FILE=".eslintrc.yml" # Default eslint configuration filename DEFAULT_RUN_LOCAL='false' # Default value for debugging locally DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output @@ -1226,6 +1228,19 @@ GetValidationInfo() # Set the value ANSIBLE_DIRECTORY="$TEMP_ANSIBLE_DIRECTORY" fi + + ######################################### + # Get the eslint configuration filename # + ######################################### + if [ -z "$JAVASCRIPT_ES_CONFIG_FILE" ]; then + ###################################### + # No filename passed, set to default # + ###################################### + JAVASCRIPT_ES_CONFIG_FILE="$DEFAULT_JAVASCRIPT_ES_CONFIG_FILE" + fi + # Set Javascript Vars based on JAVASCRIPT_ES_CONFIG_FILE + JAVASCRIPT_FILE_NAME='$JAVASCRIPT_ES_CONFIG_FILE' # Name of the file + JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules ############################### # Get the disable errors flag # From 10a7c9c4798321343a1f38a4617fb5f15c819f87 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 26 Jun 2020 11:49:41 -0500 Subject: [PATCH 2/2] Adding cleaner update --- README.md | 1 + lib/linter.sh | 19 ++----------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 567bb466..42fbcbc2 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ and won't run anything unexpected. | **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`)| | **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | | **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | +| **TYPESCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`)| | **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | | **VALIDATE_DOCKER** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the language. | diff --git a/lib/linter.sh b/lib/linter.sh index 2dd5d3cb..da97c9f2 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -29,11 +29,11 @@ RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to th COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffeescript lint rules # Javascript Vars -JAVASCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file +JAVASCRIPT_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules JAVASCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard # Typescript Vars -TYPESCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file +TYPESCRIPT_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file TYPESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TYPESCRIPT_FILE_NAME" # Path to the Typescript lint rules TYPESCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard # Ansible Vars @@ -98,7 +98,6 @@ VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate lang VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language -JAVASCRIPT_ES_CONFIG_FILE="${JAVASCRIPT_ES_CONFIG_FILE}" # Filename for eslint configuration (ex: .eslintrc.yml, .eslintrc.json) VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language @@ -126,7 +125,6 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory -DEFAULT_JAVASCRIPT_ES_CONFIG_FILE=".eslintrc.yml" # Default eslint configuration filename DEFAULT_RUN_LOCAL='false' # Default value for debugging locally DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output @@ -1318,19 +1316,6 @@ GetValidationInfo() # Set the value ANSIBLE_DIRECTORY="$TEMP_ANSIBLE_DIRECTORY" fi - - ######################################### - # Get the eslint configuration filename # - ######################################### - if [ -z "$JAVASCRIPT_ES_CONFIG_FILE" ]; then - ###################################### - # No filename passed, set to default # - ###################################### - JAVASCRIPT_ES_CONFIG_FILE="$DEFAULT_JAVASCRIPT_ES_CONFIG_FILE" - fi - # Set Javascript Vars based on JAVASCRIPT_ES_CONFIG_FILE - JAVASCRIPT_FILE_NAME='$JAVASCRIPT_ES_CONFIG_FILE' # Name of the file - JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules ############################### # Get the disable errors flag #