Skip to content

Commit 5caed6a

Browse files
authored
Sync Prettier formatting assets with templates (#109)
We have assembled a collection of reusable project assets: https://github.com/arduino/tooling-project-assets These assets will be used in the repositories of all Arduino tooling projects. Some improvements and standardizations have been made in the upstream "template" assets for formatting to and checking compliance with the Prettier formatting style. Those are introduced to this repository here. Notable: - Expand Prettier coverage to all supported files Some task names have changed: - `docs:format` -> `general:format-prettier` - `config:format` -> `general:format-prettier` - `docs:check` -> removed (use `general:format-prettier` instead) - `config:check` -> removed (use `general:format-prettier` instead)
1 parent b70ce14 commit 5caed6a

File tree

5 files changed

+242
-77
lines changed

5 files changed

+242
-77
lines changed

Diff for: .github/workflows/check-prettier-formatting-task.yml

+219
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-prettier-formatting-task.md
2+
name: Check Prettier Formatting
3+
4+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/check-prettier-formatting-task.ya?ml"
9+
- "Taskfile.ya?ml"
10+
- "**/.prettierignore"
11+
- "**/.prettierrc*"
12+
# CSS
13+
- "**.css"
14+
- "**.wxss"
15+
# PostCSS
16+
- "**.pcss"
17+
- "**.postcss"
18+
# Less
19+
- "**.less"
20+
# SCSS
21+
- "**.scss"
22+
# GraphQL
23+
- "**.graphqls?"
24+
- "**.gql"
25+
# handlebars
26+
- "**.handlebars"
27+
- "**.hbs"
28+
# HTML
29+
- "**.mjml"
30+
- "**.html?"
31+
- "**.html.hl"
32+
- "**.st"
33+
- "**.xht"
34+
- "**.xhtml"
35+
# Vue
36+
- "**.vue"
37+
# JavaScript
38+
- "**.flow"
39+
- "**._?jsb?"
40+
- "**.bones"
41+
- "**.cjs"
42+
- "**.es6?"
43+
- "**.frag"
44+
- "**.gs"
45+
- "**.jake"
46+
- "**.jscad"
47+
- "**.jsfl"
48+
- "**.js[ms]"
49+
- "**.[mn]js"
50+
- "**.pac"
51+
- "**.wxs"
52+
- "**.[xs]s?js"
53+
- "**.xsjslib"
54+
# JSX
55+
- "**.jsx"
56+
# TypeScript
57+
- "**.ts"
58+
# TSX
59+
- "**.tsx"
60+
# JSON
61+
- "**/.eslintrc"
62+
- "**.json"
63+
- "**.avsc"
64+
- "**.geojson"
65+
- "**.gltf"
66+
- "**.har"
67+
- "**.ice"
68+
- "**.JSON-tmLanguage"
69+
- "**.mcmeta"
70+
- "**.tfstate"
71+
- "**.topojson"
72+
- "**.webapp"
73+
- "**.webmanifest"
74+
- "**.yyp?"
75+
# JSONC
76+
- "**/.babelrc"
77+
- "**/.jscsrc"
78+
- "**/.js[hl]intrc"
79+
- "**.jsonc"
80+
- "**.sublime-*"
81+
# JSON5
82+
- "**.json5"
83+
# Markdown
84+
- "**.mdx?"
85+
- "**.markdown"
86+
- "**.mk?down"
87+
- "**.mdwn"
88+
- "**.mkdn?"
89+
- "**.ronn"
90+
- "**.workbook"
91+
# YAML
92+
- "**/.clang-format"
93+
- "**/.clang-tidy"
94+
- "**/.gemrc"
95+
- "**/glide.lock"
96+
- "**.ya?ml*"
97+
- "**.mir"
98+
- "**.reek"
99+
- "**.rviz"
100+
- "**.sublime-syntax"
101+
- "**.syntax"
102+
pull_request:
103+
paths:
104+
- ".github/workflows/check-prettier-formatting-task.ya?ml"
105+
- "Taskfile.ya?ml"
106+
- "**/.prettierignore"
107+
- "**/.prettierrc*"
108+
# CSS
109+
- "**.css"
110+
- "**.wxss"
111+
# PostCSS
112+
- "**.pcss"
113+
- "**.postcss"
114+
# Less
115+
- "**.less"
116+
# SCSS
117+
- "**.scss"
118+
# GraphQL
119+
- "**.graphqls?"
120+
- "**.gql"
121+
# handlebars
122+
- "**.handlebars"
123+
- "**.hbs"
124+
# HTML
125+
- "**.mjml"
126+
- "**.html?"
127+
- "**.html.hl"
128+
- "**.st"
129+
- "**.xht"
130+
- "**.xhtml"
131+
# Vue
132+
- "**.vue"
133+
# JavaScript
134+
- "**.flow"
135+
- "**._?jsb?"
136+
- "**.bones"
137+
- "**.cjs"
138+
- "**.es6?"
139+
- "**.frag"
140+
- "**.gs"
141+
- "**.jake"
142+
- "**.jscad"
143+
- "**.jsfl"
144+
- "**.js[ms]"
145+
- "**.[mn]js"
146+
- "**.pac"
147+
- "**.wxs"
148+
- "**.[xs]s?js"
149+
- "**.xsjslib"
150+
# JSX
151+
- "**.jsx"
152+
# TypeScript
153+
- "**.ts"
154+
# TSX
155+
- "**.tsx"
156+
# JSON
157+
- "**/.eslintrc"
158+
- "**.json"
159+
- "**.avsc"
160+
- "**.geojson"
161+
- "**.gltf"
162+
- "**.har"
163+
- "**.ice"
164+
- "**.JSON-tmLanguage"
165+
- "**.mcmeta"
166+
- "**.tfstate"
167+
- "**.topojson"
168+
- "**.webapp"
169+
- "**.webmanifest"
170+
- "**.yyp?"
171+
# JSONC
172+
- "**/.babelrc"
173+
- "**/.jscsrc"
174+
- "**/.js[hl]intrc"
175+
- "**.jsonc"
176+
- "**.sublime-*"
177+
# JSON5
178+
- "**.json5"
179+
# Markdown
180+
- "**.mdx?"
181+
- "**.markdown"
182+
- "**.mk?down"
183+
- "**.mdwn"
184+
- "**.mkdn?"
185+
- "**.ronn"
186+
- "**.workbook"
187+
# YAML
188+
- "**/.clang-format"
189+
- "**/.clang-tidy"
190+
- "**/.gemrc"
191+
- "**/glide.lock"
192+
- "**.ya?ml*"
193+
- "**.mir"
194+
- "**.reek"
195+
- "**.rviz"
196+
- "**.sublime-syntax"
197+
- "**.syntax"
198+
workflow_dispatch:
199+
repository_dispatch:
200+
201+
jobs:
202+
check:
203+
runs-on: ubuntu-latest
204+
205+
steps:
206+
- name: Checkout repository
207+
uses: actions/checkout@v2
208+
209+
- name: Install Task
210+
uses: arduino/setup-task@v1
211+
with:
212+
repo-token: ${{ secrets.GITHUB_TOKEN }}
213+
version: 3.x
214+
215+
- name: Format with Prettier
216+
run: task general:format-prettier
217+
218+
- name: Check formatting
219+
run: git diff --color --exit-code

Diff for: .github/workflows/verify-formatting.yml

-34
This file was deleted.

Diff for: .prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
.vscode/
44
.vs/
55
.ionide/
6+
7+
indexes/download/testdata/module_firmware_index.json
8+
indexes/download/testdata/package_index.json
9+
indexes/firmwareindex/testdata/module_firmware_index.json
10+
indexes/testdata/package_index.json

Diff for: Taskfile.yml

-12
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,6 @@ tasks:
171171
- task: markdown:lint
172172
- task: python:check
173173

174-
config:check:
175-
desc: Check linting of configuration and supporting files
176-
cmds:
177-
- npx {{ .PRETTIER }} --check "**/*.{yml,yaml}"
178-
179-
config:format:
180-
desc: Automatically formats configuration and supporting files
181-
cmds:
182-
- npx {{ .PRETTIER }} --write "**/*.{yml,yaml}"
183-
184174
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-general-formatting-task/Taskfile.yml
185175
general:check-formatting:
186176
desc: Check basic formatting style of all files
@@ -266,5 +256,3 @@ vars:
266256
-X {{.CONFIGURATION_PACKAGE}}.commit={{.TEST_COMMIT}}
267257
-X {{.CONFIGURATION_PACKAGE}}.date={{.TIMESTAMP}}
268258
'
269-
# check-lint vars
270-

Diff for: generator/boards.json

+18-31
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
{
2-
"arduino:samd:mkr1000":{
3-
"moduleName":"WINC1500",
4-
"versions":[
5-
"19.4.4",
6-
"19.5.2",
7-
"19.5.4",
8-
"19.6.1"
9-
]
2+
"arduino:samd:mkr1000": {
3+
"moduleName": "WINC1500",
4+
"versions": ["19.4.4", "19.5.2", "19.5.4", "19.6.1"]
105
},
11-
"arduino:samd:mkrwifi1010":{
12-
"moduleName":"NINA",
13-
"versions":[
6+
"arduino:samd:mkrwifi1010": {
7+
"moduleName": "NINA",
8+
"versions": [
149
"1.0.0",
1510
"1.1.0",
1611
"1.2.1",
@@ -29,9 +24,9 @@
2924
"1.4.8"
3025
]
3126
},
32-
"arduino:samd:nano_33_iot":{
33-
"moduleName":"NINA",
34-
"versions":[
27+
"arduino:samd:nano_33_iot": {
28+
"moduleName": "NINA",
29+
"versions": [
3530
"1.0.0",
3631
"1.1.0",
3732
"1.2.1",
@@ -50,16 +45,13 @@
5045
"1.4.8"
5146
]
5247
},
53-
"arduino:samd:mkrvidor4000":{
54-
"moduleName":"NINA",
55-
"versions":[
56-
"1.0.0",
57-
"1.1.0"
58-
]
48+
"arduino:samd:mkrvidor4000": {
49+
"moduleName": "NINA",
50+
"versions": ["1.0.0", "1.1.0"]
5951
},
60-
"arduino:megaavr:uno2018":{
61-
"moduleName":"NINA",
62-
"versions":[
52+
"arduino:megaavr:uno2018": {
53+
"moduleName": "NINA",
54+
"versions": [
6355
"1.2.1",
6456
"1.2.2",
6557
"1.2.3",
@@ -76,13 +68,8 @@
7668
"1.4.8"
7769
]
7870
},
79-
"arduino:mbed_nano:nanorp2040connect":{
80-
"moduleName":"NINA",
81-
"versions":[
82-
"1.4.5",
83-
"1.4.6",
84-
"1.4.7",
85-
"1.4.8"
86-
]
71+
"arduino:mbed_nano:nanorp2040connect": {
72+
"moduleName": "NINA",
73+
"versions": ["1.4.5", "1.4.6", "1.4.7", "1.4.8"]
8774
}
8875
}

0 commit comments

Comments
 (0)