mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-21 21:50:59 -05:00
feat: add support for biome
update: README fix update dependencies
This commit is contained in:
parent
e69f0364d2
commit
7ca0c6c93f
11 changed files with 626 additions and 3 deletions
1
.github/linters/.jscpd.json
vendored
1
.github/linters/.jscpd.json
vendored
|
@ -15,6 +15,7 @@
|
||||||
"**/test/linters/dotnet_sln_format_style",
|
"**/test/linters/dotnet_sln_format_style",
|
||||||
"**/test/linters/dotnet_sln_format_whitespace",
|
"**/test/linters/dotnet_sln_format_whitespace",
|
||||||
"**/test/linters/html",
|
"**/test/linters/html",
|
||||||
|
"**/test/linters/javascript_biome",
|
||||||
"**/test/linters/javascript_es",
|
"**/test/linters/javascript_es",
|
||||||
"**/test/linters/javascript_prettier",
|
"**/test/linters/javascript_prettier",
|
||||||
"**/test/linters/javascript_standard",
|
"**/test/linters/javascript_standard",
|
||||||
|
|
10
README.md
10
README.md
|
@ -81,7 +81,7 @@ Super-linter supports the following tools:
|
||||||
| **Helm charts** | [Checkov](https://www.checkov.io/) | See YAML formatters |
|
| **Helm charts** | [Checkov](https://www.checkov.io/) | See YAML formatters |
|
||||||
| **HTML** | [HTMLHint](https://github.com/htmlhint/HTMLHint) | [Prettier](https://prettier.io/) |
|
| **HTML** | [HTMLHint](https://github.com/htmlhint/HTMLHint) | [Prettier](https://prettier.io/) |
|
||||||
| **Java** | [checkstyle](https://checkstyle.org) | [google-java-format](https://github.com/google/google-java-format) |
|
| **Java** | [checkstyle](https://checkstyle.org) | [google-java-format](https://github.com/google/google-java-format) |
|
||||||
| **JavaScript** | [ESLint](https://eslint.org/), [standard js](https://standardjs.com/) | [Prettier](https://prettier.io/) |
|
| **JavaScript** | [ESLint](https://eslint.org/), [standard js](https://standardjs.com/), [Biome](https://biomejs.dev) | [Prettier](https://prettier.io/) |
|
||||||
| **JSON** | [eslint-plugin-jsonc (configured for JSON)](https://www.npmjs.com/package/eslint-plugin-jsonc) (default), [eslint-plugin-json](https://www.npmjs.com/package/eslint-plugin-json) | [Prettier](https://prettier.io/) |
|
| **JSON** | [eslint-plugin-jsonc (configured for JSON)](https://www.npmjs.com/package/eslint-plugin-jsonc) (default), [eslint-plugin-json](https://www.npmjs.com/package/eslint-plugin-json) | [Prettier](https://prettier.io/) |
|
||||||
| **JSONC**, **JSON5** | [eslint-plugin-jsonc](https://www.npmjs.com/package/eslint-plugin-jsonc) | [Prettier](https://prettier.io/) |
|
| **JSONC**, **JSON5** | [eslint-plugin-jsonc](https://www.npmjs.com/package/eslint-plugin-jsonc) | [Prettier](https://prettier.io/) |
|
||||||
| **JSX**, **TSX** | [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y), [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) | [Prettier](https://prettier.io/) |
|
| **JSX**, **TSX** | [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y), [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) | [Prettier](https://prettier.io/) |
|
||||||
|
@ -110,7 +110,7 @@ Super-linter supports the following tools:
|
||||||
| **Tekton** | [tekton-lint](https://github.com/IBM/tekton-lint) | See YAML formatters |
|
| **Tekton** | [tekton-lint](https://github.com/IBM/tekton-lint) | See YAML formatters |
|
||||||
| **Terraform** | [tflint](https://github.com/terraform-linters/tflint) , [terrascan](https://github.com/accurics/terrascan), [Checkov](https://www.checkov.io/) | [terraform fmt](https://developer.hashicorp.com/terraform/cli/commands/fmt) |
|
| **Terraform** | [tflint](https://github.com/terraform-linters/tflint) , [terrascan](https://github.com/accurics/terrascan), [Checkov](https://www.checkov.io/) | [terraform fmt](https://developer.hashicorp.com/terraform/cli/commands/fmt) |
|
||||||
| **Terragrunt** | [terragrunt](https://github.com/gruntwork-io/terragrunt) | N/A |
|
| **Terragrunt** | [terragrunt](https://github.com/gruntwork-io/terragrunt) | N/A |
|
||||||
| **TypeScript** | [ESLint](https://eslint.org/), [standard js](https://standardjs.com/) | [Prettier](https://prettier.io/) |
|
| **TypeScript** | [ESLint](https://eslint.org/), [standard js](https://standardjs.com/), [Biome](https://biomejs.dev) | [Prettier](https://prettier.io/) |
|
||||||
| **Vue** | | [Prettier](https://prettier.io/) |
|
| **Vue** | | [Prettier](https://prettier.io/) |
|
||||||
| **XML** | [LibXML](http://xmlsoft.org/) | |
|
| **XML** | [LibXML](http://xmlsoft.org/) | |
|
||||||
| **YAML** | [YamlLint](https://github.com/adrienverge/yamllint) | [Prettier](https://prettier.io/) |
|
| **YAML** | [YamlLint](https://github.com/adrienverge/yamllint) | [Prettier](https://prettier.io/) |
|
||||||
|
@ -240,6 +240,7 @@ You can configure Super-linter using the following environment variables:
|
||||||
| **FIX_GRAPHQL_PRETTIER** | `true` | Flag to enable or disable the formatting of GraphQL files with Prettier. |
|
| **FIX_GRAPHQL_PRETTIER** | `true` | Flag to enable or disable the formatting of GraphQL files with Prettier. |
|
||||||
| **FIX_GROOVY** | `false` | Option to enable fix mode for `GROOVY`. |
|
| **FIX_GROOVY** | `false` | Option to enable fix mode for `GROOVY`. |
|
||||||
| **FIX_HTML_PRETTIER** | `true` | Flag to enable or disable the formatting of HTML files with Prettier. |
|
| **FIX_HTML_PRETTIER** | `true` | Flag to enable or disable the formatting of HTML files with Prettier. |
|
||||||
|
| **FIX_JAVASCRIPT_BIOME** | `false` | Option to enable fix mode for `JAVASCRIPT_BIOME`. |
|
||||||
| **FIX_JAVASCRIPT_ES** | `false` | Option to enable fix mode for `JAVASCRIPT_ES`. |
|
| **FIX_JAVASCRIPT_ES** | `false` | Option to enable fix mode for `JAVASCRIPT_ES`. |
|
||||||
| **FIX_JAVASCRIPT_PRETTIER** | `false` | Flag to enable or disable the formatting of JavaScript files with Prettier. |
|
| **FIX_JAVASCRIPT_PRETTIER** | `false` | Flag to enable or disable the formatting of JavaScript files with Prettier. |
|
||||||
| **FIX_JAVASCRIPT_STANDARD** | `false` | Option to enable fix mode for `JAVASCRIPT_STANDARD`. |
|
| **FIX_JAVASCRIPT_STANDARD** | `false` | Option to enable fix mode for `JAVASCRIPT_STANDARD`. |
|
||||||
|
@ -268,6 +269,7 @@ You can configure Super-linter using the following environment variables:
|
||||||
| **FIX_SQLFLUFF** | `false` | Option to enable fix mode for `SQLFLUFF`. |
|
| **FIX_SQLFLUFF** | `false` | Option to enable fix mode for `SQLFLUFF`. |
|
||||||
| **FIX_TERRAFORM_FMT** | `false` | Option to enable fix mode for `TERRAFORM_FMT`. |
|
| **FIX_TERRAFORM_FMT** | `false` | Option to enable fix mode for `TERRAFORM_FMT`. |
|
||||||
| **FIX_TSX** | `false` | Option to enable fix mode for `TSX`. |
|
| **FIX_TSX** | `false` | Option to enable fix mode for `TSX`. |
|
||||||
|
| **FIX_TYPESCRIPT_BIOME** | `false` | Option to enable fix mode for `TYPESCRIPT_BIOME`. |
|
||||||
| **FIX_TYPESCRIPT_ES** | `false` | Option to enable fix mode for `TYPESCRIPT_ES`. |
|
| **FIX_TYPESCRIPT_ES** | `false` | Option to enable fix mode for `TYPESCRIPT_ES`. |
|
||||||
| **FIX_TYPESCRIPT_PRETTIER** | `false` | Flag to enable or disable the formatting of TypeScript files with Prettier. |
|
| **FIX_TYPESCRIPT_PRETTIER** | `false` | Flag to enable or disable the formatting of TypeScript files with Prettier. |
|
||||||
| **FIX_TYPESCRIPT_STANDARD** | `false` | Option to enable fix mode for `TYPESCRIPT_STANDARD`. |
|
| **FIX_TYPESCRIPT_STANDARD** | `false` | Option to enable fix mode for `TYPESCRIPT_STANDARD`. |
|
||||||
|
@ -283,6 +285,7 @@ You can configure Super-linter using the following environment variables:
|
||||||
| **IGNORE_GENERATED_FILES** | `false` | If set to `true`, super-linter will ignore all the files with `@generated` marker but without `@not-generated` marker. Jscpd and Checkov ignore this variable. Use their include and ignore features to select or ignore the files to lint. |
|
| **IGNORE_GENERATED_FILES** | `false` | If set to `true`, super-linter will ignore all the files with `@generated` marker but without `@not-generated` marker. Jscpd and Checkov ignore this variable. Use their include and ignore features to select or ignore the files to lint. |
|
||||||
| **IGNORE_GITIGNORED_FILES** | `false` | If set to `true`, super-linter will ignore all the files that are ignored by Git. Checkov ignores this variable. Use its include and ignore features to select or ignore the files to lint. |
|
| **IGNORE_GITIGNORED_FILES** | `false` | If set to `true`, super-linter will ignore all the files that are ignored by Git. Checkov ignores this variable. Use its include and ignore features to select or ignore the files to lint. |
|
||||||
| **JAVA_FILE_NAME** | `sun_checks.xml` | Filename for [Checkstyle configuration](https://checkstyle.sourceforge.io/config.html). Checkstyle embeds several configuration files, such as `sun_checks.xml`, `google_checks.xml` that you can use without providing your own configuration file. |
|
| **JAVA_FILE_NAME** | `sun_checks.xml` | Filename for [Checkstyle configuration](https://checkstyle.sourceforge.io/config.html). Checkstyle embeds several configuration files, such as `sun_checks.xml`, `google_checks.xml` that you can use without providing your own configuration file. |
|
||||||
|
| **JAVASCRIPT_BIOME_CONFIG_FILE** | `biome.json` | Filename for [Biome configuration](https://biomejs.dev/guides/configure-biome/) (ex: `biome.json`) |
|
||||||
| **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [ESLint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`) |
|
| **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [ESLint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`) |
|
||||||
| **JSCPD_CONFIG_FILE** | `.jscpd.json` | Filename for JSCPD configuration |
|
| **JSCPD_CONFIG_FILE** | `.jscpd.json` | Filename for JSCPD configuration |
|
||||||
| **KUBERNETES_KUBECONFORM_OPTIONS** | `null` | Additional arguments to pass to the command-line when running **Kubernetes Kubeconform** (Example: --ignore-missing-schemas) |
|
| **KUBERNETES_KUBECONFORM_OPTIONS** | `null` | Additional arguments to pass to the command-line when running **Kubernetes Kubeconform** (Example: --ignore-missing-schemas) |
|
||||||
|
@ -325,6 +328,7 @@ You can configure Super-linter using the following environment variables:
|
||||||
| **SUPPRESS_POSSUM** | `false` | If set to `true`, will hide the ASCII possum at top of log output. Default is `false` |
|
| **SUPPRESS_POSSUM** | `false` | If set to `true`, will hide the ASCII possum at top of log output. Default is `false` |
|
||||||
| **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`) |
|
||||||
| **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`) |
|
||||||
|
| **TYPESCRIPT_BIOME_CONFIG_FILE** | `biome.json` | Filename for [Biome configuration](https://biomejs.dev/guides/configure-biome/) (ex: `biome.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`) |
|
| **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** | `${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` |
|
| **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 |
|
| **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 |
|
||||||
|
@ -363,6 +367,7 @@ You can configure Super-linter using the following environment variables:
|
||||||
| **VALIDATE_HTML** | `true` | Flag to enable or disable the linting process of the HTML language. |
|
| **VALIDATE_HTML** | `true` | Flag to enable or disable the linting process of the HTML language. |
|
||||||
| **VALIDATE_HTML_PRETTIER** | `true` | Flag to enable or disable checking the formatting of HTML files with Prettier. |
|
| **VALIDATE_HTML_PRETTIER** | `true` | Flag to enable or disable checking the formatting of HTML files with Prettier. |
|
||||||
| **VALIDATE_JAVA** | `true` | Flag to enable or disable the linting process of the Java language. (Utilizing: checkstyle) |
|
| **VALIDATE_JAVA** | `true` | Flag to enable or disable the linting process of the Java language. (Utilizing: checkstyle) |
|
||||||
|
| **VALIDATE_JAVASCRIPT_BIOME** | `true` | Flag to enable or disable the linting process of the JavaScript language. (Utilizing: Biome) |
|
||||||
| **VALIDATE_JAVASCRIPT_ES** | `true` | Flag to enable or disable the linting process of the JavaScript language. (Utilizing: ESLint) |
|
| **VALIDATE_JAVASCRIPT_ES** | `true` | Flag to enable or disable the linting process of the JavaScript language. (Utilizing: ESLint) |
|
||||||
| **VALIDATE_JAVASCRIPT_PRETTIER** | `true` | Flag to enable or disable checking the formatting of JavaScript files with Prettier. |
|
| **VALIDATE_JAVASCRIPT_PRETTIER** | `true` | Flag to enable or disable checking the formatting of JavaScript files with Prettier. |
|
||||||
| **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the JavaScript language. (Utilizing: standard) |
|
| **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the JavaScript language. (Utilizing: standard) |
|
||||||
|
@ -417,6 +422,7 @@ You can configure Super-linter using the following environment variables:
|
||||||
| **VALIDATE_TERRAFORM_TFLINT** | `true` | Flag to enable or disable the linting process of the Terraform language. (Utilizing tflint) |
|
| **VALIDATE_TERRAFORM_TFLINT** | `true` | Flag to enable or disable the linting process of the Terraform language. (Utilizing tflint) |
|
||||||
| **VALIDATE_TERRAGRUNT** | `true` | Flag to enable or disable the linting process for Terragrunt files. |
|
| **VALIDATE_TERRAGRUNT** | `true` | Flag to enable or disable the linting process for Terragrunt files. |
|
||||||
| **VALIDATE_TSX** | `true` | Flag to enable or disable the linting process for tsx files (Utilizing: ESLint) |
|
| **VALIDATE_TSX** | `true` | Flag to enable or disable the linting process for tsx files (Utilizing: ESLint) |
|
||||||
|
| **VALIDATE_TYPESCRIPT_BIOME** | `true` | Flag to enable or disable the linting process of the TypeScript language. (Utilizing: Biome) |
|
||||||
| **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the TypeScript language. (Utilizing: ESLint) |
|
| **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the TypeScript language. (Utilizing: ESLint) |
|
||||||
| **VALIDATE_TYPESCRIPT_PRETTIER** | `true` | Flag to enable or disable checking the formatting of TypeScript files with Prettier. |
|
| **VALIDATE_TYPESCRIPT_PRETTIER** | `true` | Flag to enable or disable checking the formatting of TypeScript files with Prettier. |
|
||||||
| **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the TypeScript language. (Utilizing: ts-standard) |
|
| **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the TypeScript language. (Utilizing: ts-standard) |
|
||||||
|
|
12
TEMPLATES/biome.json
Normal file
12
TEMPLATES/biome.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"formatter": {
|
||||||
|
"enabled": false,
|
||||||
|
"indentStyle": "tab",
|
||||||
|
"lineWidth": 120
|
||||||
|
},
|
||||||
|
"linter": {
|
||||||
|
"enabled": true,
|
||||||
|
"indentStyle": "tab",
|
||||||
|
"lineWidth": 120
|
||||||
|
}
|
||||||
|
}
|
147
dependencies/package-lock.json
generated
vendored
147
dependencies/package-lock.json
generated
vendored
|
@ -9,6 +9,7 @@
|
||||||
"@babel/eslint-parser": "^7.25.8",
|
"@babel/eslint-parser": "^7.25.8",
|
||||||
"@babel/preset-react": "^7.25.7",
|
"@babel/preset-react": "^7.25.7",
|
||||||
"@babel/preset-typescript": "^7.24.7",
|
"@babel/preset-typescript": "^7.24.7",
|
||||||
|
"@biomejs/biome": "^1.9.4",
|
||||||
"@coffeelint/cli": "^5.2.11",
|
"@coffeelint/cli": "^5.2.11",
|
||||||
"@commitlint/config-conventional": "^19.5.0",
|
"@commitlint/config-conventional": "^19.5.0",
|
||||||
"@ibm/tekton-lint": "^1.1.0",
|
"@ibm/tekton-lint": "^1.1.0",
|
||||||
|
@ -3227,6 +3228,152 @@
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@biomejs/biome": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"bin": {
|
||||||
|
"biome": "bin/biome"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/biome"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@biomejs/cli-darwin-arm64": "1.9.4",
|
||||||
|
"@biomejs/cli-darwin-x64": "1.9.4",
|
||||||
|
"@biomejs/cli-linux-arm64": "1.9.4",
|
||||||
|
"@biomejs/cli-linux-arm64-musl": "1.9.4",
|
||||||
|
"@biomejs/cli-linux-x64": "1.9.4",
|
||||||
|
"@biomejs/cli-linux-x64-musl": "1.9.4",
|
||||||
|
"@biomejs/cli-win32-arm64": "1.9.4",
|
||||||
|
"@biomejs/cli-win32-x64": "1.9.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@biomejs/cli-darwin-arm64": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@biomejs/cli-darwin-x64": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@biomejs/cli-linux-arm64": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@biomejs/cli-linux-arm64-musl": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@biomejs/cli-linux-x64": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@biomejs/cli-linux-x64-musl": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@biomejs/cli-win32-arm64": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@biomejs/cli-win32-x64": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@breejs/later": {
|
"node_modules/@breejs/later": {
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@breejs/later/-/later-4.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@breejs/later/-/later-4.2.0.tgz",
|
||||||
|
|
1
dependencies/package.json
vendored
1
dependencies/package.json
vendored
|
@ -4,6 +4,7 @@
|
||||||
"@babel/eslint-parser": "^7.25.8",
|
"@babel/eslint-parser": "^7.25.8",
|
||||||
"@babel/preset-react": "^7.25.7",
|
"@babel/preset-react": "^7.25.7",
|
||||||
"@babel/preset-typescript": "^7.24.7",
|
"@babel/preset-typescript": "^7.24.7",
|
||||||
|
"@biomejs/biome": "^1.9.4",
|
||||||
"@coffeelint/cli": "^5.2.11",
|
"@coffeelint/cli": "^5.2.11",
|
||||||
"@commitlint/config-conventional": "^19.5.0",
|
"@commitlint/config-conventional": "^19.5.0",
|
||||||
"@ibm/tekton-lint": "^1.1.0",
|
"@ibm/tekton-lint": "^1.1.0",
|
||||||
|
|
|
@ -430,6 +430,7 @@ BuildFileArrays() {
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVA"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVA"
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GOOGLE_JAVA_FORMAT"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GOOGLE_JAVA_FORMAT"
|
||||||
elif [ "${FILE_TYPE}" == "js" ]; then
|
elif [ "${FILE_TYPE}" == "js" ]; then
|
||||||
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVASCRIPT_BIOME"
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVASCRIPT_ES"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVASCRIPT_ES"
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVASCRIPT_STANDARD"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVASCRIPT_STANDARD"
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVASCRIPT_PRETTIER"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-JAVASCRIPT_PRETTIER"
|
||||||
|
@ -525,6 +526,7 @@ BuildFileArrays() {
|
||||||
[[ ${FILE} != *"docker-bake.override.hcl"* ]]; then
|
[[ ${FILE} != *"docker-bake.override.hcl"* ]]; then
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TERRAGRUNT"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TERRAGRUNT"
|
||||||
elif [ "${FILE_TYPE}" == "ts" ]; then
|
elif [ "${FILE_TYPE}" == "ts" ]; then
|
||||||
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TYPESCRIPT_BIOME"
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TYPESCRIPT_ES"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TYPESCRIPT_ES"
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TYPESCRIPT_STANDARD"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TYPESCRIPT_STANDARD"
|
||||||
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TYPESCRIPT_PRETTIER"
|
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-TYPESCRIPT_PRETTIER"
|
||||||
|
|
|
@ -87,6 +87,7 @@ LINTER_COMMANDS_ARRAY_GROOVY=(npm-groovy-lint -c "${GROOVY_LINTER_RULES}" --fail
|
||||||
LINTER_COMMANDS_ARRAY_HTML=(htmlhint --config "${HTML_LINTER_RULES}")
|
LINTER_COMMANDS_ARRAY_HTML=(htmlhint --config "${HTML_LINTER_RULES}")
|
||||||
LINTER_COMMANDS_ARRAY_HTML_PRETTIER=("${PRETTIER_COMMAND[@]}")
|
LINTER_COMMANDS_ARRAY_HTML_PRETTIER=("${PRETTIER_COMMAND[@]}")
|
||||||
LINTER_COMMANDS_ARRAY_JAVA=(java -jar /usr/bin/checkstyle -c "${JAVA_LINTER_RULES}")
|
LINTER_COMMANDS_ARRAY_JAVA=(java -jar /usr/bin/checkstyle -c "${JAVA_LINTER_RULES}")
|
||||||
|
LINTER_COMMANDS_ARRAY_JAVASCRIPT_BIOME=(biome lint)
|
||||||
LINTER_COMMANDS_ARRAY_JAVASCRIPT_ES=(eslint -c "${JAVASCRIPT_ES_LINTER_RULES}")
|
LINTER_COMMANDS_ARRAY_JAVASCRIPT_ES=(eslint -c "${JAVASCRIPT_ES_LINTER_RULES}")
|
||||||
LINTER_COMMANDS_ARRAY_JAVASCRIPT_PRETTIER=("${PRETTIER_COMMAND[@]}")
|
LINTER_COMMANDS_ARRAY_JAVASCRIPT_PRETTIER=("${PRETTIER_COMMAND[@]}")
|
||||||
LINTER_COMMANDS_ARRAY_JAVASCRIPT_STANDARD=(standard "${JAVASCRIPT_STANDARD_LINTER_RULES}")
|
LINTER_COMMANDS_ARRAY_JAVASCRIPT_STANDARD=(standard "${JAVASCRIPT_STANDARD_LINTER_RULES}")
|
||||||
|
@ -168,6 +169,7 @@ LINTER_COMMANDS_ARRAY_TERRAFORM_TFLINT=("TF_DATA_DIR=\"/tmp/.terraform-TERRAFORM
|
||||||
LINTER_COMMANDS_ARRAY_TERRAFORM_TERRASCAN=(terrascan scan -i terraform -t all -c "${TERRAFORM_TERRASCAN_LINTER_RULES}" -f)
|
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_TERRAGRUNT=(terragrunt hclfmt --terragrunt-check --terragrunt-log-level error --terragrunt-hclfmt-file)
|
||||||
LINTER_COMMANDS_ARRAY_TSX=(eslint -c "${TSX_LINTER_RULES}")
|
LINTER_COMMANDS_ARRAY_TSX=(eslint -c "${TSX_LINTER_RULES}")
|
||||||
|
LINTER_COMMANDS_ARRAY_TYPESCRIPT_BIOME=(biome lint)
|
||||||
LINTER_COMMANDS_ARRAY_TYPESCRIPT_ES=(eslint -c "${TYPESCRIPT_ES_LINTER_RULES}")
|
LINTER_COMMANDS_ARRAY_TYPESCRIPT_ES=(eslint -c "${TYPESCRIPT_ES_LINTER_RULES}")
|
||||||
LINTER_COMMANDS_ARRAY_TYPESCRIPT_PRETTIER=("${PRETTIER_COMMAND[@]}")
|
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_TYPESCRIPT_STANDARD=(ts-standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin --project "${TYPESCRIPT_STANDARD_TSCONFIG_FILE}")
|
||||||
|
|
|
@ -11,6 +11,7 @@ declare -A LINTER_NAMES_ARRAY
|
||||||
LINTER_NAMES_ARRAY['ANSIBLE']="ansible-lint"
|
LINTER_NAMES_ARRAY['ANSIBLE']="ansible-lint"
|
||||||
LINTER_NAMES_ARRAY['BASH']="shellcheck"
|
LINTER_NAMES_ARRAY['BASH']="shellcheck"
|
||||||
LINTER_NAMES_ARRAY['BASH_EXEC']="bash-exec"
|
LINTER_NAMES_ARRAY['BASH_EXEC']="bash-exec"
|
||||||
|
LINTER_NAMES_ARRAY['BIOME']="biome"
|
||||||
LINTER_NAMES_ARRAY['CHECKOV']="checkov"
|
LINTER_NAMES_ARRAY['CHECKOV']="checkov"
|
||||||
LINTER_NAMES_ARRAY['CLANG_FORMAT']="clang-format"
|
LINTER_NAMES_ARRAY['CLANG_FORMAT']="clang-format"
|
||||||
LINTER_NAMES_ARRAY['CLOJURE']="clj-kondo"
|
LINTER_NAMES_ARRAY['CLOJURE']="clj-kondo"
|
||||||
|
|
|
@ -146,6 +146,7 @@ control "super-linter-installed-commands" do
|
||||||
{ linter_name: "arm-ttk", version_command: "grep -iE 'version' '/usr/bin/arm-ttk' | xargs"},
|
{ linter_name: "arm-ttk", version_command: "grep -iE 'version' '/usr/bin/arm-ttk' | xargs"},
|
||||||
{ linter_name: "asl-validator"},
|
{ linter_name: "asl-validator"},
|
||||||
{ linter_name: "bash-exec", expected_exit_status: 1}, # expect a return code = 1 because this linter doesn't support a "get linter version" command
|
{ linter_name: "bash-exec", expected_exit_status: 1}, # expect a return code = 1 because this linter doesn't support a "get linter version" command
|
||||||
|
{ linter_name: "biome"},
|
||||||
{ linter_name: "black"},
|
{ linter_name: "black"},
|
||||||
{ linter_name: "cfn-lint"},
|
{ linter_name: "cfn-lint"},
|
||||||
{ linter_name: "checkov"},
|
{ linter_name: "checkov"},
|
||||||
|
@ -334,6 +335,7 @@ control "super-linter-installed-npm-packages" do
|
||||||
"@babel/eslint-parser",
|
"@babel/eslint-parser",
|
||||||
"@babel/preset-react",
|
"@babel/preset-react",
|
||||||
"@babel/preset-typescript",
|
"@babel/preset-typescript",
|
||||||
|
"@biomejs/biome",
|
||||||
"@coffeelint/cli",
|
"@coffeelint/cli",
|
||||||
"@ibm/tekton-lint",
|
"@ibm/tekton-lint",
|
||||||
"@react-native/eslint-config",
|
"@react-native/eslint-config",
|
||||||
|
@ -528,6 +530,7 @@ control "super-linter-validate-files" do
|
||||||
"/action/lib/.automation/.stylelintrc.json",
|
"/action/lib/.automation/.stylelintrc.json",
|
||||||
"/action/lib/.automation/.tflint.hcl",
|
"/action/lib/.automation/.tflint.hcl",
|
||||||
"/action/lib/.automation/.yaml-lint.yml",
|
"/action/lib/.automation/.yaml-lint.yml",
|
||||||
|
"/action/lib/.automation/biome.json",
|
||||||
"/action/lib/.automation/phpcs.xml",
|
"/action/lib/.automation/phpcs.xml",
|
||||||
"/action/lib/.automation/phpstan.neon",
|
"/action/lib/.automation/phpstan.neon",
|
||||||
"/action/lib/.automation/psalm.xml",
|
"/action/lib/.automation/psalm.xml",
|
||||||
|
|
225
test/linters/javascript_biome/javascript_bad_1.js
Normal file
225
test/linters/javascript_biome/javascript_bad_1.js
Normal file
|
@ -0,0 +1,225 @@
|
||||||
|
var http = require('http')
|
||||||
|
var createHandler = require( 'github-webhook-handler')
|
||||||
|
|
||||||
|
var handler = createHandler( { path : /webhook, secret : (process.env.SECRET) })
|
||||||
|
|
||||||
|
var userArray = [ 'user1' ]
|
||||||
|
here is some garbage = that
|
||||||
|
|
||||||
|
var teamDescription = Team of Robots
|
||||||
|
var teamPrivacy = 'closed' // closed (visible) / secret (hidden) are options here
|
||||||
|
|
||||||
|
var teamName = process.env.GHES_TEAM_NAME
|
||||||
|
var teamAccess = 'pull' // pull,push,admin options here
|
||||||
|
var teamId = ''
|
||||||
|
|
||||||
|
var orgRepos = []
|
||||||
|
|
||||||
|
// var creator = ""
|
||||||
|
|
||||||
|
var foo = someFunction();
|
||||||
|
var bar = a + 1;
|
||||||
|
|
||||||
|
http.createServer(function (req, res) {
|
||||||
|
handler(req, res, function (err) {
|
||||||
|
console.log(err)
|
||||||
|
res.statusCode = 404
|
||||||
|
res.end('no such location')
|
||||||
|
})
|
||||||
|
}).listen(3000)
|
||||||
|
|
||||||
|
handler.on('error', function (err) {
|
||||||
|
console.await.error('Error:', err.message)
|
||||||
|
})
|
||||||
|
|
||||||
|
handler.on('repository', function (event) {
|
||||||
|
if (event.payload.action === 'created') {
|
||||||
|
const repo = event.payload.repository.full_name
|
||||||
|
console.log(repo)
|
||||||
|
const org = event.payload.repository.owner.login
|
||||||
|
getTeamID(org)
|
||||||
|
setTimeout(checkTeamIDVariable, 1000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
handler.on('team', function (event) {
|
||||||
|
// TODO user events such as being removed from team or org
|
||||||
|
if (event.payload.action === 'deleted') {
|
||||||
|
// const name = event.payload.team.name
|
||||||
|
const org = event.payload.organization.login
|
||||||
|
getRepositories(org)
|
||||||
|
setTimeout(checkReposVariable, 5000)
|
||||||
|
} else if (event.payload.action === 'removed_from_repository') {
|
||||||
|
const org = event.payload.organization.login
|
||||||
|
getTeamID(org)
|
||||||
|
// const repo = event.payload.repository.full_name
|
||||||
|
setTimeout(checkTeamIDVariable, 1000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function getTeamID (org) {
|
||||||
|
const https = require('https')
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: (process.env.GHE_HOST),
|
||||||
|
port: 443
|
||||||
|
path: '/api/v3/orgs/' + org + '/teams',
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
Authorization: 'token ' + (process.env.GHE_TOKEN),
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let body = []
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
res.on('data', (chunk) => {
|
||||||
|
body.push(chunk)
|
||||||
|
}).on('end', () => {
|
||||||
|
body = JSON.parse(Buffer.concat(body))
|
||||||
|
body.forEach(item => {
|
||||||
|
if (item.name === teamName) {
|
||||||
|
teamId = item.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
req.on('error, (error) => {
|
||||||
|
console.error(error)
|
||||||
|
})
|
||||||
|
|
||||||
|
req.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkTeamIDVariable (repo) {
|
||||||
|
if (typeof teamId != 'undefined') {
|
||||||
|
addTeamToRepo(repo, teamId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkReposVariable (org) {
|
||||||
|
if (typeof orgRepos !== 'undefined') {
|
||||||
|
// for(var repo of orgRepos) {
|
||||||
|
// addTeamToRepo(repo, teamId)
|
||||||
|
// }
|
||||||
|
reCreateTeam(org)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTeamToRepo (repo, teamId) {
|
||||||
|
const https = require('https')
|
||||||
|
const data = JSON.stringify({
|
||||||
|
permission: teamAccess
|
||||||
|
})
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: (process.env.GHE_HOST),
|
||||||
|
port: 443,
|
||||||
|
path: '/api/v3/teams/' + teamId + '/repos/' + repo,
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
Authorization: 'token ' + (process.env.GHE_TOKEN),
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Content-Length': data.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let body = []
|
||||||
|
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
res.on('data', (chunk) => {
|
||||||
|
|
||||||
|
body.push(chunk)
|
||||||
|
|
||||||
|
}).on('end', () => {
|
||||||
|
|
||||||
|
body = Buffer.concat(body).toString()
|
||||||
|
console.log(res.statusCode)
|
||||||
|
console.log('added team to ' + repo)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
req.on('error', (error) => {
|
||||||
|
console.error(error)
|
||||||
|
})
|
||||||
|
|
||||||
|
req.write(data)
|
||||||
|
req.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
function reCreateTeam (org) {
|
||||||
|
const https = require('https')
|
||||||
|
const data = JSON.stringify({
|
||||||
|
name: teamName,
|
||||||
|
description: teamDescription,
|
||||||
|
privacy: teamPrivacy
|
||||||
|
maintainers: userArray,
|
||||||
|
repo_names: orgRepos
|
||||||
|
})
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: (process.env.GHE_HOST),
|
||||||
|
port: 443
|
||||||
|
path: '/api/v3/orgs/' + org + '/teams',
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Authorization: 'token ' + (process.env.GHE_TOKEN),
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Content-Length': data.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// const body = []
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
if (res.statusCode !== 201) {
|
||||||
|
console.log('Status code: ' + res.statusCode)
|
||||||
|
console.log('Added ' + teamName + ' to ' + org + ' Failed')
|
||||||
|
res.on('data', function (chunk) {
|
||||||
|
console.log('BODY: ' + chunk)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('Added ' + teamName ' to ' + org)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
req.on('error', (error) => {
|
||||||
|
console.error(error)
|
||||||
|
})
|
||||||
|
|
||||||
|
req.write(data)
|
||||||
|
req.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRepositories (org) {
|
||||||
|
orgRepos = []
|
||||||
|
|
||||||
|
const https = require('https')
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: (process.env.GHE_HOST),
|
||||||
|
port: '443',
|
||||||
|
path: '/api/v3/orgs/' + org + "/repos",
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
Authorization: 'token ' + (process.env.GHE_TOKEN),
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let body = []
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
res.on('data', (chunk) => {
|
||||||
|
body.push(chunk)
|
||||||
|
|
||||||
|
}).on('end', () => {
|
||||||
|
body = JSON.parse(Buffer.concat(body))
|
||||||
|
body.forEach(item => {
|
||||||
|
orgRepos.push(item.full_name)
|
||||||
|
|
||||||
|
console.log(item.full_name)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
req.on('error', (error) => {
|
||||||
|
console.error(error)
|
||||||
|
})
|
||||||
|
req.end()
|
||||||
|
}
|
223
test/linters/javascript_biome/javascript_good_1.js
Normal file
223
test/linters/javascript_biome/javascript_good_1.js
Normal file
|
@ -0,0 +1,223 @@
|
||||||
|
var http = require("http");
|
||||||
|
var createHandler = require("github-webhook-handler");
|
||||||
|
var handler = createHandler({ path: "/webhook", secret: process.env.SECRET });
|
||||||
|
|
||||||
|
var userArray = ["user1"];
|
||||||
|
|
||||||
|
var teamDescription = "Team of Robots";
|
||||||
|
var teamPrivacy = "closed"; // closed (visible) / secret (hidden) are options here
|
||||||
|
|
||||||
|
var teamName = process.env.GHES_TEAM_NAME;
|
||||||
|
var teamAccess = "pull"; // pull,push,admin options here
|
||||||
|
var teamId = "";
|
||||||
|
|
||||||
|
var orgRepos = [];
|
||||||
|
|
||||||
|
// var creator = ""
|
||||||
|
|
||||||
|
http
|
||||||
|
.createServer(function (req, res) {
|
||||||
|
handler(req, res, function (err) {
|
||||||
|
console.log(err);
|
||||||
|
res.statusCode = 404;
|
||||||
|
res.end("no such location");
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.listen(3000);
|
||||||
|
|
||||||
|
handler.on("error", function (err) {
|
||||||
|
console.error("Error:", err.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
handler.on("repository", function (event) {
|
||||||
|
if (event.payload.action === "created") {
|
||||||
|
const repo = event.payload.repository.full_name;
|
||||||
|
console.log(repo);
|
||||||
|
const org = event.payload.repository.owner.login;
|
||||||
|
getTeamID(org);
|
||||||
|
setTimeout(checkTeamIDVariable, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
handler.on("team", function (event) {
|
||||||
|
// TODO user events such as being removed from team or org
|
||||||
|
if (event.payload.action === "deleted") {
|
||||||
|
// const name = event.payload.team.name
|
||||||
|
const org = event.payload.organization.login;
|
||||||
|
getRepositories(org);
|
||||||
|
setTimeout(checkReposVariable, 5000);
|
||||||
|
} else if (event.payload.action === "removed_from_repository") {
|
||||||
|
const org = event.payload.organization.login;
|
||||||
|
getTeamID(org);
|
||||||
|
// const repo = event.payload.repository.full_name
|
||||||
|
setTimeout(checkTeamIDVariable, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function getTeamID(org) {
|
||||||
|
const https = require("https");
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: process.env.GHE_HOST,
|
||||||
|
port: 443,
|
||||||
|
path: "/api/v3/orgs/" + org + "/teams",
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
Authorization: "token " + process.env.GHE_TOKEN,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let body = [];
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
res
|
||||||
|
.on("data", (chunk) => {
|
||||||
|
body.push(chunk);
|
||||||
|
})
|
||||||
|
.on("end", () => {
|
||||||
|
body = JSON.parse(Buffer.concat(body));
|
||||||
|
body.forEach((item) => {
|
||||||
|
if (item.name === teamName) {
|
||||||
|
teamId = item.id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on("error", (error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkTeamIDVariable(repo) {
|
||||||
|
if (typeof teamId !== "undefined") {
|
||||||
|
addTeamToRepo(repo, teamId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkReposVariable(org) {
|
||||||
|
if (typeof orgRepos !== "undefined") {
|
||||||
|
// for(var repo of orgRepos) {
|
||||||
|
// addTeamToRepo(repo, teamId)
|
||||||
|
// }
|
||||||
|
reCreateTeam(org);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTeamToRepo(repo, teamId) {
|
||||||
|
const https = require("https");
|
||||||
|
const data = JSON.stringify({
|
||||||
|
permission: teamAccess,
|
||||||
|
});
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: process.env.GHE_HOST,
|
||||||
|
port: 443,
|
||||||
|
path: "/api/v3/teams/" + teamId + "/repos/" + repo,
|
||||||
|
method: "PUT",
|
||||||
|
headers: {
|
||||||
|
Authorization: "token " + process.env.GHE_TOKEN,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Content-Length": data.length,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let body = [];
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
res
|
||||||
|
.on("data", (chunk) => {
|
||||||
|
body.push(chunk);
|
||||||
|
})
|
||||||
|
.on("end", () => {
|
||||||
|
body = Buffer.concat(body).toString();
|
||||||
|
console.log(res.statusCode);
|
||||||
|
console.log("added team to " + repo);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on("error", (error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.write(data);
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
function reCreateTeam(org) {
|
||||||
|
const https = require("https");
|
||||||
|
const data = JSON.stringify({
|
||||||
|
name: teamName,
|
||||||
|
description: teamDescription,
|
||||||
|
privacy: teamPrivacy,
|
||||||
|
maintainers: userArray,
|
||||||
|
repo_names: orgRepos,
|
||||||
|
});
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: process.env.GHE_HOST,
|
||||||
|
port: 443,
|
||||||
|
path: "/api/v3/orgs/" + org + "/teams",
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
Authorization: "token " + process.env.GHE_TOKEN,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Content-Length": data.length,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
// const body = []
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
if (res.statusCode !== 201) {
|
||||||
|
console.log("Status code: " + res.statusCode);
|
||||||
|
console.log("Added " + teamName + " to " + org + " Failed");
|
||||||
|
res.on("data", function (chunk) {
|
||||||
|
console.log("BODY: " + chunk);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log("Added " + teamName + " to " + org);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on("error", (error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.write(data);
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRepositories(org) {
|
||||||
|
orgRepos = [];
|
||||||
|
|
||||||
|
const https = require("https");
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: process.env.GHE_HOST,
|
||||||
|
port: 443,
|
||||||
|
path: "/api/v3/orgs/" + org + "/repos",
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
Authorization: "token " + process.env.GHE_TOKEN,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let body = [];
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
res
|
||||||
|
.on("data", (chunk) => {
|
||||||
|
body.push(chunk);
|
||||||
|
})
|
||||||
|
.on("end", () => {
|
||||||
|
body = JSON.parse(Buffer.concat(body));
|
||||||
|
body.forEach((item) => {
|
||||||
|
orgRepos.push(item.full_name);
|
||||||
|
console.log(item.full_name);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on("error", (error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.end();
|
||||||
|
}
|
Loading…
Reference in a new issue