Skip to content

Commit 5d66fb2

Browse files
authored
chore: migrate linting workflow to use trunk check meta-linter (#18643)
* Add Trunk Check * Cleanup svgo config * Use eslint for yaml linting * Use trunk for svgo of lint-staged * Fix all existing yml violations * Delete yamllint config * Address feedback * Address feedback * Address feedback * Address feedback * Address feedback * Address feedback * Address feedback * Disable trufflehog * Address feedback * Windows * Revert file * Remove whitespace * Run eslint on all files * Fix lint script on Windows * check * Change workflow * Change workflow * Change workflow * Add workflows * Add remote hint * Disable Trivy * Remove unused dep
1 parent 1ff3aba commit 5d66fb2

File tree

13 files changed

+191
-123
lines changed

13 files changed

+191
-123
lines changed

.github/workflows/annotate_pr.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Annotate PR with trunk issues
2+
3+
on:
4+
workflow_run:
5+
workflows: [Pull Request]
6+
types: [completed]
7+
8+
permissions: read-all
9+
10+
jobs:
11+
trunk_check:
12+
name: Trunk Check Annotate
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
checks: write
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Trunk Check
23+
uses: trunk-io/trunk-action@v1
24+
with:
25+
post-annotations: true # only for fork PRs

.github/workflows/ci.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,41 @@ jobs:
2424
working-directory: docs
2525
run: npm install
2626

27-
- name: Lint Files
28-
run: node Makefile lint
27+
- name: Lint Files (eslint)
28+
uses: trunk-io/trunk-action@v1
29+
with:
30+
31+
# Run on everything except the docs folder.
32+
arguments: --ignore=docs/** --filter=eslint
33+
check-mode: all
34+
35+
- name: Lint Files (other)
36+
uses: trunk-io/trunk-action@v1
37+
with:
38+
39+
# Run on everything except the docs folder.
40+
arguments: --ignore=docs/** --filter=-eslint
2941

3042
- name: Check Rule Files
3143
run: node Makefile checkRuleFiles
3244

3345
- name: Check Licenses
3446
run: node Makefile checkLicenses
3547

36-
- name: Lint Docs JS Files
37-
run: node Makefile lintDocsJS
48+
- name: Lint Docs Files (eslint)
49+
uses: trunk-io/trunk-action@v1
50+
with:
51+
52+
# Run only on the docs folder.
53+
arguments: --ignore=** --ignore=!docs/** --filter=eslint
54+
check-mode: all
55+
56+
- name: Lint Docs Files (other)
57+
uses: trunk-io/trunk-action@v1
58+
with:
59+
60+
# Run only on the docs folder.
61+
arguments: --ignore=** --ignore=!docs/** --filter=-eslint
3862

3963
- name: Check Rule Examples
4064
run: node Makefile checkRuleExamples

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
push:
1616
branches: [main]
1717
pull_request:
18+
1819
# The branches below must be a subset of the branches above
1920
branches: [main]
2021
schedule:
@@ -33,6 +34,7 @@ jobs:
3334
fail-fast: false
3435
matrix:
3536
language: [ 'javascript' ]
37+
3638
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
3739
# Learn more:
3840
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
@@ -46,6 +48,7 @@ jobs:
4648
uses: github/codeql-action/init@v3
4749
with:
4850
languages: ${{ matrix.language }}
51+
4952
# If you wish to specify custom queries, you can do so here or in a config file.
5053
# By default, queries listed here will override any specified in a config file.
5154
# Prefix the list here with "+" to use these queries and those in the config file.

.markdownlint.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
default: true
22

33
# Exclusions for deliberate/widespread violations
4-
MD002: false # First header should be a h1 header
5-
MD004: # Unordered list style
4+
MD002: false # First header should be a h1 header
5+
MD004: # Unordered list style
66
style: asterisk
7-
MD007: # Unordered list indentation
7+
MD007: # Unordered list indentation
88
indent: 4
9-
MD013: false # Line length
10-
MD019: false # Multiple spaces after hash on atx style header
11-
MD021: false # Multiple spaces inside hashes on closed atx style header
12-
MD024: false # Multiple headers with the same content
13-
MD026: false # Trailing punctuation in header
14-
MD029: false # Ordered list item prefix
15-
MD030: false # Spaces after list markers
16-
MD033: false # Allow inline HTML
17-
MD041: false # First line in file should be a top level header
18-
MD046: # Code block style
9+
MD013: false # Line length
10+
MD019: false # Multiple spaces after hash on atx style header
11+
MD021: false # Multiple spaces inside hashes on closed atx style header
12+
MD024: false # Multiple headers with the same content
13+
MD026: false # Trailing punctuation in header
14+
MD029: false # Ordered list item prefix
15+
MD030: false # Spaces after list markers
16+
MD033: false # Allow inline HTML
17+
MD041: false # First line in file should be a top level header
18+
MD046: # Code block style
1919
style: fenced

.markdownlintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.pre-commit-hooks.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
- id: eslint
2-
name: eslint
3-
entry: eslint
4-
description: "An AST-based pattern checker for JavaScript."
5-
language: node
6-
types: ['javascript']
7-
require_serial: false
1+
- id: eslint
2+
name: eslint
3+
entry: eslint
4+
description: "An AST-based pattern checker for JavaScript."
5+
language: node
6+
types: ['javascript']
7+
require_serial: false

.trunk/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*out
2+
*logs
3+
*actions
4+
*notifications
5+
*tools
6+
plugins
7+
user_trunk.yaml
8+
user.yaml
9+
tmp

.trunk/configs/.shellcheckrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
enable=all
2+
source-path=SCRIPTDIR
3+
disable=SC2154
4+
5+
# If you're having issues with shellcheck following source, disable the errors via:
6+
# disable=SC1090
7+
# disable=SC1091

.trunk/configs/svgo.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"use strict";
2+
3+
module.exports = {
4+
plugins: [
5+
{
6+
name: "preset-default",
7+
params: {
8+
overrides: {
9+
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
10+
sortAttrs: true,
11+
removeOffCanvasPaths: true
12+
}
13+
}
14+
}
15+
]
16+
};

.trunk/trunk.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
2+
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
3+
version: 0.1
4+
cli:
5+
version: 1.22.3
6+
7+
repo:
8+
trunk_remote_hint: github.com/eslint/eslint
9+
10+
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
11+
plugins:
12+
sources:
13+
- id: trunk
14+
uri: https://github.com/trunk-io/plugins
15+
ref: v1.6.1
16+
17+
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
18+
runtimes:
19+
enabled:
20+
21+
22+
23+
tools:
24+
enabled:
25+
26+
27+
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
28+
lint:
29+
definitions:
30+
- name: eslint
31+
files: [typescript, javascript, yaml] # Add YAML to default files.
32+
hold_the_line: false
33+
commands:
34+
- name: lint
35+
disable_upstream: true
36+
run: node ${workspace}/bin/eslint.js --output-file ${tmpfile} --format json ${target}
37+
- name: checkov
38+
supported_platforms: [linux, macos]
39+
- name: renovate
40+
supported_platforms: [linux, macos]
41+
enabled:
42+
43+
- eslint
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
disabled:
54+
- yamllint
55+
- trufflehog # Requires the network to run.
56+
ignore:
57+
- linters: [markdownlint]
58+
paths:
59+
- CHANGELOG.md
60+
- linters: [prettier]
61+
paths:
62+
- "**" # Ignore all files
63+
- "!conf/**/*.json" # Except for json files in conf/
64+
actions:
65+
disabled:
66+
- trunk-announce
67+
- trunk-check-pre-push
68+
- trunk-fmt-pre-commit
69+
enabled:
70+
- trunk-upgrade-available

0 commit comments

Comments
 (0)