-
Notifications
You must be signed in to change notification settings - Fork 2
144 lines (123 loc) · 3.77 KB
/
reusable_linter.yml
File metadata and controls
144 lines (123 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
enable_eslinter:
description: 'Enable the ES-Linter for this repository'
type: boolean
required: false
default: false
eslinter-config:
description: 'The location of the configuration file'
type: string
required: false
default: './tools/linters/eslint.config.js'
enable_jsonlinter:
description: 'Enable the JSON-Linter for this repository'
type: boolean
required: false
default: false
enable_yamllinter:
description: 'Enable the YAML-Linter for this repository'
type: boolean
required: false
default: false
yamllinter-config:
description: 'The location of the linter-configuration'
type: string
required: false
default: './tools/linters/.yaml-lint.yml'
enable_stylelinter:
description: 'Enable the Style-Linter for this repository'
type: boolean
required: false
default: false
stylelinter-pattern:
description: 'The file-pattern to match files that are being linted'
type: string
required: false
default: '**/*.{css,scss,sass}'
stylelinter-config:
description: 'The location of the linter-configuration'
type: string
required: false
default: 'tools/linters/.stylelintrc.json'
repository:
description: 'The repository that needs linting'
type: string
default: ${{ github.repository }}
required: false
ref:
description: 'The branch, tag or SHA that needs linting'
type: string
required: false
default: ${{ github.ref }}
jobs:
ecmascript-linter:
if: inputs.enable_eslinter == true
runs-on: ubuntu-latest
steps:
- name: Install NodeJS
uses: actions/setup-node@v6
with:
node-version: latest
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
- name: Install ESLint
run: |
npm install eslint eslint-config
- name: Lint JavaScript
run: ./node_modules/.bin/eslint --config=${{ inputs.eslinter-config }}
env:
DEBUG: eslint:languages:js
json-linter:
if: inputs.enable_jsonlinter == true
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
- name: Lint JSON
uses: limitusus/json-syntax-check@v2
style-linter:
if: inputs.enable_stylelinter == true
runs-on: ubuntu-latest
steps:
- name: Install NodeJS
uses: actions/setup-node@v6
with:
node-version: latest
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
- name: Install StyleLint
run: npm install stylelint stylelint-config-standard
- name: Lint stylesheets
run: |
./node_modules/.bin/stylelint \
-f verbose \
-c=${{ inputs.stylelinter-config }} ${{ inputs.stylelinter-pattern }}
yaml-linter:
if: inputs.enable_yamllinter == true
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
- name: Lint YAML
uses: ibiqlik/action-yamllint@v3.1.1
with:
config_file: ${{ inputs.yamllinter-config }}