Skip to content

Commit 74b9831

Browse files
inexorabletashhuningxinfdwr
authored
Add tools/ dir and some handy utilities (#702)
* Add tools/ dir and some handy utilities The tools are intended for spec editors to use when authoring and/or reviewing changes. They aren't incorporated into the spec publishing process, but that could be considered in the future. - tools/reformat_js - reformats JS blocks in the spec - tools/lint.mjs - looks for convention violations and other glitches The reformat_js tools has been applied to index.bs * Update tools/reformat_js Co-authored-by: Ningxin Hu <[email protected]> * Rename exit_code to exitCode - camelCase FTW * rename with extension for more clarity * Include interpreter in instructions * Add .clang-format and options * add package.json for node dependencies * Lint: add --verbose option * Add tools to Makefile * Improve documentation around normative references test * Ignore local node files, mention install steps * Article agreement in tools/lint.mjs comment --------- Co-authored-by: Ningxin Hu <[email protected]> Co-authored-by: Dwayne Robinson <[email protected]>
1 parent f6a9af1 commit 74b9831

9 files changed

+760
-332
lines changed

.clang-format

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Defines the Chromium style for automatic reformatting.
2+
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
3+
BasedOnStyle: Chromium
4+
5+
# Stick with 2 spaces for both blocks and continuations.
6+
ContinuationIndentWidth: 2
7+
8+
# Arguments either on one line or each on their own line.
9+
BinPackArguments: false

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/index.html
1+
/index.html
2+
/tools/node_modules
3+
/tools/package-lock.json

Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
.PHONY: clean
2+
13
all: index.html
24

35
index.html: index.bs
6+
python3 tools/reformat-js.py
47
ifdef online
58
curl https://api.csswg.org/bikeshed/ -F [email protected] -F output=err | tee /dev/stderr | grep -e "ERROR" > /dev/null; \
69
if [ $$? -eq 0 ]; \
@@ -11,3 +14,7 @@ else
1114
# bikeshed -f spec index.bs
1215
bikeshed --die-on=fatal spec index.bs
1316
endif
17+
node tools/lint.mjs --verbose
18+
19+
clean:
20+
rm -f index.html

docs/SpecCodingConventions.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This document captures the WebNN spec repo conventions. The intended audience is editors and contributors to the specification.
44

5+
When updating these conventions, consider whether an automated check can be added to the [lint tool](../tools/lint.mjs) to help catch issues.
6+
57
## Resources
68

79
* [Writing Procedural Specs](https://garykac.github.io/procspec/)

0 commit comments

Comments
 (0)