From 5be49266330f237f4a8ab2acccffe93b69cf4b04 Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Thu, 11 Jul 2024 12:54:14 +0200 Subject: [PATCH] feat: remove no-eslintrc and simplify eslint conf (#5809) - Remove --no-eslintrc to simplify the upgrade path to ESlint >= v9, because v9 defaults to aonther configuration file format. - Simplify the default ESlint configuration removing options that have been deprecated, or that are equal to the default ones. Close #5688 --- TEMPLATES/.eslintrc.yml | 33 --------------------------------- lib/functions/linterCommands.sh | 12 ++++++------ 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/TEMPLATES/.eslintrc.yml b/TEMPLATES/.eslintrc.yml index 55f854b2..d9c2486f 100644 --- a/TEMPLATES/.eslintrc.yml +++ b/TEMPLATES/.eslintrc.yml @@ -1,51 +1,18 @@ --- -############################# -############################# -## JavaScript Linter rules ## -############################# -############################# - -############ -# Env Vars # -############ env: browser: true es6: true jest: true -############### -# Global Vars # -############### -globals: - Atomics: readonly - SharedArrayBuffer: readonly - ignorePatterns: - "!.*" - "**/node_modules/.*" -############### -# Parser vars # -############### parser: '@typescript-eslint/parser' -parserOptions: - ecmaVersion: 2018 - sourceType: module -########### -# Plugins # -########### plugins: - '@typescript-eslint' -######### -# Rules # -######### -rules: { } - -############################## -# Overrides for JSON parsing # -############################## overrides: # JSON files diff --git a/lib/functions/linterCommands.sh b/lib/functions/linterCommands.sh index 8df40b7e..4da569a2 100755 --- a/lib/functions/linterCommands.sh +++ b/lib/functions/linterCommands.sh @@ -61,13 +61,13 @@ LINTER_COMMANDS_ARRAY_GOOGLE_JAVA_FORMAT=(java -jar /usr/bin/google-java-format LINTER_COMMANDS_ARRAY_GROOVY=(npm-groovy-lint -c "${GROOVY_LINTER_RULES}" --failon warning --no-insight) LINTER_COMMANDS_ARRAY_HTML=(htmlhint --config "${HTML_LINTER_RULES}") LINTER_COMMANDS_ARRAY_JAVA=(java -jar /usr/bin/checkstyle -c "${JAVA_LINTER_RULES}") -LINTER_COMMANDS_ARRAY_JAVASCRIPT_ES=(eslint --no-eslintrc -c "${JAVASCRIPT_ES_LINTER_RULES}") +LINTER_COMMANDS_ARRAY_JAVASCRIPT_ES=(eslint -c "${JAVASCRIPT_ES_LINTER_RULES}") LINTER_COMMANDS_ARRAY_JAVASCRIPT_STANDARD=(standard "${JAVASCRIPT_STANDARD_LINTER_RULES}") LINTER_COMMANDS_ARRAY_JAVASCRIPT_PRETTIER=(prettier --check) LINTER_COMMANDS_ARRAY_JSCPD=(jscpd --config "${JSCPD_LINTER_RULES}") -LINTER_COMMANDS_ARRAY_JSON=(eslint --no-eslintrc -c "${JAVASCRIPT_ES_LINTER_RULES}" --ext '.json') -LINTER_COMMANDS_ARRAY_JSONC=(eslint --no-eslintrc -c "${JAVASCRIPT_ES_LINTER_RULES}" --ext '.json5,.jsonc') -LINTER_COMMANDS_ARRAY_JSX=(eslint --no-eslintrc -c "${JSX_LINTER_RULES}") +LINTER_COMMANDS_ARRAY_JSON=(eslint -c "${JAVASCRIPT_ES_LINTER_RULES}" --ext '.json') +LINTER_COMMANDS_ARRAY_JSONC=(eslint -c "${JAVASCRIPT_ES_LINTER_RULES}" --ext '.json5,.jsonc') +LINTER_COMMANDS_ARRAY_JSX=(eslint -c "${JSX_LINTER_RULES}") LINTER_COMMANDS_ARRAY_KOTLIN=(ktlint "{/}") LINTER_COMMANDS_ARRAY_KUBERNETES_KUBECONFORM=(kubeconform -strict) if [ "${KUBERNETES_KUBECONFORM_OPTIONS}" != "null" ] && [ -n "${KUBERNETES_KUBECONFORM_OPTIONS}" ]; then @@ -126,8 +126,8 @@ LINTER_COMMANDS_ARRAY_TERRAFORM_FMT=(terraform fmt -check -diff) LINTER_COMMANDS_ARRAY_TERRAFORM_TFLINT=("TF_DATA_DIR=\"/tmp/.terraform-TERRAFORM_TFLINT-{//}\"" tflint -c "${TERRAFORM_TFLINT_LINTER_RULES}" "--filter=\"{/}\"") LINTER_COMMANDS_ARRAY_TERRAFORM_TERRASCAN=(terrascan scan -i terraform -t all -c "${TERRAFORM_TERRASCAN_LINTER_RULES}" -f) 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_TSX=(eslint -c "${TSX_LINTER_RULES}") +LINTER_COMMANDS_ARRAY_TYPESCRIPT_ES=(eslint -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_FILE}") LINTER_COMMANDS_ARRAY_TYPESCRIPT_PRETTIER=(prettier --check) LINTER_COMMANDS_ARRAY_XML=(xmllint)