mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-24 23:21:12 -05:00
Fix ts-standard configuration (#4932)
* Fix ts-standard configuration * Fix default TYPESCRIPT_STANDARD_TSCONFIG_FILE assignment
This commit is contained in:
parent
1551a9b362
commit
a8150b40c8
6 changed files with 11 additions and 25 deletions
1
.github/workflows/cd.yml
vendored
1
.github/workflows/cd.yml
vendored
|
@ -73,6 +73,7 @@ jobs:
|
|||
-e ACTIONS_RUNNER_DEBUG=true \
|
||||
-e RENOVATE_SHAREABLE_CONFIG_PRESET_FILE_NAMES="default.json,hoge.json" \
|
||||
-e ERROR_ON_MISSING_EXEC_BIT=true \
|
||||
-e TYPESCRIPT_STANDARD_TSCONFIG_FILE=".github/linters/tsconfig.json" \
|
||||
-v "${GITHUB_WORKSPACE}:/tmp/lint" \
|
||||
"${CONTAINER_IMAGE_ID}"
|
||||
|
||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -75,6 +75,7 @@ jobs:
|
|||
DEFAULT_BRANCH: main
|
||||
LOCAL_UPDATES: true
|
||||
RENOVATE_SHAREABLE_CONFIG_PRESET_FILE_NAMES: "default.json,hoge.json"
|
||||
TYPESCRIPT_STANDARD_TSCONFIG_FILE: ".github/linters/tsconfig.json"
|
||||
|
||||
- name: Run Test Suite
|
||||
run: make test
|
||||
|
@ -88,6 +89,7 @@ jobs:
|
|||
-e ACTIONS_RUNNER_DEBUG=true \
|
||||
-e RENOVATE_SHAREABLE_CONFIG_PRESET_FILE_NAMES="default.json,hoge.json" \
|
||||
-e ERROR_ON_MISSING_EXEC_BIT=true \
|
||||
-e TYPESCRIPT_STANDARD_TSCONFIG_FILE=".github/linters/tsconfig.json" \
|
||||
-v "${GITHUB_WORKSPACE}:/tmp/lint" \
|
||||
"${CONTAINER_IMAGE_ID}"
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ But if you wish to select or exclude specific linters, we give you full control
|
|||
| **CREATE_LOG_FILE** | `false` | If set to `true`, it creates the log file. You can set the log filename using the `LOG_FILE` environment variable. |
|
||||
| **CSS_FILE_NAME** | `.stylelintrc.json` | Filename for [Stylelint configuration](https://github.com/stylelint/stylelint) (ex: `.stylelintrc.yml`, `.stylelintrc.yaml`) |
|
||||
| **DEFAULT_BRANCH** | `master` | The name of the repository default branch. |
|
||||
| **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. |
|
||||
| **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. Defaults to `GITHUB_WORKSPACE` when running in GitHub Actions. There's no need to configure this variable when running in GitHub Actions. |
|
||||
| **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. |
|
||||
| **DOCKERFILE_HADOLINT_FILE_NAME** | `.hadolint.yaml` | Filename for [hadolint configuration](https://github.com/hadolint/hadolint) (ex: `.hadolintlintrc.yaml`) |
|
||||
| **EDITORCONFIG_FILE_NAME** | `.ecrc` | Filename for [editorconfig-checker configuration](https://github.com/editorconfig-checker/editorconfig-checker) |
|
||||
|
@ -333,7 +333,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`) |
|
||||
| **TYPESCRIPT_DEFAULT_STYLE** | `ts-standard` | Flag to set the default style of TypeScript. Available options: **ts-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_STANDARD_TSCONFIG_FILE** | `tsconfig.json` | Filename for [TypeScript configuration](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) in [ts-standard](https://github.com/standard/ts-standard) (ex: `tsconfig.json`, `tsconfig.eslint.json`) |
|
||||
| **TYPESCRIPT_STANDARD_TSCONFIG_FILE** | `${DEFAULT_WORKSPACE}/tsconfig.json` | Path to the [TypeScript project configuration](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) in [ts-standard](https://github.com/standard/ts-standard). The path is relative to `DEFAULT_WORKSPACE` |
|
||||
| **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_JSCPD_ALL_CODEBASE** | `false` | If set to `true`, will lint the whole codebase with JSCPD. If set to `false`, JSCPD will only lint files one by one. |
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"strictNullChecks": true
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
"tests",
|
||||
"tools",
|
||||
"/tmp/lint/.automation/test"
|
||||
]
|
||||
}
|
|
@ -176,7 +176,7 @@ GetStandardRules() {
|
|||
################
|
||||
# Pull In Vars #
|
||||
################
|
||||
LINTER="${1}" # Type: javascript | typescript
|
||||
LINTER="${1}"
|
||||
|
||||
#########################################################################
|
||||
# Need to get the ENV vars from the linter rules to run in command line #
|
||||
|
@ -193,8 +193,6 @@ GetStandardRules() {
|
|||
GET_ENV_ARRAY=()
|
||||
if [[ ${LINTER} == "javascript" ]]; then
|
||||
mapfile -t GET_ENV_ARRAY < <(yq .env "${JAVASCRIPT_STANDARD_LINTER_RULES}" | grep true)
|
||||
elif [[ ${LINTER} == "typescript" ]]; then
|
||||
mapfile -t GET_ENV_ARRAY < <(yq .env "${TYPESCRIPT_STANDARD_LINTER_RULES}" | grep true)
|
||||
fi
|
||||
|
||||
#######################
|
||||
|
@ -243,7 +241,5 @@ GetStandardRules() {
|
|||
#########################################
|
||||
if [[ ${LINTER} == "javascript" ]]; then
|
||||
JAVASCRIPT_STANDARD_LINTER_RULES="$(echo -e "${ENV_STRING}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||
elif [[ ${LINTER} == "typescript" ]]; then
|
||||
TYPESCRIPT_STANDARD_LINTER_RULES="$(echo -e "${ENV_STRING}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -215,10 +215,6 @@ TYPESCRIPT_STYLE='' # Variable for the style
|
|||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||
TYPESCRIPT_ES_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||
TYPESCRIPT_STANDARD_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||
TYPESCRIPT_STANDARD_TSCONFIG_FILE_NAME="${TYPESCRIPT_STANDARD_TSCONFIG_FILE:-tsconfig.json}"
|
||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||
USE_FIND_ALGORITHM="${USE_FIND_ALGORITHM:-false}"
|
||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||
YAML_FILE_NAME="${YAML_CONFIG_FILE:-.yaml-lint.yml}"
|
||||
|
@ -877,6 +873,9 @@ export DEFAULT_ANSIBLE_DIRECTORY
|
|||
DEFAULT_TEST_CASE_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}/ansible" # Default Ansible directory when running test cases
|
||||
export DEFAULT_TEST_CASE_ANSIBLE_DIRECTORY # Workaround SC2034
|
||||
|
||||
TYPESCRIPT_STANDARD_TSCONFIG_FILE="${GITHUB_WORKSPACE}/${TYPESCRIPT_STANDARD_TSCONFIG_FILE:-"tsconfig.json"}"
|
||||
debug "TYPESCRIPT_STANDARD_TSCONFIG_FILE: ${TYPESCRIPT_STANDARD_TSCONFIG_FILE}"
|
||||
|
||||
############################
|
||||
# Validate the environment #
|
||||
############################
|
||||
|
@ -897,9 +896,8 @@ for LANGUAGE in "${LANGUAGE_ARRAY_FOR_LINTER_RULES[@]}"; do
|
|||
eval "GetLinterRules ${LANGUAGE} ${DEFAULT_RULES_LOCATION}"
|
||||
done
|
||||
|
||||
# Load rules for a couple of special cases
|
||||
# Load rules for special cases
|
||||
GetStandardRules "javascript"
|
||||
GetStandardRules "typescript"
|
||||
|
||||
##########################
|
||||
# Define linter commands #
|
||||
|
@ -1003,7 +1001,7 @@ LINTER_COMMANDS_ARRAY['TERRAFORM_TERRASCAN']="terrascan scan -i terraform -t all
|
|||
LINTER_COMMANDS_ARRAY['TERRAGRUNT']="terragrunt hclfmt --terragrunt-check --terragrunt-log-level error --terragrunt-hclfmt-file"
|
||||
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_STANDARD']="ts-standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin --project ${TYPESCRIPT_STANDARD_TSCONFIG_LINTER_RULES} ${TYPESCRIPT_STANDARD_LINTER_RULES}"
|
||||
LINTER_COMMANDS_ARRAY['TYPESCRIPT_STANDARD']="ts-standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin --project ${TYPESCRIPT_STANDARD_TSCONFIG_FILE}"
|
||||
LINTER_COMMANDS_ARRAY['TYPESCRIPT_PRETTIER']="prettier --check"
|
||||
LINTER_COMMANDS_ARRAY['XML']="xmllint"
|
||||
if [ "${YAML_ERROR_ON_WARNING}" == 'false' ]; then
|
||||
|
|
Loading…
Reference in a new issue