mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-29 04:01:02 -05:00
Add textlint (#2006)
* Add textlint * Add new final newline * Validate only markdown files * txt -> md
This commit is contained in:
parent
81422f3c47
commit
3472ac360c
10 changed files with 2816 additions and 45 deletions
20
.automation/test/natural_language/README.md
Normal file
20
.automation/test/natural_language/README.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Natural language Test Cases
|
||||||
|
|
||||||
|
This folder holds the test cases for **natural language**.
|
||||||
|
|
||||||
|
## Additional Docs
|
||||||
|
|
||||||
|
No Additional information is needed for this test case.
|
||||||
|
|
||||||
|
## Good Test Cases
|
||||||
|
|
||||||
|
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
|
||||||
|
|
||||||
|
- **Note:** They are linted utilizing the default linter rules.
|
||||||
|
|
||||||
|
## Bad Test Cases
|
||||||
|
|
||||||
|
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
|
||||||
|
|
||||||
|
- **Note:** They are linted utilizing the default linter rules.
|
||||||
|
{"mode":"full","isActive":false}
|
|
@ -0,0 +1 @@
|
||||||
|
https://eslint.org/docs/user-guide/configuring#configuration-file-formats
|
|
@ -0,0 +1 @@
|
||||||
|
https://eslint.org/docs/user-guide/configuring/#configuration-file-formats
|
6
.github/linters/.textlintrc
vendored
Normal file
6
.github/linters/.textlintrc
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"filters": {},
|
||||||
|
"rules": {
|
||||||
|
"no-dead-link": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -80,6 +80,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
|
||||||
| **LaTeX** | [ChkTex](https://www.nongnu.org/chktex/) |
|
| **LaTeX** | [ChkTex](https://www.nongnu.org/chktex/) |
|
||||||
| **Lua** | [luacheck](https://github.com/luarocks/luacheck) |
|
| **Lua** | [luacheck](https://github.com/luarocks/luacheck) |
|
||||||
| **Markdown** | [markdownlint](https://github.com/igorshubovych/markdownlint-cli#readme) |
|
| **Markdown** | [markdownlint](https://github.com/igorshubovych/markdownlint-cli#readme) |
|
||||||
|
| **Natural language** | [textlint](https://textlint.github.io/) |
|
||||||
| **OpenAPI** | [spectral](https://github.com/stoplightio/spectral) |
|
| **OpenAPI** | [spectral](https://github.com/stoplightio/spectral) |
|
||||||
| **Perl** | [perlcritic](https://metacpan.org/pod/Perl::Critic) |
|
| **Perl** | [perlcritic](https://metacpan.org/pod/Perl::Critic) |
|
||||||
| **PHP** | [PHP built-in linter](https://www.php.net/) / [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) / [PHPStan](https://phpstan.org/) / [Psalm](https://psalm.dev/) |
|
| **PHP** | [PHP built-in linter](https://www.php.net/) / [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) / [PHPStan](https://phpstan.org/) / [Psalm](https://psalm.dev/) |
|
||||||
|
@ -314,6 +315,7 @@ But if you wish to select or exclude specific linters, we give you full control
|
||||||
| **SQL_CONFIG_FILE** | `.sql-config.json` | Filename for [SQL-Lint configuration](https://sql-lint.readthedocs.io/en/latest/files/configuration.html) (ex: `sql-config.json` , `.config.json`) |
|
| **SQL_CONFIG_FILE** | `.sql-config.json` | Filename for [SQL-Lint configuration](https://sql-lint.readthedocs.io/en/latest/files/configuration.html) (ex: `sql-config.json` , `.config.json`) |
|
||||||
| **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`) |
|
||||||
|
| **TEXTLINT_CONFIG_FILE** | `.textlintrc` | Filename for [textlint configuration](https://textlint.github.io/docs/getting-started.html#configuration) (ex: `.textlintrc`) |
|
||||||
| **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. |
|
||||||
|
@ -351,6 +353,7 @@ But if you wish to select or exclude specific linters, we give you full control
|
||||||
| **VALIDATE_LATEX** | `true` | Flag to enable or disable the linting process of the LaTeX language. |
|
| **VALIDATE_LATEX** | `true` | Flag to enable or disable the linting process of the LaTeX language. |
|
||||||
| **VALIDATE_LUA** | `true` | Flag to enable or disable the linting process of the language. |
|
| **VALIDATE_LUA** | `true` | Flag to enable or disable the linting process of the language. |
|
||||||
| **VALIDATE_MARKDOWN** | `true` | Flag to enable or disable the linting process of the Markdown language. |
|
| **VALIDATE_MARKDOWN** | `true` | Flag to enable or disable the linting process of the Markdown language. |
|
||||||
|
| **VALIDATE_NATURAL_LANGUAGE** | `true` | Flag to enable or disable the linting process of the natural language. |
|
||||||
| **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the OpenAPI language. |
|
| **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the OpenAPI language. |
|
||||||
| **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the Perl language. |
|
| **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the Perl language. |
|
||||||
| **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the PHP language. (Utilizing: PHP built-in linter) (keep for backward compatibility) |
|
| **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the PHP language. (Utilizing: PHP built-in linter) (keep for backward compatibility) |
|
||||||
|
|
6
TEMPLATES/.textlintrc
Normal file
6
TEMPLATES/.textlintrc
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"filters": {},
|
||||||
|
"rules": {
|
||||||
|
"no-dead-link": true
|
||||||
|
}
|
||||||
|
}
|
2803
dependencies/package-lock.json
generated
vendored
2803
dependencies/package-lock.json
generated
vendored
File diff suppressed because it is too large
Load diff
2
dependencies/package.json
vendored
2
dependencies/package.json
vendored
|
@ -39,6 +39,8 @@
|
||||||
"stylelint-config-standard": "^22.0.0",
|
"stylelint-config-standard": "^22.0.0",
|
||||||
"stylelint-scss": "^3.21.0",
|
"stylelint-scss": "^3.21.0",
|
||||||
"tekton-lint": "^0.5.2",
|
"tekton-lint": "^0.5.2",
|
||||||
|
"textlint": "^12.0.2",
|
||||||
|
"textlint-rule-no-dead-link": "^4.7.0",
|
||||||
"typescript": "^4.4.3"
|
"typescript": "^4.4.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,6 +578,7 @@ function BuildFileList() {
|
||||||
# Append the file to the array #
|
# Append the file to the array #
|
||||||
################################
|
################################
|
||||||
FILE_ARRAY_MARKDOWN+=("${FILE}")
|
FILE_ARRAY_MARKDOWN+=("${FILE}")
|
||||||
|
FILE_ARRAY_TEXTLINT+=("${FILE}")
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# Get the PHP files #
|
# Get the PHP files #
|
||||||
|
|
|
@ -168,6 +168,8 @@ TERRAFORM_TFLINT_FILE_NAME="${TERRAFORM_TFLINT_CONFIG_FILE:-.tflint.hcl}"
|
||||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||||
TERRAFORM_TERRASCAN_FILE_NAME="${TERRAFORM_TERRASCAN_CONFIG_FILE:-terrascan.toml}"
|
TERRAFORM_TERRASCAN_FILE_NAME="${TERRAFORM_TERRASCAN_CONFIG_FILE:-terrascan.toml}"
|
||||||
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
# shellcheck disable=SC2034 # Variable is referenced indirectly
|
||||||
|
TEXTLINT_FILE_NAME="${TEXTLINT_CONFIG_FILE:-.textlintrc}"
|
||||||
|
# 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_ES_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
TYPESCRIPT_ES_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
|
||||||
|
@ -204,13 +206,13 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CLANG_FORMAT'
|
||||||
'DOCKERFILE' 'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GITHUB_ACTIONS'
|
'DOCKERFILE' 'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GITHUB_ACTIONS'
|
||||||
'GITLEAKS' 'GHERKIN' 'GO' 'GOOGLE_JAVA_FORMAT' 'GROOVY' 'HTML' 'JAVA'
|
'GITLEAKS' 'GHERKIN' 'GO' 'GOOGLE_JAVA_FORMAT' 'GROOVY' 'HTML' 'JAVA'
|
||||||
'JAVASCRIPT_ES' "${JAVASCRIPT_STYLE_NAME}" 'JSCPD' 'JSON' 'JSONC' 'JSX'
|
'JAVASCRIPT_ES' "${JAVASCRIPT_STYLE_NAME}" 'JSCPD' 'JSON' 'JSONC' 'JSX'
|
||||||
'KUBERNETES_KUBEVAL' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN' 'OPENAPI' 'PERL'
|
'KUBERNETES_KUBEVAL' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN' 'NATURAL_LANGUAGE'
|
||||||
'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN' 'PHP_PSALM' 'POWERSHELL' 'PROTOBUF'
|
'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN' 'PHP_PSALM'
|
||||||
'PYTHON_BLACK' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'PYTHON_ISORT' 'PYTHON_MYPY'
|
'POWERSHELL' 'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT' 'PYTHON_FLAKE8'
|
||||||
'R' 'RAKU' 'RUBY' 'RUST_2015' 'RUST_2018' 'RUST_CLIPPY' 'SHELL_SHFMT'
|
'PYTHON_ISORT' 'PYTHON_MYPY' 'R' 'RAKU' 'RUBY' 'RUST_2015' 'RUST_2018'
|
||||||
'SNAKEMAKE_LINT' 'SNAKEMAKE_SNAKEFMT' 'STATES' 'SQL' 'SQLFLUFF' 'TEKTON'
|
'RUST_CLIPPY' 'SHELL_SHFMT' 'SNAKEMAKE_LINT' 'SNAKEMAKE_SNAKEFMT' 'STATES'
|
||||||
'TERRAFORM_TFLINT' 'TERRAFORM_TERRASCAN' 'TERRAGRUNT' 'TSX' 'TYPESCRIPT_ES'
|
'SQL' 'SQLFLUFF' 'TEKTON' 'TERRAFORM_TFLINT' 'TERRAFORM_TERRASCAN' 'TERRAGRUNT'
|
||||||
'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Linter command names array #
|
# Linter command names array #
|
||||||
|
@ -251,6 +253,7 @@ LINTER_NAMES_ARRAY['KUBERNETES_KUBEVAL']="kubeval"
|
||||||
LINTER_NAMES_ARRAY['LATEX']="chktex"
|
LINTER_NAMES_ARRAY['LATEX']="chktex"
|
||||||
LINTER_NAMES_ARRAY['LUA']="lua"
|
LINTER_NAMES_ARRAY['LUA']="lua"
|
||||||
LINTER_NAMES_ARRAY['MARKDOWN']="markdownlint"
|
LINTER_NAMES_ARRAY['MARKDOWN']="markdownlint"
|
||||||
|
LINTER_NAMES_ARRAY['NATURAL_LANGUAGE']="textlint"
|
||||||
LINTER_NAMES_ARRAY['OPENAPI']="spectral"
|
LINTER_NAMES_ARRAY['OPENAPI']="spectral"
|
||||||
LINTER_NAMES_ARRAY['PERL']="perl"
|
LINTER_NAMES_ARRAY['PERL']="perl"
|
||||||
LINTER_NAMES_ARRAY['PHP_BUILTIN']="php"
|
LINTER_NAMES_ARRAY['PHP_BUILTIN']="php"
|
||||||
|
@ -868,6 +871,7 @@ if [ -n "${MARKDOWN_CUSTOM_RULE_GLOBS}" ]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
LINTER_COMMANDS_ARRAY['NATURAL_LANGUAGE']="textlint ${NATURAL_LANGUAGE_LINTER_RULES}"
|
||||||
LINTER_COMMANDS_ARRAY['OPENAPI']="spectral lint -r ${OPENAPI_LINTER_RULES}"
|
LINTER_COMMANDS_ARRAY['OPENAPI']="spectral lint -r ${OPENAPI_LINTER_RULES}"
|
||||||
LINTER_COMMANDS_ARRAY['PERL']="perlcritic"
|
LINTER_COMMANDS_ARRAY['PERL']="perlcritic"
|
||||||
LINTER_COMMANDS_ARRAY['PHP_BUILTIN']="php -l -c ${PHP_BUILTIN_LINTER_RULES}"
|
LINTER_COMMANDS_ARRAY['PHP_BUILTIN']="php -l -c ${PHP_BUILTIN_LINTER_RULES}"
|
||||||
|
|
Loading…
Reference in a new issue