Skip to content

Commit dd4b8cc

Browse files
authored
Merge pull request #97 from docusign/feature/add-and-configure-linter
Add code analyzer
2 parents c3601bc + f02f4ea commit dd4b8cc

File tree

162 files changed

+6130
-2504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+6130
-2504
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
config/*
2+
public/*
3+
node_modules/*
4+
test/*

.eslintrc.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es2021": true
6+
},
7+
"overrides": [
8+
],
9+
"parserOptions": {
10+
"ecmaVersion": "latest"
11+
},
12+
"rules": {
13+
"arrow-spacing": [1, { "before": true, "after": true }],
14+
"block-spacing": [1, "always"],
15+
"brace-style": [1, "1tbs", { "allowSingleLine": true }],
16+
"comma-spacing": [1, { "before": false, "after": true }],
17+
"comma-style": [1, "last"],
18+
"dot-location": [1, "property"],
19+
"eol-last": 1,
20+
"eqeqeq": [1, "always", {"null": "ignore"}],
21+
"key-spacing": [1, { "beforeColon": false, "afterColon": true }],
22+
"no-cond-assign": 1,
23+
"no-const-assign": 1,
24+
"no-debugger": 1,
25+
"no-delete-var": 1,
26+
"no-dupe-args": 1,
27+
"no-dupe-class-members": 1,
28+
"no-dupe-keys": 1,
29+
"no-duplicate-case": 1,
30+
"no-empty-character-class": 1,
31+
"no-labels": 1,
32+
"no-ex-assign": 1,
33+
"no-extra-boolean-cast": 1,
34+
"no-extra-parens": [1, "functions"],
35+
"no-fallthrough": 1,
36+
"no-floating-decimal": 1,
37+
"no-func-assign": 1,
38+
"no-implied-eval": 1,
39+
"no-inner-declarations": [1, "functions"],
40+
"no-invalid-regexp": 1,
41+
"no-irregular-whitespace": 1,
42+
"no-label-var": 1,
43+
"no-lone-blocks": 1,
44+
"no-mixed-spaces-and-tabs": 1,
45+
"no-multi-spaces": 1,
46+
"no-multi-str": 1,
47+
"no-multiple-empty-lines": [1, { "max": 2 }],
48+
"no-native-reassign": 1,
49+
"no-negated-in-lhs": 1,
50+
"no-new": 1,
51+
"no-new-func": 1,
52+
"no-new-require": 1,
53+
"no-new-wrappers": 1,
54+
"no-obj-calls": 1,
55+
"no-octal": 1,
56+
"no-octal-escape": 1,
57+
"no-return-assign": 1,
58+
"no-self-compare": 1,
59+
"no-sequences": 1,
60+
"no-shadow-restricted-names": 1,
61+
"no-spaced-func": 1,
62+
"no-sparse-arrays": 1,
63+
"no-throw-literal": 1,
64+
"no-trailing-spaces": 1,
65+
"no-undef-init": 1,
66+
"no-unexpected-multiline": 1,
67+
"no-unneeded-ternary": [1, { "defaultAssignment": false }],
68+
"no-unreachable": 1,
69+
"no-useless-call": 1,
70+
"no-with": 1,
71+
"one-var": [1, { "initialized": "never" }],
72+
"quotes": [1, "single", "avoid-escape"],
73+
"quote-props": [1, "as-needed"],
74+
"semi": [1, "always"],
75+
"semi-spacing": [1, { "before": false, "after": false }],
76+
"keyword-spacing": [1, { "before": true, "after": true }],
77+
"space-before-function-paren": [1, {
78+
"anonymous": "never",
79+
"named": "never",
80+
"asyncArrow": "always"
81+
}],
82+
"space-in-parens": [1, "never"],
83+
"space-infix-ops": 1,
84+
"space-unary-ops": [1, { "words": true, "nonwords": false }],
85+
"yoda": [1, "never"]
86+
}
87+
}

.github/workflows/node.js.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
npm cache clean --force
3232
npm cache verify
3333
npm install
34+
35+
- name: Run linter
36+
run: npm run lint
3437

3538
- name: Run build
3639
run: npm run build --if-present

embeddedSigning.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* @author DocuSign
55
*/
66

7-
const fs = require("fs-extra");
8-
const docusign = require("docusign-esign");
7+
const fs = require('fs-extra');
8+
const docusign = require('docusign-esign');
99

1010
/**
1111
* This function does the work of creating the envelope and the
@@ -21,9 +21,9 @@ const sendEnvelopeForEmbeddedSigning = async (args) => {
2121
//ds-snippet-start:eSign1Step3
2222
let dsApiClient = new docusign.ApiClient();
2323
dsApiClient.setBasePath(args.basePath);
24-
dsApiClient.addDefaultHeader("Authorization", "Bearer " + args.accessToken);
25-
let envelopesApi = new docusign.EnvelopesApi(dsApiClient),
26-
results = null;
24+
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
25+
let envelopesApi = new docusign.EnvelopesApi(dsApiClient);
26+
let results = null;
2727

2828
// Step 1. Make the envelope request body
2929
let envelope = makeEnvelope(args.envelopeArgs);
@@ -65,7 +65,7 @@ function makeEnvelope(args) {
6565
// args.signerEmail
6666
// args.signerName
6767
// args.signerClientId
68-
// docFile
68+
// docFile
6969

7070
// document 1 (pdf) has tag /sn1/
7171
//
@@ -79,15 +79,15 @@ function makeEnvelope(args) {
7979

8080
// create the envelope definition
8181
let env = new docusign.EnvelopeDefinition();
82-
env.emailSubject = "Please sign this document";
82+
env.emailSubject = 'Please sign this document';
8383

8484
// add the documents
85-
let doc1 = new docusign.Document(),
86-
doc1b64 = Buffer.from(docPdfBytes).toString("base64");
85+
let doc1 = new docusign.Document();
86+
let doc1b64 = Buffer.from(docPdfBytes).toString('base64');
8787
doc1.documentBase64 = doc1b64;
88-
doc1.name = "Lorem Ipsum"; // can be different from actual file name
89-
doc1.fileExtension = "pdf";
90-
doc1.documentId = "3";
88+
doc1.name = 'Lorem Ipsum'; // can be different from actual file name
89+
doc1.fileExtension = 'pdf';
90+
doc1.documentId = '3';
9191

9292
// The order in the docs array determines the order in the envelope
9393
env.documents = [doc1];
@@ -108,10 +108,10 @@ function makeEnvelope(args) {
108108
// The DocuSign platform seaches throughout your envelope's
109109
// documents for matching anchor strings.
110110
let signHere1 = docusign.SignHere.constructFromObject({
111-
anchorString: "/sn1/",
112-
anchorYOffset: "10",
113-
anchorUnits: "pixels",
114-
anchorXOffset: "20",
111+
anchorString: '/sn1/',
112+
anchorYOffset: '10',
113+
anchorUnits: 'pixels',
114+
anchorXOffset: '20',
115115
});
116116
// Tabs are set per recipient / signer
117117
let signer1Tabs = docusign.Tabs.constructFromObject({
@@ -127,7 +127,7 @@ function makeEnvelope(args) {
127127

128128
// Request that the envelope be sent by setting |status| to "sent".
129129
// To request that the envelope be created as a draft, set to "created"
130-
env.status = "sent";
130+
env.status = 'sent';
131131

132132
return env;
133133
}
@@ -151,12 +151,12 @@ function makeRecipientViewRequest(args) {
151151
// the DocuSign signing. It's usually better to use
152152
// the session mechanism of your web framework. Query parameters
153153
// can be changed/spoofed very easily.
154-
viewRequest.returnUrl = args.dsReturnUrl + "?state=123";
154+
viewRequest.returnUrl = args.dsReturnUrl + '?state=123';
155155

156156
// How has your app authenticated the user? In addition to your app's
157157
// authentication, you can include authenticate steps from DocuSign.
158158
// Eg, SMS authentication
159-
viewRequest.authenticationMethod = "none";
159+
viewRequest.authenticationMethod = 'none';
160160

161161
// Recipient information must match embedded recipient info
162162
// we used to create the envelope.

0 commit comments

Comments
 (0)