feat: prettier for additional languages (#6025)

- CSS, Sass, SCSS
- HTML
- JSON
- JSX
- GraphQL
- Vue
- YAML
This commit is contained in:
Marco Ferrari 2024-08-15 11:46:02 +02:00 committed by GitHub
parent 1080af3933
commit 1d12a31fce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 406 additions and 12 deletions

View file

@ -10,6 +10,7 @@
"**/test/linters/cloudformation",
"**/test/linters/coffeescript",
"**/test/linters/css",
"**/test/linters/css_prettier",
"**/test/linters/html",
"**/test/linters/javascript_es",
"**/test/linters/javascript_prettier",

View file

@ -260,8 +260,12 @@ fix-codebase: ## Fix and format the entire codebase
-e FIX_JAVASCRIPT_ES=true \
-e FIX_JAVASCRIPT_PRETTIER=true \
-e FIX_JSON=true \
-e FIX_JSON_PRETTIER=true \
-e FIX_MARKDOWN=true \
-e FIX_MARKDOWN_PRETTIER=true \
-e FIX_NATURAL_LANGUAGE=true \
-e FIX_SHELL_SHFMT=true \
-e FIX_YAML_PRETTIER=true \
-e GITLEAKS_CONFIG_FILE=".gitleaks-ignore-tests.toml" \
-e LOG_LEVEL=DEBUG \
-e RUN_LOCAL=true \

View file

@ -347,6 +347,7 @@ BuildFileArrays() {
elif [ "${FILE_TYPE}" == "css" ] || [ "${FILE_TYPE}" == "scss" ] ||
[ "${FILE_TYPE}" == "sass" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-CSS"
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-CSS_PRETTIER"
elif [ "${FILE_TYPE}" == "dart" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-DART"
# Use BASE_FILE here because FILE_TYPE is not reliable when there is no file extension
@ -402,6 +403,7 @@ BuildFileArrays() {
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GROOVY"
elif [ "${FILE_TYPE}" == "html" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-HTML"
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-HTML_PRETTIER"
elif [ "${FILE_TYPE}" == "java" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVA"
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GOOGLE_JAVA_FORMAT"
@ -413,6 +415,7 @@ BuildFileArrays() {
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JSONC"
elif [ "${FILE_TYPE}" == "json" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JSON"
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JSON_PRETTIER"
if DetectOpenAPIFile "${FILE}"; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-OPENAPI"
fi
@ -430,6 +433,7 @@ BuildFileArrays() {
fi
elif [ "${FILE_TYPE}" == "jsx" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JSX"
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JSX_PRETTIER"
elif [ "${FILE_TYPE}" == "kt" ] || [ "${FILE_TYPE}" == "kts" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-KOTLIN"
elif [ "$FILE_TYPE" == "lua" ]; then
@ -438,6 +442,7 @@ BuildFileArrays() {
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-LATEX"
elif [ "${FILE_TYPE}" == "md" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-MARKDOWN"
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-MARKDOWN_PRETTIER"
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-NATURAL_LANGUAGE"
elif [ "${FILE_TYPE}" == "php" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-PHP_BUILTIN"
@ -508,8 +513,13 @@ BuildFileArrays() {
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-XML"
elif [[ "${FILE}" =~ .?goreleaser.+ya?ml ]]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GO_RELEASER"
elif [ "${FILE_TYPE}" == "graphql" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GRAPHQL_PRETTIER"
elif [ "${FILE_TYPE}" == "vue" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-VUE_PRETTIER"
elif [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-YAML"
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-YAML_PRETTIER"
if DetectActions "${FILE}"; then
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GITHUB_ACTIONS"
fi

View file

@ -12,6 +12,9 @@ source /action/lib/globals/linterCommandsOptions.sh
# Define linter commands #
##########################
# These commands are reused across several languages
PRETTIER_COMMAND=(prettier)
LINTER_COMMANDS_ARRAY_ANSIBLE=(ansible-lint -c "${ANSIBLE_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_ARM=(pwsh -NoProfile -NoLogo -Command "\"Import-Module ${ARM_TTK_PSD1} ; \\\${config} = \\\$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath '{}'; if (\\\${Error}.Count) { exit 1 }\"")
LINTER_COMMANDS_ARRAY_BASH=(shellcheck --color --rcfile "${BASH_LINTER_RULES}")
@ -43,6 +46,7 @@ LINTER_COMMANDS_ARRAY_COFFEESCRIPT=(coffeelint -f "${COFFEESCRIPT_LINTER_RULES}"
LINTER_COMMANDS_ARRAY_CPP=(cpplint)
LINTER_COMMANDS_ARRAY_CSHARP=(dotnet format whitespace --folder --exclude / --include "{/}")
LINTER_COMMANDS_ARRAY_CSS=(stylelint --config "${CSS_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_CSS_PRETTIER=("${PRETTIER_COMMAND[@]}")
LINTER_COMMANDS_ARRAY_DART=(dart analyze --fatal-infos --fatal-warnings)
LINTER_COMMANDS_ARRAY_DOCKERFILE_HADOLINT=(hadolint -c "${DOCKERFILE_HADOLINT_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_EDITORCONFIG=(editorconfig-checker -config "${EDITORCONFIG_LINTER_RULES}")
@ -64,11 +68,13 @@ LINTER_COMMANDS_ARRAY_GO=(golangci-lint run -c "${GO_LINTER_RULES}" --fast)
LINTER_COMMANDS_ARRAY_GO_MODULES=(golangci-lint run --allow-parallel-runners -c "${GO_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_GO_RELEASER=(goreleaser check)
LINTER_COMMANDS_ARRAY_GOOGLE_JAVA_FORMAT=(java -jar /usr/bin/google-java-format)
LINTER_COMMANDS_ARRAY_GRAPHQL_PRETTIER=("${PRETTIER_COMMAND[@]}")
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_HTML_PRETTIER=("${PRETTIER_COMMAND[@]}")
LINTER_COMMANDS_ARRAY_JAVA=(java -jar /usr/bin/checkstyle -c "${JAVA_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_JAVASCRIPT_ES=(eslint -c "${JAVASCRIPT_ES_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_JAVASCRIPT_PRETTIER=(prettier)
LINTER_COMMANDS_ARRAY_JAVASCRIPT_PRETTIER=("${PRETTIER_COMMAND[@]}")
LINTER_COMMANDS_ARRAY_JAVASCRIPT_STANDARD=(standard "${JAVASCRIPT_STANDARD_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_JSCPD=(jscpd --config "${JSCPD_LINTER_RULES}")
JSCPD_GITIGNORE_OPTION="--gitignore"
@ -79,8 +85,10 @@ if [[ "${IGNORE_GITIGNORED_FILES}" == "true" ]]; then
LINTER_COMMANDS_ARRAY_JSCPD+=("${JSCPD_GITIGNORE_OPTION}")
fi
LINTER_COMMANDS_ARRAY_JSON=(eslint -c "${JAVASCRIPT_ES_LINTER_RULES}" --ext '.json')
LINTER_COMMANDS_ARRAY_JSON_PRETTIER=("${PRETTIER_COMMAND[@]}")
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_JSX_PRETTIER=("${PRETTIER_COMMAND[@]}")
LINTER_COMMANDS_ARRAY_KOTLIN=(ktlint "{/}")
LINTER_COMMANDS_ARRAY_KUBERNETES_KUBECONFORM=(kubeconform -strict)
if [ "${KUBERNETES_KUBECONFORM_OPTIONS}" != "null" ] && [ -n "${KUBERNETES_KUBECONFORM_OPTIONS}" ]; then
@ -100,6 +108,7 @@ if [ -n "${MARKDOWN_CUSTOM_RULE_GLOBS}" ]; then
fi
done
fi
LINTER_COMMANDS_ARRAY_MARKDOWN_PRETTIER=("${PRETTIER_COMMAND[@]}")
LINTER_COMMANDS_ARRAY_NATURAL_LANGUAGE=(textlint -c "${NATURAL_LANGUAGE_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_OPENAPI=(spectral lint -r "${OPENAPI_LINTER_RULES}" -D)
LINTER_COMMANDS_ARRAY_PERL=(perlcritic)
@ -140,13 +149,15 @@ LINTER_COMMANDS_ARRAY_TERRAFORM_TERRASCAN=(terrascan scan -i terraform -t all -c
LINTER_COMMANDS_ARRAY_TERRAGRUNT=(terragrunt hclfmt --terragrunt-check --terragrunt-log-level error --terragrunt-hclfmt-file)
LINTER_COMMANDS_ARRAY_TSX=(eslint -c "${TSX_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_TYPESCRIPT_ES=(eslint -c "${TYPESCRIPT_ES_LINTER_RULES}")
LINTER_COMMANDS_ARRAY_TYPESCRIPT_PRETTIER=(prettier)
LINTER_COMMANDS_ARRAY_TYPESCRIPT_PRETTIER=("${PRETTIER_COMMAND[@]}")
LINTER_COMMANDS_ARRAY_TYPESCRIPT_STANDARD=(ts-standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin --project "${TYPESCRIPT_STANDARD_TSCONFIG_FILE}")
LINTER_COMMANDS_ARRAY_VUE_PRETTIER=("${PRETTIER_COMMAND[@]}")
LINTER_COMMANDS_ARRAY_XML=(xmllint)
LINTER_COMMANDS_ARRAY_YAML=(yamllint -c "${YAML_LINTER_RULES}" -f parsable)
if [ "${YAML_ERROR_ON_WARNING}" == 'true' ]; then
LINTER_COMMANDS_ARRAY_YAML+=(--strict)
fi
LINTER_COMMANDS_ARRAY_YAML_PRETTIER=("${PRETTIER_COMMAND[@]}")
function InitFixModeOptionsAndCommands() {
local LANGUAGE="${1}"

View file

@ -2,11 +2,24 @@
# shellcheck disable=SC2034
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CHECKOV' 'CLANG_FORMAT'
'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT' 'CPP' 'CSHARP' 'CSS' 'DART'
'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GITHUB_ACTIONS'
'GITLEAKS' 'GHERKIN' 'GO' 'GO_MODULES' 'GO_RELEASER' 'GOOGLE_JAVA_FORMAT' 'GROOVY' 'HTML' 'JAVA'
'JAVASCRIPT_ES' 'JAVASCRIPT_PRETTIER' 'JAVASCRIPT_STANDARD' 'JSCPD' 'JSON' 'JSONC' 'JSX'
'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT' 'CPP' 'CSHARP'
'CSS'
"CSS_PRETTIER"
'DART'
'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV'
'GITHUB_ACTIONS'
'GITLEAKS' 'GHERKIN' 'GO' 'GO_MODULES' 'GO_RELEASER' 'GOOGLE_JAVA_FORMAT'
"GRAPHQL_PRETTIER"
'GROOVY'
'HTML'
"HTML_PRETTIER"
'JAVA'
'JAVASCRIPT_ES' 'JAVASCRIPT_PRETTIER' 'JAVASCRIPT_STANDARD' 'JSCPD' 'JSON'
"JSON_PRETTIER"
'JSONC' 'JSX'
"JSX_PRETTIER"
'KUBERNETES_KUBECONFORM' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN'
"MARKDOWN_PRETTIER"
'NATURAL_LANGUAGE' 'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN'
'PHP_PSALM' 'POWERSHELL' 'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT'
'PYTHON_FLAKE8' 'PYTHON_ISORT' 'PYTHON_MYPY' 'PYTHON_RUFF'
@ -14,6 +27,10 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CHECKOV' 'CLANG_FORMAT'
'RUST_2018' 'RUST_2021' 'RUST_CLIPPY' 'SCALAFMT' 'SHELL_SHFMT'
'SNAKEMAKE_LINT' 'SNAKEMAKE_SNAKEFMT' 'STATES' 'SQLFLUFF' 'TEKTON'
'TERRAFORM_FMT' 'TERRAFORM_TFLINT' 'TERRAFORM_TERRASCAN' 'TERRAGRUNT' 'TSX'
'TYPESCRIPT_ES' 'TYPESCRIPT_PRETTIER' 'TYPESCRIPT_STANDARD' 'XML' 'YAML')
'TYPESCRIPT_ES' 'TYPESCRIPT_PRETTIER' 'TYPESCRIPT_STANDARD'
"VUE_PRETTIER"
'XML' 'YAML'
"YAML_PRETTIER"
)
LANGUAGE_ARRAY_FOR_LINTER_RULES=("${LANGUAGE_ARRAY[@]}" "TYPESCRIPT_STANDARD_TSCONFIG")

View file

@ -12,8 +12,14 @@ RUSTFMT_CHECK_ONLY_MODE_OPTIONS=(--check)
# need to define a "check only" mode option for those.
CLANG_FORMAT_CHECK_ONLY_MODE_OPTIONS=(--dry-run)
CSHARP_CHECK_ONLY_MODE_OPTIONS=(--verify-no-changes)
CSS_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
GOOGLE_JAVA_FORMAT_CHECK_ONLY_MODE_OPTIONS=(--dry-run --set-exit-if-changed)
GRAPHQL_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
HTML_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
JAVASCRIPT_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
JSON_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
JSX_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
MARKDOWN_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
PYTHON_BLACK_CHECK_ONLY_MODE_OPTIONS=(--diff --check)
PYTHON_ISORT_CHECK_ONLY_MODE_OPTIONS=(--diff --check)
RUST_2015_CHECK_ONLY_MODE_OPTIONS=("${RUSTFMT_CHECK_ONLY_MODE_OPTIONS[@]}")
@ -25,6 +31,8 @@ SNAKEMAKE_SNAKEFMT_CHECK_ONLY_MODE_OPTIONS=(--check --compact-diff)
SQLFLUFF_CHECK_ONLY_MODE_OPTIONS=(lint)
TERRAFORM_FMT_CHECK_ONLY_MODE_OPTIONS=(-check -diff)
TYPESCRIPT_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
VUE_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
YAML_PRETTIER_CHECK_ONLY_MODE_OPTIONS=("${PRETTIER_CHECK_ONLY_MODE_OPTIONS[@]}")
# Fix mode options for linters that that we reuse across several languages
ESLINT_FIX_MODE_OPTIONS=(--fix)
@ -37,18 +45,24 @@ STANDARD_FIX_MODE_OPTIONS=(--fix)
ANSIBLE_FIX_MODE_OPTIONS=(--fix)
CLANG_FORMAT_FIX_MODE_OPTIONS=(-i)
CSS_FIX_MODE_OPTIONS=(--fix)
CSS_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
ENV_FIX_MODE_OPTIONS=(fix --no-backup)
GO_FIX_MODE_OPTIONS=("${GOLANGCI_LINT_FIX_MODE_OPTIONS[@]}")
GO_MODULES_FIX_MODE_OPTIONS=("${GOLANGCI_LINT_FIX_MODE_OPTIONS[@]}")
GOOGLE_JAVA_FORMAT_FIX_MODE_OPTIONS=(--replace)
GRAPHQL_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
GROOVY_FIX_MODE_OPTIONS=(--fix)
HTML_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
JAVASCRIPT_ES_FIX_MODE_OPTIONS=("${ESLINT_FIX_MODE_OPTIONS[@]}")
JAVASCRIPT_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
JAVASCRIPT_STANDARD_FIX_MODE_OPTIONS=("${STANDARD_FIX_MODE_OPTIONS[@]}")
JSON_FIX_MODE_OPTIONS=("${ESLINT_FIX_MODE_OPTIONS[@]}")
JSON_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
JSONC_FIX_MODE_OPTIONS=("${ESLINT_FIX_MODE_OPTIONS[@]}")
JSX_FIX_MODE_OPTIONS=("${ESLINT_FIX_MODE_OPTIONS[@]}")
JSX_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
MARKDOWN_FIX_MODE_OPTIONS=(--fix)
MARKDOWN_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
NATURAL_LANGUAGE_FIX_MODE_OPTIONS=(--fix)
POWERSHELL_FIX_MODE_OPTIONS=(-Fix)
PROTOBUF_FIX_MODE_OPTIONS=(-fix)
@ -62,6 +76,8 @@ TSX_FIX_MODE_OPTIONS=("${ESLINT_FIX_MODE_OPTIONS[@]}")
TYPESCRIPT_ES_FIX_MODE_OPTIONS=("${ESLINT_FIX_MODE_OPTIONS[@]}")
TYPESCRIPT_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
TYPESCRIPT_STANDARD_FIX_MODE_OPTIONS=("${STANDARD_FIX_MODE_OPTIONS[@]}")
VUE_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
YAML_PRETTIER_FIX_MODE_OPTIONS=("${PRETTIER_FIX_MODE_OPTIONS[@]}")
# sqlfluff is a special case because it needs a different subcommand and
# subcommand options

View file

@ -13,6 +13,7 @@
| COFFEESCRIPT | Fail ❌ |
| CPP | Fail ❌ |
| CSS | Fail ❌ |
| CSS_PRETTIER | Fail ❌ |
| DART | Fail ❌ |
| DOCKERFILE_HADOLINT | Fail ❌ |
| EDITORCONFIG | Fail ❌ |
@ -24,21 +25,26 @@
| GO_MODULES | Fail ❌ |
| GO_RELEASER | Fail ❌ |
| GOOGLE_JAVA_FORMAT | Fail ❌ |
| GRAPHQL_PRETTIER | Fail ❌ |
| GROOVY | Fail ❌ |
| HTML | Fail ❌ |
| HTML_PRETTIER | Fail ❌ |
| JAVA | Fail ❌ |
| JAVASCRIPT_ES | Fail ❌ |
| JAVASCRIPT_PRETTIER | Fail ❌ |
| JAVASCRIPT_STANDARD | Fail ❌ |
| JSCPD | Fail ❌ |
| JSON | Fail ❌ |
| JSON_PRETTIER | Fail ❌ |
| JSONC | Fail ❌ |
| JSX | Fail ❌ |
| JSX_PRETTIER | Fail ❌ |
| KUBERNETES_KUBECONFORM | Fail ❌ |
| KOTLIN | Fail ❌ |
| LATEX | Fail ❌ |
| LUA | Fail ❌ |
| MARKDOWN | Fail ❌ |
| MARKDOWN_PRETTIER | Fail ❌ |
| NATURAL_LANGUAGE | Fail ❌ |
| OPENAPI | Fail ❌ |
| PERL | Fail ❌ |
@ -72,8 +78,10 @@
| TYPESCRIPT_ES | Fail ❌ |
| TYPESCRIPT_PRETTIER | Fail ❌ |
| TYPESCRIPT_STANDARD | Fail ❌ |
| VUE_PRETTIER | Fail ❌ |
| XML | Fail ❌ |
| YAML | Fail ❌ |
| YAML_PRETTIER | Fail ❌ |
<!-- textlint-enable terminology -->
Super-linter detected linting errors

View file

@ -15,6 +15,7 @@
| CPP | Fail ❌ |
| CSHARP | Fail ❌ |
| CSS | Fail ❌ |
| CSS_PRETTIER | Fail ❌ |
| DART | Fail ❌ |
| DOCKERFILE_HADOLINT | Fail ❌ |
| EDITORCONFIG | Fail ❌ |
@ -26,21 +27,26 @@
| GO_MODULES | Fail ❌ |
| GO_RELEASER | Fail ❌ |
| GOOGLE_JAVA_FORMAT | Fail ❌ |
| GRAPHQL_PRETTIER | Fail ❌ |
| GROOVY | Fail ❌ |
| HTML | Fail ❌ |
| HTML_PRETTIER | Fail ❌ |
| JAVA | Fail ❌ |
| JAVASCRIPT_ES | Fail ❌ |
| JAVASCRIPT_PRETTIER | Fail ❌ |
| JAVASCRIPT_STANDARD | Fail ❌ |
| JSCPD | Fail ❌ |
| JSON | Fail ❌ |
| JSON_PRETTIER | Fail ❌ |
| JSONC | Fail ❌ |
| JSX | Fail ❌ |
| JSX_PRETTIER | Fail ❌ |
| KUBERNETES_KUBECONFORM | Fail ❌ |
| KOTLIN | Fail ❌ |
| LATEX | Fail ❌ |
| LUA | Fail ❌ |
| MARKDOWN | Fail ❌ |
| MARKDOWN_PRETTIER | Fail ❌ |
| NATURAL_LANGUAGE | Fail ❌ |
| OPENAPI | Fail ❌ |
| PERL | Fail ❌ |
@ -79,8 +85,10 @@
| TYPESCRIPT_ES | Fail ❌ |
| TYPESCRIPT_PRETTIER | Fail ❌ |
| TYPESCRIPT_STANDARD | Fail ❌ |
| VUE_PRETTIER | Fail ❌ |
| XML | Fail ❌ |
| YAML | Fail ❌ |
| YAML_PRETTIER | Fail ❌ |
<!-- textlint-enable terminology -->
Super-linter detected linting errors

View file

@ -13,6 +13,7 @@
| COFFEESCRIPT | Pass ✅ |
| CPP | Pass ✅ |
| CSS | Pass ✅ |
| CSS_PRETTIER | Pass ✅ |
| DART | Pass ✅ |
| DOCKERFILE_HADOLINT | Pass ✅ |
| EDITORCONFIG | Pass ✅ |
@ -24,21 +25,26 @@
| GO_MODULES | Pass ✅ |
| GO_RELEASER | Pass ✅ |
| GOOGLE_JAVA_FORMAT | Pass ✅ |
| GRAPHQL_PRETTIER | Pass ✅ |
| GROOVY | Pass ✅ |
| HTML | Pass ✅ |
| HTML_PRETTIER | Pass ✅ |
| JAVA | Pass ✅ |
| JAVASCRIPT_ES | Pass ✅ |
| JAVASCRIPT_PRETTIER | Pass ✅ |
| JAVASCRIPT_STANDARD | Pass ✅ |
| JSCPD | Pass ✅ |
| JSON | Pass ✅ |
| JSON_PRETTIER | Pass ✅ |
| JSONC | Pass ✅ |
| JSX | Pass ✅ |
| JSX_PRETTIER | Pass ✅ |
| KUBERNETES_KUBECONFORM | Pass ✅ |
| KOTLIN | Pass ✅ |
| LATEX | Pass ✅ |
| LUA | Pass ✅ |
| MARKDOWN | Pass ✅ |
| MARKDOWN_PRETTIER | Pass ✅ |
| NATURAL_LANGUAGE | Pass ✅ |
| OPENAPI | Pass ✅ |
| PERL | Pass ✅ |
@ -72,8 +78,10 @@
| TYPESCRIPT_ES | Pass ✅ |
| TYPESCRIPT_PRETTIER | Pass ✅ |
| TYPESCRIPT_STANDARD | Pass ✅ |
| VUE_PRETTIER | Pass ✅ |
| XML | Pass ✅ |
| YAML | Pass ✅ |
| YAML_PRETTIER | Pass ✅ |
<!-- textlint-enable terminology -->
All files and directories linted successfully

View file

@ -15,6 +15,7 @@
| CPP | Pass ✅ |
| CSHARP | Pass ✅ |
| CSS | Pass ✅ |
| CSS_PRETTIER | Pass ✅ |
| DART | Pass ✅ |
| DOCKERFILE_HADOLINT | Pass ✅ |
| EDITORCONFIG | Pass ✅ |
@ -26,21 +27,26 @@
| GO_MODULES | Pass ✅ |
| GO_RELEASER | Pass ✅ |
| GOOGLE_JAVA_FORMAT | Pass ✅ |
| GRAPHQL_PRETTIER | Pass ✅ |
| GROOVY | Pass ✅ |
| HTML | Pass ✅ |
| HTML_PRETTIER | Pass ✅ |
| JAVA | Pass ✅ |
| JAVASCRIPT_ES | Pass ✅ |
| JAVASCRIPT_PRETTIER | Pass ✅ |
| JAVASCRIPT_STANDARD | Pass ✅ |
| JSCPD | Pass ✅ |
| JSON | Pass ✅ |
| JSON_PRETTIER | Pass ✅ |
| JSONC | Pass ✅ |
| JSX | Pass ✅ |
| JSX_PRETTIER | Pass ✅ |
| KUBERNETES_KUBECONFORM | Pass ✅ |
| KOTLIN | Pass ✅ |
| LATEX | Pass ✅ |
| LUA | Pass ✅ |
| MARKDOWN | Pass ✅ |
| MARKDOWN_PRETTIER | Pass ✅ |
| NATURAL_LANGUAGE | Pass ✅ |
| OPENAPI | Pass ✅ |
| PERL | Pass ✅ |
@ -79,8 +85,10 @@
| TYPESCRIPT_ES | Pass ✅ |
| TYPESCRIPT_PRETTIER | Pass ✅ |
| TYPESCRIPT_STANDARD | Pass ✅ |
| VUE_PRETTIER | Pass ✅ |
| XML | Pass ✅ |
| YAML | Pass ✅ |
| YAML_PRETTIER | Pass ✅ |
<!-- textlint-enable terminology -->
All files and directories linted successfully

View file

@ -4,12 +4,8 @@ set -o errexit
set -o nounset
set -o pipefail
# Default log level
# shellcheck disable=SC2034
LOG_LEVEL="DEBUG"
# shellcheck source=/dev/null
source "lib/functions/log.sh"
source "test/testUtils.sh"
# shellcheck source=/dev/null
source "lib/globals/languages.sh"
@ -28,4 +24,27 @@ function LanguageArrayNotEmptyTest() {
notice "${FUNCTION_NAME} PASS"
}
function LanguageTestPresenceTest() {
local FUNCTION_NAME
FUNCTION_NAME="${FUNCNAME[0]}"
info "${FUNCTION_NAME} start"
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
local -l LOWERCASE_LANGUAGE="${LANGUAGE}"
# shellcheck disable=SC2153
local LINTER_TEST_CASE_DIRECTORY="${LINTERS_TEST_CASE_DIRECTORY}/${LOWERCASE_LANGUAGE}"
if [[ ! -d "${LINTER_TEST_CASE_DIRECTORY}" ]]; then
fatal "Test case directory for ${LANGUAGE} (${LINTER_TEST_CASE_DIRECTORY}) doesn't exist or is not readable."
fi
if [ -z "$(ls -A "${LINTER_TEST_CASE_DIRECTORY}")" ]; then
fatal "Test case directory for ${LANGUAGE} (${LINTER_TEST_CASE_DIRECTORY}) is empty, and it should contain test cases for ${LANGUAGE}."
fi
done
notice "${FUNCTION_NAME} PASS"
}
LanguageArrayNotEmptyTest
LanguageTestPresenceTest

View file

@ -0,0 +1,22 @@
/**
* Multi-line comment
*/
.selector-1,
.selector-2,
.selector-3[type="text"] {
background: linear-gradient(#fff, rgb(0 0 0 / 80%));
box-sizing: border-box;
display: block;
color: #333;
}
.selector-a,
.selector-b:not(:first-child) {
padding: 10px !important;
top: calc(calc(1em * 2) / 3);
}
.selector-x { width: 10%; }
.selector-y { width: 20%; }
.selector-z { width: 30%; }

View file

@ -0,0 +1,30 @@
/**
* Multi-line comment
*/
.selector-1,
.selector-2,
.selector-3[type="text"] {
background: linear-gradient(#fff, rgb(0 0 0 / 80%));
box-sizing: border-box;
display: block;
color: #333;
}
.selector-a,
.selector-b:not(:first-child) {
padding: 10px !important;
top: calc(calc(1em * 2) / 3);
}
.selector-x {
width: 10%;
}
.selector-y {
width: 20%;
}
.selector-z {
width: 30%;
}

View file

@ -0,0 +1,3 @@
type Project {name: String
tagline: String
contributors: [User]}

View file

@ -0,0 +1,5 @@
type Project {
name: String
tagline: String
contributors: [User]
}

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
Good HTML!
</body>
</html>

View file

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
Good HTML!
</body>
</html>

View file

@ -0,0 +1,13 @@
{
"arrow_spacing": {
"level": [
"ignore"
]
},
"foo": "bar",
"braces_spacing": {
"level": "ignore",
"spaces": 0,
"empty_object_spaces": 0
}
}

View file

@ -0,0 +1,10 @@
{
"arrow_spacing": {
"level": "ignore"
},
"braces_spacing": {
"level": "ignore",
"spaces": 0,
"empty_object_spaces": 0
}
}

View file

@ -0,0 +1,4 @@
import React from 'react';
const element = <h1>Hello, world!</h1>;
console.log(element)

View file

@ -0,0 +1,4 @@
import React from "react";
const element = <h1>Hello, world!</h1>;
console.log(element);

View file

@ -0,0 +1,20 @@
# Good Markdown
This is just standard good markdown.
## Second level header
This header follows the step down from `level 1`.
- Here it *is*
- Some more **indention**
- why so much?
```bash
ls -la
```
### Walk away
We're all done **here**.
- [Link Action](https://github.com)

View file

@ -0,0 +1,21 @@
# Good Markdown
This is just standard good markdown.
## Second level header
This header follows the step down from `level 1`.
- Here it _is_
- Some more **indention**
- why so much?
```bash
ls -la
```
### Walk away
We're all done **here**.
- [Link Action](https://github.com)

View file

@ -0,0 +1,23 @@
<template>
<div class="example">{{ msg }}</div>
</template>
<script>
export default {
data() {
return {
msg: 'Hello world!'
}
}
}
</script>
<style>
.example {
color: red;
}
</style>
<custom1>
This could be e.g. documentation for the component.
</custom1>

View file

@ -0,0 +1,23 @@
<template>
<div class="example">{{ msg }}</div>
</template>
<script>
export default {
data() {
return {
msg: "Hello world!",
};
},
};
</script>
<style>
.example {
color: red;
}
</style>
<custom1>
This could be e.g. documentation for the component.
</custom1>

View file

@ -0,0 +1,19 @@
---
#####################
#####################
## Heres some vars ##
#####################
#####################
############
# Env Vars #
############
env:
browser: true
es6: true
jest: true
Here: there
something: "For Nothing"

View file

@ -0,0 +1,19 @@
---
#####################
#####################
## Heres some vars ##
#####################
#####################
############
# Env Vars #
############
env:
browser: true
es6: true
jest: true
Here: there
something: "For Nothing"

View file

@ -0,0 +1,18 @@
---
#####################
#####################
## Heres some vars ##
#####################
#####################
############
# Env Vars #
############
env:
browser: true
es6: true
jest: true
Here: there
something: "For Nothing"

View file

@ -0,0 +1,18 @@
---
#####################
#####################
## Heres some vars ##
#####################
#####################
############
# Env Vars #
############
env:
browser: true
es6: true
jest: true
Here: there
something: "For Nothing"

View file

@ -22,18 +22,24 @@ LANGUAGES_WITH_FIX_MODE=(
"CLANG_FORMAT"
"CSHARP"
"CSS"
"CSS_PRETTIER"
"ENV"
"GO_MODULES"
"GO"
"GOOGLE_JAVA_FORMAT"
"GROOVY"
"GRAPHQL_PRETTIER"
"HTML_PRETTIER"
"JAVASCRIPT_ES"
"JAVASCRIPT_PRETTIER"
"JAVASCRIPT_STANDARD"
"JSON"
"JSON_PRETTIER"
"JSONC"
"JSX"
"JSX_PRETTIER"
"MARKDOWN"
"MARKDOWN_PRETTIER"
"NATURAL_LANGUAGE"
"POWERSHELL"
"PROTOBUF"
@ -54,6 +60,8 @@ LANGUAGES_WITH_FIX_MODE=(
"TYPESCRIPT_ES"
"TYPESCRIPT_PRETTIER"
"TYPESCRIPT_STANDARD"
"VUE_PRETTIER"
"YAML_PRETTIER"
)
# TODO: extract this list from linter.sh (see REMOVE_ARRAY) instead of