diff --git a/README.md b/README.md index 798b512a..1593506c 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ jobs: ... ``` -**NOTE:** +**NOTE:** Using the line:`uses: docker://github/super-linter:v3` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v3` will build and compile the **GitHub Super-Linter** at build time. *This can be far more costly in time...* ## Environment variables @@ -170,6 +170,8 @@ and won't run anything unexpected. | **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_JSX** | `true` | Flag to enable or disable the linting process for jsx files (Utilizing: eslint) | +| **VALIDATE_TSX** | `true` | Flag to enable or disable the linting process for tsx files (Utilizing: eslint) | | **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) | diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 4cda6582..d783b4fa 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -273,7 +273,7 @@ function BuildFileList() { ############################ # Get the JavaScript files # ############################ - elif [ "$FILE_TYPE" == "js" ]; then + elif [ "$FILE_TYPE" == "js" ] || [ "$FILE_TYPE" == "jsx" ]; then ################################ # Append the file to the array # ################################ @@ -286,7 +286,7 @@ function BuildFileList() { ############################ # Get the TypeScript files # ############################ - elif [ "$FILE_TYPE" == "ts" ]; then + elif [ "$FILE_TYPE" == "ts" ] || [ "$FILE_TYPE" == "tsx" ]; then ################################ # Append the file to the array # ################################ diff --git a/lib/linter.sh b/lib/linter.sh index 991908df..a6181b4d 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -97,7 +97,7 @@ LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck" # Language array for prints # ############################# LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RAKU' 'PHP' 'RUBY' 'PYTHON' - 'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' + 'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' 'JSX', 'TSX' 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM' 'CSS' 'ENV' 'POWERSHELL' 'ARM' 'KOTLIN' 'PROTOBUF' 'CLOJURE' 'OPENAPI' 'CFN' 'HTML') @@ -126,6 +126,8 @@ VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to vali VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language +VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate jsx files +VALIDATE_TSY="${VALIDATE_TSX}" # Boolean to validate tsx files VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language @@ -1078,7 +1080,7 @@ if [ "$VALIDATE_JAVASCRIPT_ES" == "true" ]; then # Lint the Javascript files # ############################# # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "JAVASCRIPT_ES" "eslint" "eslint --no-eslintrc -c $JAVASCRIPT_LINTER_RULES" ".*\.\(js\)\$" "${FILE_ARRAY_JAVASCRIPT_ES[@]}" + LintCodebase "JAVASCRIPT_ES" "eslint" "eslint --no-eslintrc -c $JAVASCRIPT_LINTER_RULES" ".*\.\(jsx\?\)\$" "${FILE_ARRAY_JAVASCRIPT_ES[@]}" fi ###################### @@ -1103,7 +1105,7 @@ if [ "$VALIDATE_TYPESCRIPT_ES" == "true" ]; then ############################# # Lint the Typescript files # ############################# - LintCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(ts\)\$" "${FILE_ARRAY_TYPESCRIPT_ES[@]}" + LintCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(tsx\?\)\$" "${FILE_ARRAY_TYPESCRIPT_ES[@]}" fi ###################### diff --git a/lib/termColors.sh b/lib/termColors.sh old mode 100644 new mode 100755 diff --git a/lib/validation.sh b/lib/validation.sh index 17f53a3d..807ff9b1 100755 --- a/lib/validation.sh +++ b/lib/validation.sh @@ -60,6 +60,8 @@ function GetValidationInfo() { VALIDATE_ANSIBLE=$(echo "$VALIDATE_ANSIBLE" | awk '{print tolower($0)}') VALIDATE_JAVASCRIPT_ES=$(echo "$VALIDATE_JAVASCRIPT_ES" | awk '{print tolower($0)}') VALIDATE_JAVASCRIPT_STANDARD=$(echo "$VALIDATE_JAVASCRIPT_STANDARD" | awk '{print tolower($0)}') + VALIDATE_JSX=$(echo "$VALIDATE_JSX" | awk '{print tolower($0)}') + VALIDATE_TSX=$(echo "$VALIDATE_TSX" | awk '{print tolower($0)}') VALIDATE_TYPESCRIPT_ES=$(echo "$VALIDATE_TYPESCRIPT_ES" | awk '{print tolower($0)}') VALIDATE_TYPESCRIPT_STANDARD=$(echo "$VALIDATE_TYPESCRIPT_STANDARD" | awk '{print tolower($0)}') VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}') @@ -308,6 +310,34 @@ function GetValidationInfo() { VALIDATE_JAVASCRIPT_STANDARD="true" fi + ############################################# + # Validate if we should check JSX # + ############################################# + if [[ $ANY_SET == "true" ]]; then + # Some linter flags were set - only run those set to true + if [[ -z $VALIDATE_JSX ]]; then + # JSX flag was not set - default to false + VALIDATE_JSX="false" + fi + else + # No linter flags were set - default all to true + VALIDATE_JSX="true" + fi + + ############################################# + # Validate if we should check TSX # + ############################################# + if [[ $ANY_SET == "true" ]]; then + # Some linter flags were set - only run those set to true + if [[ -z $VALIDATE_TSX ]]; then + # TSX flag was not set - default to false + VALIDATE_TSX="false" + fi + else + # No linter flags were set - default all to true + VALIDATE_TSX="true" + fi + ############################################# # Validate if we should check TYPESCRIPT_ES # ############################################# @@ -503,7 +533,7 @@ function GetValidationInfo() { # No linter flags were set - default all to true VALIDATE_EDITORCONFIG="true" fi - + #################################### # Validate if we should check HTML # ####################################