Skip to content

Commit

Permalink
Enable lint workflow + delint existing files
Browse files Browse the repository at this point in the history
  • Loading branch information
sqrrrl committed Apr 25, 2022
1 parent 18671b9 commit b6b199f
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 36 deletions.
17 changes: 9 additions & 8 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Summary

TODO

## Expected Behavior

Sample URL:
Description:

## Actual Behavior


## Steps to Reproduce the Problem

1.
1.
1.

## Specifications

- Node version (`node -v`)
- OS (Mac/Linux/Windows)
1.
1.
1.
25 changes: 25 additions & 0 deletions .github/linters/.htmlhintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"tagname-lowercase": true,
"attr-lowercase": true,
"attr-value-double-quotes": true,
"attr-value-not-empty": false,
"attr-no-duplication": true,
"doctype-first": false,
"tag-pair": true,
"tag-self-close": false,
"spec-char-escape": false,
"id-unique": true,
"src-not-empty": true,
"title-require": false,
"alt-require": true,
"doctype-html5": true,
"id-class-value": false,
"style-disabled": false,
"inline-style-disabled": false,
"inline-script-disabled": false,
"space-tab-mixed-disabled": "space",
"id-class-ad-disabled": false,
"href-abs-or-rel": false,
"attr-unsafe-chars": true,
"head-script-disabled": false
}
45 changes: 45 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
name: Lint
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
lint:
concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: github/super-linter/[email protected]
env:
ERROR_ON_MISSING_EXEC_BIT: true
VALIDATE_JSCPD: false
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install
- run: npm run lint
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement
(CLA).

* If you are an individual writing original source code and you're sure you
own the intellectual property, then you'll need to sign an
[individual CLA](https://developers.google.com/open-source/cla/individual).
* If you work for a company that wants to allow you to contribute your work,
then you'll need to sign a
[corporate CLA](https://developers.google.com/open-source/cla/corporate).
* If you are an individual writing original source code and you're sure you
own the intellectual property, then you'll need to sign an
[individual CLA](https://developers.google.com/open-source/cla/individual).
* If you work for a company that wants to allow you to contribute your work,
then you'll need to sign a
[corporate CLA](https://developers.google.com/open-source/cla/corporate).

Follow either of the two links above to access the appropriate CLA and
instructions for how to sign and return it. Once we receive it, we'll be able to
accept your pull requests.

## Contributing A Patch

1. Submit an issue describing your proposed change to the repo in question.
1. The repo owner will respond to your issue promptly.
1. Submit an issue describing your proposed change to the repository in question.
1. The repository owner will respond to your issue promptly.
1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above).
1. Fork the desired repo, develop and test your code changes.
1. Fork the desired repository, develop and test your code changes.
1. Ensure that your code adheres to the existing style in the sample to which you are contributing.
1. Ensure that your code has an appropriate set of unit tests which all pass.
1. Submit a pull request!
Expand Down
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# Google Workspace Node Samples [![Build Status](https://travis-ci.org/googleworkspace/node-samples.svg?branch=master)](https://travis-ci.org/googleworkspace/node-samples)
# Google Workspace Node.js Samples [![Build Status](https://travis-ci.org/googleworkspace/node-samples.svg?branch=master)](https://travis-ci.org/googleworkspace/node-samples)

Node.js samples for [Google Workspace APIs](https://developers.google.com/workspace/) docs.

| | **Apps&nbsp;Script** <img src="https://www.gstatic.com/images/branding/product/2x/apps_script_96dp.png" align="center" width="76px"/> | **Calendar** <img src="https://www.gstatic.com/images/branding/product/2x/calendar_96dp.png" align="left" width="96px"/> | **Classroom** <img src="https://www.gstatic.com/images/branding/product/2x/classroom_96dp.png" align="left" width="96px"/> | **Drive V3** <img src="https://www.gstatic.com/images/branding/product/2x/drive_96dp.png" align="left" width="96px"/> | **Gmail** <img src="https://www.gstatic.com/images/branding/product/2x/gmail_96dp.png" align="left" width="96px"/> | **Sheets** <img src="https://www.gstatic.com/images/branding/product/2x/sheets_96dp.png" align="left" width="96px"/> | **Slides** <img src="https://www.gstatic.com/images/branding/product/2x/slides_96dp.png" align="left" width="96px"/> | **Tasks** <img src="https://www.gstatic.com/images/branding/product/2x/tasks_96dp.png" align="left" width="96px"/> |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Quickstart | [Link](https://developers.google.com/apps-script/api/quickstart/nodejs) | [Link](https://developers.google.com/google-apps/calendar/quickstart/nodejs) | [Link](https://developers.google.com/classroom/quickstart/nodejs) | [Link](https://developers.google.com/drive/v3/web/quickstart/nodejs) | [Link](https://developers.google.com/gmail/api/quickstart/nodejs) | [Link](https://developers.google.com/sheets/api/quickstart/nodejs) | [Link](https://developers.google.com/slides/quickstart/nodejs) | [Link](https://developers.google.com/tasks/quickstart/nodejs) |
| Snippets | --- | [Link](https://developers.google.com/calendar/overview) | [Link](https://developers.google.com/classroom/guides/get-started) | [Link](https://developers.google.com/drive/v3/web/about-sdk) | [Link](https://developers.google.com/gmail/api/guides/) | [Link](https://developers.google.com/sheets/api/guides/concepts) | [Link](https://developers.google.com/slides/how-tos/overview) | --- |
| Quickstart| Snippets
---| ---| ---
**Apps&nbsp;Script** <img src="https://www.gstatic.com/images/branding/product/2x/apps_script_96dp.png" align="center" width="76px"/> | [Link](https://developers.google.com/apps-script/api/quickstart/nodejs) | ---
**Calendar** <img src="https://www.gstatic.com/images/branding/product/2x/calendar_96dp.png" align="left" width="96px"/> | [Link](https://developers.google.com/google-apps/calendar/quickstart/nodejs) | [Link](https://developers.google.com/calendar/overview)
**Classroom** <img src="https://www.gstatic.com/images/branding/product/2x/classroom_96dp.png" align="left" width="96px"/> | [Link](https://developers.google.com/classroom/quickstart/nodejs) | [Link](https://developers.google.com/classroom/guides/get-started)
**Drive V3** <img src="https://www.gstatic.com/images/branding/product/2x/drive_96dp.png" align="left" width="96px"/> | [Link](https://developers.google.com/drive/v3/web/quickstart/nodejs) | [Link](https://developers.google.com/drive/v3/web/about-sdk)
**Gmail** <img src="https://www.gstatic.com/images/branding/product/2x/gmail_96dp.png" align="left" width="96px"/> | [Link](https://developers.google.com/gmail/api/quickstart/nodejs) | [Link](https://developers.google.com/gmail/api/guides/)
**Sheets** <img src="https://www.gstatic.com/images/branding/product/2x/sheets_96dp.png" align="left" width="96px"/> | [Link](https://developers.google.com/sheets/api/quickstart/nodejs) | [Link](https://developers.google.com/sheets/api/guides/concepts)
**Slides** <img src="https://www.gstatic.com/images/branding/product/2x/slides_96dp.png" align="left" width="96px"/> | [Link](https://developers.google.com/slides/quickstart/nodejs) | [Link](https://developers.google.com/slides/how-tos/overview)
**Tasks** <img src="https://www.gstatic.com/images/branding/product/2x/tasks_96dp.png" align="left" width="96px"/> | [Link](https://developers.google.com/tasks/quickstart/nodejs) | ---

## Sample Types

#### Quickstarts
### Quickstarts

In about **five minutes**, you'll have a simple Node command-line application that makes requests to a Google Workspace API.
In about **five minutes**, you'll have a simple Node.js command-line application that makes requests to a Google Workspace API.

#### Guides
### Guides

Learn how to use functions within an API, such as creating a new Google Slide to adding values to a Google Spreadsheet.

Expand Down Expand Up @@ -50,15 +56,15 @@ In any snippet directory, `npm run test`.

### Lint

Install and run eslint. Example:
Install and run ESLint. Example:

```
```shell
npm run lint apps-script/**/*.js
```

Some IDEs (like VS Code) will detect these lint errors within the editor.

## Node Client Library
## Node.js Client Library

Google Workspace APIs use the [Google API Node.js client library](https://github.com/google/google-api-nodejs-client).

Expand Down
2 changes: 1 addition & 1 deletion drive/snippets/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Google Drive Node.js Snippets

Javascript snippets from the [Google Drive V3 API Guide](https://developers.google.com/drive/v3/web/).
JavaScript snippets from the [Google Drive V3 API Guide](https://developers.google.com/drive/v3/web/).

## Install

Expand Down
4 changes: 3 additions & 1 deletion drive/snippets/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

set -e
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/../../application_credentials.json";
GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/../../application_credentials.json";
export GOOGLE_APPLICATION_CREDENTIALS
mocha --timeout 60000;
2 changes: 1 addition & 1 deletion forms/snippets/delete_watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ if (module === require.main) {
runSample().catch(console.error);
}
module.exports = runSample;
# [END forms_delete_watch]
// [END forms_delete_watch]
2 changes: 1 addition & 1 deletion sheets/snippets/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Google Sheets Node.js Snippets

Javascript snippets from the [Google Sheets API Guide](https://developers.google.com/sheets/api/guides/concepts).
JavaScript snippets from the [Google Sheets API Guide](https://developers.google.com/sheets/api/guides/concepts).

## Install

Expand Down
4 changes: 3 additions & 1 deletion sheets/snippets/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/../../application_credentials.json";

GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/../../application_credentials.json";
export GOOGLE_APPLICATION_CREDENTIALS
mocha --timeout 60000;
2 changes: 1 addition & 1 deletion slides/quickstart/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Google Slides Node Quickstart
# Google Slides Node.js Quickstart

Complete the steps described in the [quickstart instructions](
https://developers.google.com/slides/quickstart/nodejs), and in about five
Expand Down
2 changes: 1 addition & 1 deletion slides/snippets/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Google Slides Node.js Snippets

Javascript snippets from the [Google Slides API Guide](https://developers.google.com/slides/how-tos/overview).
JavaScript snippets from the [Google Slides API Guide](https://developers.google.com/slides/how-tos/overview).

## Install

Expand Down
4 changes: 3 additions & 1 deletion slides/snippets/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/../../application_credentials.json";

GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/../../application_credentials.json";
export GOOGLE_APPLICATION_CREDENTIALS
mocha --timeout 60000;

0 comments on commit b6b199f

Please sign in to comment.