Skip to content

Commit 771bbca

Browse files
committed
Formatting
1 parent 01b5f87 commit 771bbca

File tree

14 files changed

+5009
-106
lines changed

14 files changed

+5009
-106
lines changed

Diff for: .eslintrc

-15
This file was deleted.

Diff for: .eslintrc.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"root": true,
3+
"parser": "@babel/eslint-parser",
4+
"plugins": ["html", "prettier", "googleappsscript"],
5+
"extends": [
6+
"airbnb-base",
7+
"eslint:recommended",
8+
"plugin:prettier/recommended",
9+
"plugin:import/errors",
10+
"plugin:import/warnings"
11+
],
12+
"parserOptions": {
13+
"ecmaVersion": 6,
14+
"sourceType": "module"
15+
},
16+
"env": {
17+
"browser": true,
18+
"es6": true,
19+
"node": true,
20+
"googleappsscript/googleappsscript": true
21+
},
22+
"ignorePatterns": ["node_modules/"],
23+
"rules": {
24+
"no-continue": "off",
25+
"no-console": "warn",
26+
"no-underscore-dangle": "off",
27+
"import/prefer-default-export": "off",
28+
"import/no-extraneous-dependencies": "warn",
29+
"camelcase": "warn",
30+
"prettier/prettier": [
31+
"error",
32+
{
33+
"trailingComma": "es5",
34+
"singleQuote": true,
35+
"printWidth": 120,
36+
"endOfLine": "auto"
37+
}
38+
],
39+
"no-unused-vars": [
40+
1,
41+
{
42+
"ignoreRestSiblings": true,
43+
"argsIgnorePattern": "res|next|^err|^ignore|^_",
44+
"caughtErrors": "none"
45+
}
46+
]
47+
},
48+
"globals": {
49+
"OAuth2": true
50+
}
51+
}

Diff for: .github/FUNDING.yml

-12
This file was deleted.

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
dist

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Amit Agarwal
3+
Copyright (c) 2024 Amit Agarwal
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Diff for: babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [['@babel/preset-env', { targets: { node: 16 } }]],
3+
};

Diff for: google-apps-script/core-vitals/index.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ const fetchPage = (url, strategy) => {
6666
muteHttpExceptions: true,
6767
});
6868
}
69-
const { error, loadingExperience: { metrics = null } = {}, lighthouseResult: { audits = null } = {} } = JSON.parse(
70-
response.getContentText()
71-
);
69+
const {
70+
error,
71+
loadingExperience: { metrics = null } = {},
72+
lighthouseResult: { audits = null } = {},
73+
} = JSON.parse(response.getContentText());
7274
if (!error) return parseResponse(metrics, audits, strategy);
7375
} catch (f) {
7476
// do nothing
@@ -78,7 +80,8 @@ const fetchPage = (url, strategy) => {
7880

7981
const writeDataToSheet = (name, data) => {
8082
const ss = SpreadsheetApp.getActiveSpreadsheet();
81-
const sheet = ss.getSheetByName(name) || ss.insertSheet(name, 1, { template: ss.getSheetByName('template') }).showSheet();
83+
const sheet =
84+
ss.getSheetByName(name) || ss.insertSheet(name, 1, { template: ss.getSheetByName('template') }).showSheet();
8285
const vitals = sheet
8386
.getRange(2, 1, sheet.getLastRow() - 1, 1)
8487
.getValues()

Diff for: google-apps-script/drive-lock/code.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
44
* Web: https://digitalinspiration.com/
55
* MIT License
6-
**/
6+
* */
77

88
const makeFileReadyOnly = () => {
9-
const fileUrl = "https://docs.google.com/document/d/.....";
10-
const [fileId] = fileUrl.split("/").filter((e) => /[_-\w]{25,}/.test(e));
9+
const fileUrl = 'https://docs.google.com/document/d/.....';
10+
const [fileId] = fileUrl.split('/').filter((e) => /[_-\w]{25,}/.test(e));
1111
UrlFetchApp.fetch(`https://www.googleapis.com/drive/v3/files/${fileId}?supportsAllDrives=true`, {
12-
method: "PATCH",
13-
contentType: "application/json",
12+
method: 'PATCH',
13+
contentType: 'application/json',
1414
headers: {
1515
Authorization: `Bearer ${ScriptApp.getOAuthToken()}`,
1616
},
1717
payload: JSON.stringify({
1818
contentRestrictions: [
1919
{
2020
readOnly: true,
21-
reason: "Prevent accidental editing",
21+
reason: 'Prevent accidental editing',
2222
},
2323
],
2424
}),

Diff for: google-apps-script/factory-reset-gmail/code.js

+29-31
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
11
/**
2-
*
3-
*
2+
*
3+
*
44
* This Google Script will delete everything in your Gmail account.
55
* It removes email messages, filters, labels and reset all your settings
6-
*
6+
*
77
* Written by Amit Agarwal ([email protected])
8-
9-
10-
88
11-
88
12-
88
13-
,adPPYb,88 ,adPPYYba, 8b,dPPYba, ,adPPYb,d8 ,adPPYba, 8b,dPPYba,
14-
a8" `Y88 "" `Y8 88P' `"8a a8" `Y88 a8P_____88 88P' "Y8
15-
8b 88 ,adPPPPP88 88 88 8b 88 8PP""""""" 88
16-
"8a, ,d88 88, ,88 88 88 "8a, ,d88 "8b, ,aa 88
17-
`"8bbdP"Y8 `"8bbdP"Y8 88 88 `"YbbdP"Y8 `"Ybbd8"' 88
18-
aa, ,88
19-
"Y8bbdP"
20-
21-
8+
9+
10+
88
11+
88
12+
88
13+
,adPPYb,88 ,adPPYYba, 8b,dPPYba, ,adPPYb,d8 ,adPPYba, 8b,dPPYba,
14+
a8" `Y88 "" `Y8 88P' `"8a a8" `Y88 a8P_____88 88P' "Y8
15+
8b 88 ,adPPPPP88 88 88 8b 88 8PP""""""" 88
16+
"8a, ,d88 88, ,88 88 88 "8a, ,d88 "8b, ,aa 88
17+
`"8bbdP"Y8 `"8bbdP"Y8 88 88 `"YbbdP"Y8 `"Ybbd8"' 88
18+
aa, ,88
19+
"Y8bbdP"
20+
21+
2222
* Proceed with great caution since the process is irreversible
23-
*
24-
* This software comes with ABSOLUTELY NO WARRANTY.
25-
* This is free software, and you are welcome to modify and redistribute it
23+
*
24+
* This software comes with ABSOLUTELY NO WARRANTY.
25+
* This is free software, and you are welcome to modify and redistribute it
2626
*
2727
* This permission notice shall be included in all copies of the Software.
2828
*
2929
*
3030
*/
3131

32-
3332
/**
3433
* Remove all labels in Gmail
3534
*/
36-
const deleteGmailLabels_ = () => {
35+
const deleteGmailLabels_ = () => {
3736
GmailApp.getUserLabels().forEach((label) => {
3837
label.deleteLabel();
3938
});
@@ -42,7 +41,7 @@ const deleteGmailLabels_ = () => {
4241
/**
4342
* Remove all Gmail Filters
4443
*/
45-
const deleteGmailFilters_ = () => {
44+
const deleteGmailFilters_ = () => {
4645
const { filter: gmailFilters } = Gmail.Users.Settings.Filters.list('me');
4746
gmailFilters.forEach(({ id }) => {
4847
Gmail.Users.Settings.Filters.remove('me', id);
@@ -52,7 +51,7 @@ const deleteGmailFilters_ = () => {
5251
/**
5352
* Remove all Gmail Draft messages
5453
*/
55-
const deleteGmailDrafts_ = () => {
54+
const deleteGmailDrafts_ = () => {
5655
GmailApp.getDrafts().forEach((draft) => {
5756
draft.deleteDraft();
5857
});
@@ -61,7 +60,7 @@ const deleteGmailDrafts_ = () => {
6160
/**
6261
* Reset Gmail Settings
6362
*/
64-
const resetGmailSettings_ = () => {
63+
const resetGmailSettings_ = () => {
6564
// Disable Out-of-office
6665
Gmail.Users.Settings.updateVacation({ enableAutoReply: false }, 'me');
6766

@@ -85,7 +84,7 @@ const resetGmailSettings_ = () => {
8584
};
8685

8786
const startTime = Date.now();
88-
const isTimeLeft_ = () => {
87+
const isTimeLeft_ = () => {
8988
const ONE_SECOND = 1000;
9089
const MAX_EXECUTION_TIME = ONE_SECOND * 60 * 5;
9190
return MAX_EXECUTION_TIME > Date.now() - startTime;
@@ -94,7 +93,7 @@ const isTimeLeft_ = () => {
9493
/**
9594
* Move all Gmail threads to trash folder
9695
*/
97-
const deleteGmailThreads_ = () => {
96+
const deleteGmailThreads_ = () => {
9897
let threads = [];
9998
do {
10099
threads = GmailApp.search('in:all', 0, 100);
@@ -108,7 +107,7 @@ const deleteGmailThreads_ = () => {
108107
/**
109108
* Move all Spam email messages to the Gmail Recyle bin
110109
*/
111-
const deleteSpamEmails_ = () => {
110+
const deleteSpamEmails_ = () => {
112111
let threads = [];
113112
do {
114113
threads = GmailApp.getSpamThreads(0, 10);
@@ -122,7 +121,7 @@ const deleteSpamEmails_ = () => {
122121
/**
123122
* Permanetly empty the Trash folder
124123
*/
125-
const emptyGmailTrash_ = () => {
124+
const emptyGmailTrash_ = () => {
126125
let threads = [];
127126
do {
128127
threads = GmailApp.getTrashThreads(0, 100);
@@ -136,7 +135,7 @@ const emptyGmailTrash_ = () => {
136135
* Factory Reset your Gmail Account
137136
* Replace NO with YES and run this function
138137
* */
139-
const factoryResetGmail = () => {
138+
const factoryResetGmail = () => {
140139
const FACTORY_RESET = 'NO';
141140
if (FACTORY_RESET === 'YES') {
142141
resetGmailSettings_();
@@ -148,4 +147,3 @@ const factoryResetGmail = () => {
148147
emptyGmailTrash_();
149148
}
150149
};
151-

0 commit comments

Comments
 (0)