mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 20:52:12 -05:00
Added support for jsx and tsx files
This commit is contained in:
parent
3ddad12e89
commit
8bae8dd0b9
5 changed files with 41 additions and 7 deletions
|
@ -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) |
|
||||
|
|
|
@ -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 #
|
||||
################################
|
||||
|
|
|
@ -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
|
||||
|
||||
######################
|
||||
|
|
0
lib/termColors.sh
Normal file → Executable file
0
lib/termColors.sh
Normal file → Executable file
|
@ -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 #
|
||||
####################################
|
||||
|
|
Loading…
Reference in a new issue