mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 06:01:05 -05:00
Typescript prettier (#2121)
* adding typescript prettier * adding typescript prettier * fix scala
This commit is contained in:
parent
e0790b4835
commit
fb82126082
4 changed files with 35 additions and 6 deletions
|
@ -287,7 +287,7 @@ But if you wish to select or exclude specific linters, we give you full control
|
||||||
| **FILTER_REGEX_INCLUDE** | `all` | Regular expression defining which files will be processed by linters (ex: `.*src/.*`) |
|
| **FILTER_REGEX_INCLUDE** | `all` | Regular expression defining which files will be processed by linters (ex: `.*src/.*`) |
|
||||||
| **GITHUB_ACTIONS_CONFIG_FILE** | `actionlint.yml` | Filename for [Actionlint configuration](https://github.com/rhysd/actionlint/blob/main/docs/config.md) (ex: `actionlint.yml`) |
|
| **GITHUB_ACTIONS_CONFIG_FILE** | `actionlint.yml` | Filename for [Actionlint configuration](https://github.com/rhysd/actionlint/blob/main/docs/config.md) (ex: `actionlint.yml`) |
|
||||||
| **GITHUB_DOMAIN** | `github.com` | Specify a custom GitHub domain in case GitHub Enterprise is used: e.g. `github.myenterprise.com` |
|
| **GITHUB_DOMAIN** | `github.com` | Specify a custom GitHub domain in case GitHub Enterprise is used: e.g. `github.myenterprise.com` |
|
||||||
| **GITHUB_CUSTOM_API_URL** | `https://api.github.com` | Specify a custom GitHub API URL in case GitHub Enterprise is used: e.g. `https://github.myenterprise.com/api/v3` | |
|
| **GITHUB_CUSTOM_API_URL** | `https://api.github.com` | Specify a custom GitHub API URL in case GitHub Enterprise is used: e.g. `https://github.myenterprise.com/api/v3` |
|
||||||
| **GITLEAKS_CONFIG_FILE** | `.gitleaks.toml` | Filename for [GitLeaks configuration](https://github.com/zricethezav/gitleaks#configuration) (ex: `.geatleaks.toml`) |
|
| **GITLEAKS_CONFIG_FILE** | `.gitleaks.toml` | Filename for [GitLeaks configuration](https://github.com/zricethezav/gitleaks#configuration) (ex: `.geatleaks.toml`) |
|
||||||
| **IGNORE_GENERATED_FILES** | `false` | If set to `true`, super-linter will ignore all the files with `@generated` marker but without `@not-generated` marker. |
|
| **IGNORE_GENERATED_FILES** | `false` | If set to `true`, super-linter will ignore all the files with `@generated` marker but without `@not-generated` marker. |
|
||||||
| **IGNORE_GITIGNORED_FILES** | `false` | If set to `true`, super-linter will ignore all the files that are ignored by Git. |
|
| **IGNORE_GITIGNORED_FILES** | `false` | If set to `true`, super-linter will ignore all the files that are ignored by Git. |
|
||||||
|
@ -318,6 +318,7 @@ But if you wish to select or exclude specific linters, we give you full control
|
||||||
| **TERRAFORM_TFLINT_CONFIG_FILE** | `.tflint.hcl` | Filename for [tfLint configuration](https://github.com/terraform-linters/tflint) (ex: `.tflint.hcl`) |
|
| **TERRAFORM_TFLINT_CONFIG_FILE** | `.tflint.hcl` | Filename for [tfLint configuration](https://github.com/terraform-linters/tflint) (ex: `.tflint.hcl`) |
|
||||||
| **TERRAFORM_TERRASCAN_CONFIG_FILE**| `terrascan.toml` | Filename for [terrascan configuration](https://github.com/accurics/terrascan) (ex: `terrascan.toml`) |
|
| **TERRAFORM_TERRASCAN_CONFIG_FILE**| `terrascan.toml` | Filename for [terrascan configuration](https://github.com/accurics/terrascan) (ex: `terrascan.toml`) |
|
||||||
| **NATURAL_LANGUAGE_CONFIG_FILE** | `.textlintrc` | Filename for [textlint configuration](https://textlint.github.io/docs/getting-started.html#configuration) (ex: `.textlintrc`) |
|
| **NATURAL_LANGUAGE_CONFIG_FILE** | `.textlintrc` | Filename for [textlint configuration](https://textlint.github.io/docs/getting-started.html#configuration) (ex: `.textlintrc`) |
|
||||||
|
| **TYPESCRIPT_DEFAULT_STYLE** | `standard` | Flag to set the default style of TypeScript. Available options: **standard**/**prettier** |
|
||||||
| **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`) |
|
| **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`) |
|
||||||
| **USE_FIND_ALGORITHM** | `false` | By default, we use `git diff` to find all files in the workspace and what has been updated, this would enable the Linux `find` method instead to find all files to lint |
|
| **USE_FIND_ALGORITHM** | `false` | By default, we use `git diff` to find all files in the workspace and what has been updated, this would enable the Linux `find` method instead to find all files to lint |
|
||||||
| **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. |
|
| **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. |
|
||||||
|
|
4
TEMPLATES/.scalafmt.conf
Normal file
4
TEMPLATES/.scalafmt.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
// Scala Format Configuration
|
||||||
|
// https://scalameta.org/scalafmt/docs/configuration.html
|
||||||
|
align.preset = more // For pretty alignment.
|
||||||
|
maxColumn = 80
|
|
@ -744,6 +744,7 @@ function BuildFileList() {
|
||||||
################################
|
################################
|
||||||
FILE_ARRAY_TYPESCRIPT_ES+=("${FILE}")
|
FILE_ARRAY_TYPESCRIPT_ES+=("${FILE}")
|
||||||
FILE_ARRAY_TYPESCRIPT_STANDARD+=("${FILE}")
|
FILE_ARRAY_TYPESCRIPT_STANDARD+=("${FILE}")
|
||||||
|
FILE_ARRAY_TYPESCRIPT_PRETTIER+=("${FILE}")
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# Get the TSX files #
|
# Get the TSX files #
|
||||||
|
|
|
@ -182,6 +182,10 @@ NATURAL_LANGUAGE_FILE_NAME="${NATURAL_LANGUAGE_CONFIG_FILE:-.textlintrc}"
|
||||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||||
TSX_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
TSX_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
||||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||||
|
TYPESCRIPT_DEFAULT_STYLE="${TYPESCRIPT_DEFAULT_STYLE:-standard}"
|
||||||
|
TYPESCRIPT_STYLE_NAME='' # Variable for the style
|
||||||
|
TYPESCRIPT_STYLE='' # Variable for the style
|
||||||
|
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||||
TYPESCRIPT_ES_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
TYPESCRIPT_ES_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
||||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||||
TYPESCRIPT_STANDARD_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
TYPESCRIPT_STANDARD_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
||||||
|
@ -208,6 +212,24 @@ else
|
||||||
JAVASCRIPT_STYLE='standard'
|
JAVASCRIPT_STYLE='standard'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
# Parse if we are using JS standard or prettier #
|
||||||
|
#################################################
|
||||||
|
# Remove spaces
|
||||||
|
TYPESCRIPT_DEFAULT_STYLE=$(echo "${TYPESCRIPT_DEFAULT_STYLE}" | tr -d ' ')
|
||||||
|
# lowercase
|
||||||
|
TYPESCRIPT_DEFAULT_STYLE=$(echo "${TYPESCRIPT_DEFAULT_STYLE}" | tr '[:upper:]' '[:lower:]')
|
||||||
|
# Check and set
|
||||||
|
if [ "${TYPESCRIPT_DEFAULT_STYLE}" == "prettier" ]; then
|
||||||
|
# Set to prettier
|
||||||
|
TYPESCRIPT_STYLE_NAME='TYPESCRIPT_PRETTIER'
|
||||||
|
TYPESCRIPT_STYLE='prettier'
|
||||||
|
else
|
||||||
|
# Default to standard
|
||||||
|
TYPESCRIPT_STYLE_NAME='TYPESCRIPT_STANDARD'
|
||||||
|
TYPESCRIPT_STYLE='standard'
|
||||||
|
fi
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Language array #
|
# Language array #
|
||||||
##################
|
##################
|
||||||
|
@ -222,7 +244,7 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CLANG_FORMAT'
|
||||||
'PYTHON_ISORT' 'PYTHON_MYPY' 'R' 'RAKU' 'RUBY' 'RUST_2015' 'RUST_2018'
|
'PYTHON_ISORT' 'PYTHON_MYPY' 'R' 'RAKU' 'RUBY' 'RUST_2015' 'RUST_2018'
|
||||||
'RUST_CLIPPY' 'SCALAFMT' 'SHELL_SHFMT' 'SNAKEMAKE_LINT' 'SNAKEMAKE_SNAKEFMT'
|
'RUST_CLIPPY' 'SCALAFMT' 'SHELL_SHFMT' 'SNAKEMAKE_LINT' 'SNAKEMAKE_SNAKEFMT'
|
||||||
'STATES' 'SQL' 'SQLFLUFF' 'TEKTON' 'TERRAFORM_TFLINT' 'TERRAFORM_TERRASCAN'
|
'STATES' 'SQL' 'SQLFLUFF' 'TEKTON' 'TERRAFORM_TFLINT' 'TERRAFORM_TERRASCAN'
|
||||||
'TERRAGRUNT' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
'TERRAGRUNT' 'TSX' 'TYPESCRIPT_ES' "${TYPESCRIPT_STYLE_NAME}" 'XML' 'YAML')
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Linter command names array #
|
# Linter command names array #
|
||||||
|
@ -296,7 +318,7 @@ LINTER_NAMES_ARRAY['TERRAFORM_TERRASCAN']="terrascan"
|
||||||
LINTER_NAMES_ARRAY['TERRAGRUNT']="terragrunt"
|
LINTER_NAMES_ARRAY['TERRAGRUNT']="terragrunt"
|
||||||
LINTER_NAMES_ARRAY['TSX']="eslint"
|
LINTER_NAMES_ARRAY['TSX']="eslint"
|
||||||
LINTER_NAMES_ARRAY['TYPESCRIPT_ES']="eslint"
|
LINTER_NAMES_ARRAY['TYPESCRIPT_ES']="eslint"
|
||||||
LINTER_NAMES_ARRAY['TYPESCRIPT_STANDARD']="standard"
|
LINTER_NAMES_ARRAY["${TYPESCRIPT_STYLE_NAME}"]="${TYPESCRIPT_STYLE}"
|
||||||
LINTER_NAMES_ARRAY['XML']="xmllint"
|
LINTER_NAMES_ARRAY['XML']="xmllint"
|
||||||
LINTER_NAMES_ARRAY['YAML']="yamllint"
|
LINTER_NAMES_ARRAY['YAML']="yamllint"
|
||||||
|
|
||||||
|
@ -916,6 +938,7 @@ LINTER_COMMANDS_ARRAY['TERRAGRUNT']="terragrunt hclfmt --terragrunt-check --terr
|
||||||
LINTER_COMMANDS_ARRAY['TSX']="eslint --no-eslintrc -c ${TSX_LINTER_RULES}"
|
LINTER_COMMANDS_ARRAY['TSX']="eslint --no-eslintrc -c ${TSX_LINTER_RULES}"
|
||||||
LINTER_COMMANDS_ARRAY['TYPESCRIPT_ES']="eslint --no-eslintrc -c ${TYPESCRIPT_ES_LINTER_RULES}"
|
LINTER_COMMANDS_ARRAY['TYPESCRIPT_ES']="eslint --no-eslintrc -c ${TYPESCRIPT_ES_LINTER_RULES}"
|
||||||
LINTER_COMMANDS_ARRAY['TYPESCRIPT_STANDARD']="standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin ${TYPESCRIPT_STANDARD_LINTER_RULES}"
|
LINTER_COMMANDS_ARRAY['TYPESCRIPT_STANDARD']="standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin ${TYPESCRIPT_STANDARD_LINTER_RULES}"
|
||||||
|
LINTER_COMMANDS_ARRAY['TYPESCRIPT_PRETTIER']="prettier --check"
|
||||||
LINTER_COMMANDS_ARRAY['XML']="xmllint"
|
LINTER_COMMANDS_ARRAY['XML']="xmllint"
|
||||||
LINTER_COMMANDS_ARRAY['YAML']="yamllint -c ${YAML_LINTER_RULES} -f parsable"
|
LINTER_COMMANDS_ARRAY['YAML']="yamllint -c ${YAML_LINTER_RULES} -f parsable"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue