-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 497693c
Showing
9 changed files
with
897 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
// Copyright 2020 The Chromium OS Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// See https://eslint.org/docs/user-guide/configuring. | ||
// We need to use JSON rather than JS due to Node/ESLint conflicts over ESM: | ||
// https://github.com/eslint/eslint/issues/12319 | ||
|
||
{ | ||
"root": true, | ||
"env": { | ||
"node": true, | ||
// This allows the runtime environment (i.e. objects). | ||
"es6": true | ||
}, | ||
"parserOptions": { | ||
// This sets the syntax parsing level. | ||
"ecmaVersion": 2020, | ||
"sourceType": "module" | ||
}, | ||
|
||
"plugins": [ | ||
"jsdoc" | ||
], | ||
|
||
// See https://eslint.org/docs/rules/ for details. | ||
// These rules were picked based on the existing codebase. If you find one | ||
// to be too onerous and not required by the styleguide, feel free to discuss. | ||
"rules": { | ||
"array-bracket-spacing": "error", | ||
"arrow-parens": ["error", "always"], | ||
"arrow-spacing": ["error", {"before": true, "after": true}], | ||
"block-spacing": ["error", "always"], | ||
"comma-dangle": ["error", "always-multiline"], | ||
"comma-spacing": "error", | ||
"comma-style": "error", | ||
"curly": "error", | ||
"default-param-last": "error", | ||
"eol-last": "error", | ||
"func-call-spacing": "error", | ||
"generator-star-spacing": ["error", "after"], | ||
// l/I: Depending on the font, these are hard to distinguish. | ||
"id-blacklist": ["error", "l", "I", "self"], | ||
"keyword-spacing": "error", | ||
"lines-between-class-members": "error", | ||
"max-len": ["error", {"code": 80, "ignoreUrls": true}], | ||
"new-parens": "error", | ||
"no-alert": "error", | ||
"no-case-declarations": "error", | ||
"no-cond-assign": "error", | ||
"no-const-assign": "error", | ||
"no-control-regex": "error", | ||
"no-debugger": "error", | ||
"no-dupe-args": "error", | ||
"no-dupe-class-members": "error", | ||
"no-dupe-keys": "error", | ||
"no-duplicate-case": "error", | ||
"no-empty": "error", | ||
"no-empty-character-class": "error", | ||
"no-eval": "error", | ||
"no-ex-assign": "error", | ||
// We want "all" (nestedBinaryExpressions=false), but this breaks | ||
// closure-compiler casts. | ||
"no-extra-parens": ["error", "functions"], | ||
"no-extra-semi": "error", | ||
"no-implied-eval": "error", | ||
"no-invalid-regexp": "error", | ||
"no-irregular-whitespace": "error", | ||
"no-label-var": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multi-spaces": ["error", {"ignoreEOLComments": true}], | ||
"no-multiple-empty-lines": "error", | ||
"no-new": "error", | ||
"no-new-func": "error", | ||
"no-new-object": "error", | ||
"no-new-wrappers": "error", | ||
"no-obj-calls": "error", | ||
"no-octal": "error", | ||
"no-octal-escape": "error", | ||
"no-return-await": "error", | ||
"no-script-url": "error", | ||
"no-self-assign": "error", | ||
"no-self-compare": "error", | ||
"no-sequences": "error", | ||
"no-shadow-restricted-names": "error", | ||
"no-tabs": "error", | ||
"no-template-curly-in-string": "error", | ||
"no-throw-literal": "error", | ||
"no-trailing-spaces": "error", | ||
"no-unmodified-loop-condition": "error", | ||
"no-unneeded-ternary": "error", | ||
"no-unreachable": "error", | ||
"no-useless-call": "error", | ||
"no-useless-concat": "error", | ||
"no-useless-escape": "error", | ||
"no-useless-return": "error", | ||
"no-var": "error", | ||
"no-void": "error", | ||
// We allow TODO comments. | ||
"no-warning-comments": [ | ||
"error", { | ||
"terms": ["fix", "fixme", "xxx"] | ||
} | ||
], | ||
"no-whitespace-before-property": "error", | ||
"no-with": "error", | ||
"object-curly-newline": ["error", {"consistent": true}], | ||
"object-curly-spacing": "error", | ||
"one-var-declaration-per-line": "error", | ||
"prefer-const": "error", | ||
"prefer-numeric-literals": "error", | ||
"prefer-rest-params": "error", | ||
"quote-props": ["error", "consistent"], | ||
"quotes": ["error", "single", | ||
{"avoidEscape": true, "allowTemplateLiterals": true}], | ||
"radix": "error", | ||
"rest-spread-spacing": "error", | ||
"semi": ["error", "always"], | ||
"semi-spacing": "error", | ||
"semi-style": ["error", "last"], | ||
"space-before-blocks": ["error", "always"], | ||
"space-before-function-paren": [ | ||
"error", { | ||
"anonymous": "never", | ||
"named": "never", | ||
"asyncArrow": "always" | ||
} | ||
], | ||
"space-in-parens": ["error", "never"], | ||
"space-infix-ops": "error", | ||
"space-unary-ops": "error", | ||
"spaced-comment": ["error", "always"], | ||
"switch-colon-spacing": ["error", {"after": true, "before": false}], | ||
"symbol-description": "error", | ||
"template-curly-spacing": ["error", "never"], | ||
"unicode-bom": ["error", "never"], | ||
"use-isnan": "error", | ||
"valid-typeof": "error", | ||
"yield-star-spacing": ["error", "after"], | ||
"yoda": "error", | ||
|
||
"jsdoc/check-access": "error", | ||
"jsdoc/check-alignment": "error", | ||
"jsdoc/check-examples": "error", | ||
// We want hanging indentation, but this check requires none everywhere. | ||
"jsdoc/check-indentation": "off", | ||
"jsdoc/check-param-names": "error", | ||
"jsdoc/check-property-names": "error", | ||
// Make sure this is disabled as this rejects closure syntax. | ||
"jsdoc/check-syntax": "off", | ||
"jsdoc/check-tag-names": "error", | ||
// This is disabled until this crash is resolved: | ||
// https://github.com/gajus/eslint-plugin-jsdoc/issues/389 | ||
"jsdoc/check-types": "off", | ||
// We don"t use these tags in the project. | ||
"jsdoc/check-values": "off", | ||
"jsdoc/empty-tags": "error", | ||
"jsdoc/implements-on-classes": "error", | ||
"jsdoc/match-description": "error", | ||
"jsdoc/newline-after-description": "error", | ||
// This is only for TypeScript which we don"t care about. | ||
"jsdoc/no-types": "off", | ||
"jsdoc/no-undefined-types": "error", | ||
"jsdoc/require-description": "error", | ||
// TODO(vapier): Turn this on. | ||
"jsdoc/require-description-complete-sentence": "off", | ||
// We don"t want to require examples. | ||
"jsdoc/require-example": "off", | ||
"jsdoc/require-file-overview": "error", | ||
"jsdoc/require-hyphen-before-param-description": ["error", "never"], | ||
"jsdoc/require-jsdoc": "error", | ||
"jsdoc/require-param": "error", | ||
"jsdoc/require-param-description": "error", | ||
"jsdoc/require-param-name": "error", | ||
"jsdoc/require-param-type": "error", | ||
"jsdoc/require-returns": "error", | ||
"jsdoc/require-returns-check": "error", | ||
"jsdoc/require-returns-description": "error", | ||
"jsdoc/require-returns-type": "error", | ||
"jsdoc/valid-types": "error" | ||
}, | ||
|
||
"settings": { | ||
// https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc | ||
"jsdoc": { | ||
"mode": "closure", | ||
"preferredTypes": { | ||
"object": "Object" | ||
}, | ||
"tagNamePreference": { | ||
// While not explicitly defined, Google/Chromium JS style guides only | ||
// use these keyword forms, as does the closure compiler docs. | ||
"augments": "extends", | ||
"constant": "const", | ||
"class": "constructor", | ||
"file": "fileoverview", | ||
"returns": "return", | ||
"yields": "yield" | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# GitHub actions workflow. | ||
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions | ||
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs | ||
|
||
name: Build+Lint+Test CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
node-version: [12.x, 14.x] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm install | ||
- run: npm run build --if-present | ||
- run: npm run lint | ||
- run: npm test | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/dist/ | ||
/.eslintcache | ||
/node_modules/ | ||
/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Copyright (c) 2020 The Chromium OS Authors. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
3. Neither the name of Google Inc. nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.