Skip to content

Commit 497693c

Browse files
committed
initial release
0 parents  commit 497693c

File tree

9 files changed

+897
-0
lines changed

9 files changed

+897
-0
lines changed

.eslintrc.json

+203
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
// Copyright 2020 The Chromium OS Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// See https://eslint.org/docs/user-guide/configuring.
6+
// We need to use JSON rather than JS due to Node/ESLint conflicts over ESM:
7+
// https://github.com/eslint/eslint/issues/12319
8+
9+
{
10+
"root": true,
11+
"env": {
12+
"node": true,
13+
// This allows the runtime environment (i.e. objects).
14+
"es6": true
15+
},
16+
"parserOptions": {
17+
// This sets the syntax parsing level.
18+
"ecmaVersion": 2020,
19+
"sourceType": "module"
20+
},
21+
22+
"plugins": [
23+
"jsdoc"
24+
],
25+
26+
// See https://eslint.org/docs/rules/ for details.
27+
// These rules were picked based on the existing codebase. If you find one
28+
// to be too onerous and not required by the styleguide, feel free to discuss.
29+
"rules": {
30+
"array-bracket-spacing": "error",
31+
"arrow-parens": ["error", "always"],
32+
"arrow-spacing": ["error", {"before": true, "after": true}],
33+
"block-spacing": ["error", "always"],
34+
"comma-dangle": ["error", "always-multiline"],
35+
"comma-spacing": "error",
36+
"comma-style": "error",
37+
"curly": "error",
38+
"default-param-last": "error",
39+
"eol-last": "error",
40+
"func-call-spacing": "error",
41+
"generator-star-spacing": ["error", "after"],
42+
// l/I: Depending on the font, these are hard to distinguish.
43+
"id-blacklist": ["error", "l", "I", "self"],
44+
"keyword-spacing": "error",
45+
"lines-between-class-members": "error",
46+
"max-len": ["error", {"code": 80, "ignoreUrls": true}],
47+
"new-parens": "error",
48+
"no-alert": "error",
49+
"no-case-declarations": "error",
50+
"no-cond-assign": "error",
51+
"no-const-assign": "error",
52+
"no-control-regex": "error",
53+
"no-debugger": "error",
54+
"no-dupe-args": "error",
55+
"no-dupe-class-members": "error",
56+
"no-dupe-keys": "error",
57+
"no-duplicate-case": "error",
58+
"no-empty": "error",
59+
"no-empty-character-class": "error",
60+
"no-eval": "error",
61+
"no-ex-assign": "error",
62+
// We want "all" (nestedBinaryExpressions=false), but this breaks
63+
// closure-compiler casts.
64+
"no-extra-parens": ["error", "functions"],
65+
"no-extra-semi": "error",
66+
"no-implied-eval": "error",
67+
"no-invalid-regexp": "error",
68+
"no-irregular-whitespace": "error",
69+
"no-label-var": "error",
70+
"no-mixed-spaces-and-tabs": "error",
71+
"no-multi-spaces": ["error", {"ignoreEOLComments": true}],
72+
"no-multiple-empty-lines": "error",
73+
"no-new": "error",
74+
"no-new-func": "error",
75+
"no-new-object": "error",
76+
"no-new-wrappers": "error",
77+
"no-obj-calls": "error",
78+
"no-octal": "error",
79+
"no-octal-escape": "error",
80+
"no-return-await": "error",
81+
"no-script-url": "error",
82+
"no-self-assign": "error",
83+
"no-self-compare": "error",
84+
"no-sequences": "error",
85+
"no-shadow-restricted-names": "error",
86+
"no-tabs": "error",
87+
"no-template-curly-in-string": "error",
88+
"no-throw-literal": "error",
89+
"no-trailing-spaces": "error",
90+
"no-unmodified-loop-condition": "error",
91+
"no-unneeded-ternary": "error",
92+
"no-unreachable": "error",
93+
"no-useless-call": "error",
94+
"no-useless-concat": "error",
95+
"no-useless-escape": "error",
96+
"no-useless-return": "error",
97+
"no-var": "error",
98+
"no-void": "error",
99+
// We allow TODO comments.
100+
"no-warning-comments": [
101+
"error", {
102+
"terms": ["fix", "fixme", "xxx"]
103+
}
104+
],
105+
"no-whitespace-before-property": "error",
106+
"no-with": "error",
107+
"object-curly-newline": ["error", {"consistent": true}],
108+
"object-curly-spacing": "error",
109+
"one-var-declaration-per-line": "error",
110+
"prefer-const": "error",
111+
"prefer-numeric-literals": "error",
112+
"prefer-rest-params": "error",
113+
"quote-props": ["error", "consistent"],
114+
"quotes": ["error", "single",
115+
{"avoidEscape": true, "allowTemplateLiterals": true}],
116+
"radix": "error",
117+
"rest-spread-spacing": "error",
118+
"semi": ["error", "always"],
119+
"semi-spacing": "error",
120+
"semi-style": ["error", "last"],
121+
"space-before-blocks": ["error", "always"],
122+
"space-before-function-paren": [
123+
"error", {
124+
"anonymous": "never",
125+
"named": "never",
126+
"asyncArrow": "always"
127+
}
128+
],
129+
"space-in-parens": ["error", "never"],
130+
"space-infix-ops": "error",
131+
"space-unary-ops": "error",
132+
"spaced-comment": ["error", "always"],
133+
"switch-colon-spacing": ["error", {"after": true, "before": false}],
134+
"symbol-description": "error",
135+
"template-curly-spacing": ["error", "never"],
136+
"unicode-bom": ["error", "never"],
137+
"use-isnan": "error",
138+
"valid-typeof": "error",
139+
"yield-star-spacing": ["error", "after"],
140+
"yoda": "error",
141+
142+
"jsdoc/check-access": "error",
143+
"jsdoc/check-alignment": "error",
144+
"jsdoc/check-examples": "error",
145+
// We want hanging indentation, but this check requires none everywhere.
146+
"jsdoc/check-indentation": "off",
147+
"jsdoc/check-param-names": "error",
148+
"jsdoc/check-property-names": "error",
149+
// Make sure this is disabled as this rejects closure syntax.
150+
"jsdoc/check-syntax": "off",
151+
"jsdoc/check-tag-names": "error",
152+
// This is disabled until this crash is resolved:
153+
// https://github.com/gajus/eslint-plugin-jsdoc/issues/389
154+
"jsdoc/check-types": "off",
155+
// We don"t use these tags in the project.
156+
"jsdoc/check-values": "off",
157+
"jsdoc/empty-tags": "error",
158+
"jsdoc/implements-on-classes": "error",
159+
"jsdoc/match-description": "error",
160+
"jsdoc/newline-after-description": "error",
161+
// This is only for TypeScript which we don"t care about.
162+
"jsdoc/no-types": "off",
163+
"jsdoc/no-undefined-types": "error",
164+
"jsdoc/require-description": "error",
165+
// TODO(vapier): Turn this on.
166+
"jsdoc/require-description-complete-sentence": "off",
167+
// We don"t want to require examples.
168+
"jsdoc/require-example": "off",
169+
"jsdoc/require-file-overview": "error",
170+
"jsdoc/require-hyphen-before-param-description": ["error", "never"],
171+
"jsdoc/require-jsdoc": "error",
172+
"jsdoc/require-param": "error",
173+
"jsdoc/require-param-description": "error",
174+
"jsdoc/require-param-name": "error",
175+
"jsdoc/require-param-type": "error",
176+
"jsdoc/require-returns": "error",
177+
"jsdoc/require-returns-check": "error",
178+
"jsdoc/require-returns-description": "error",
179+
"jsdoc/require-returns-type": "error",
180+
"jsdoc/valid-types": "error"
181+
},
182+
183+
"settings": {
184+
// https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc
185+
"jsdoc": {
186+
"mode": "closure",
187+
"preferredTypes": {
188+
"object": "Object"
189+
},
190+
"tagNamePreference": {
191+
// While not explicitly defined, Google/Chromium JS style guides only
192+
// use these keyword forms, as does the closure compiler docs.
193+
"augments": "extends",
194+
"constant": "const",
195+
"class": "constructor",
196+
"file": "fileoverview",
197+
"returns": "return",
198+
"yields": "yield"
199+
}
200+
}
201+
}
202+
}
203+

.github/workflows/ci.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# GitHub actions workflow.
2+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
3+
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs
4+
5+
name: Build+Lint+Test CI
6+
7+
on: [push]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
node-version: [12.x, 14.x]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- run: npm install
23+
- run: npm run build --if-present
24+
- run: npm run lint
25+
- run: npm test
26+
env:
27+
CI: true

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/dist/
2+
/.eslintcache
3+
/node_modules/
4+
/package-lock.json

LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright (c) 2020 The Chromium OS Authors. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice,
7+
this list of conditions and the following disclaimer.
8+
2. Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
3. Neither the name of Google Inc. nor the names of its
12+
contributors may be used to endorse or promote products derived from
13+
this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25+
POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)