Skip to content

Commit

Permalink
fix: eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pattishin committed Dec 21, 2023
1 parent aaf638a commit 0129958
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"node/no-unpublished-import": ["off"],
"node/no-unpublished-require": ["off"],
"node/no-unsupported-features/es-syntax": ["off"]
},
"parserOptions": {
"sourceType": "module"
}
}
6 changes: 4 additions & 2 deletions run/markdown-preview/editor/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ export const buildRenderedHtml = async () => {
const dirname = process.cwd();

try {
markdownDefault = await fs.promises.readFile(dirname + '/templates/markdown.md');
markdownDefault = await fs.promises.readFile(
dirname + '/templates/markdown.md'
);
compiledTemplate = handlebars.compile(
await fs.promises.readFile(dirname + '/templates/index.html', 'utf8')
);
renderedHtml = compiledTemplate({default: markdownDefault});

return renderedHtml;
} catch (err) {
throw Error('Error loading template: ', err);
Expand Down
4 changes: 3 additions & 1 deletion run/markdown-preview/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
// limitations under the License.

import app from './app.js';
import pkg from './package.json' assert { type: "json" };
import fs from 'fs';

const pkg = JSON.parse(fs.readFileSync('./package.json'));

const PORT = parseInt(process.env.PORT) || 8080;

Expand Down
6 changes: 3 additions & 3 deletions run/markdown-preview/editor/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// [START cloudrun_secure_request]
// [START run_secure_request]

import { GoogleAuth } from 'google-auth-library';
import {GoogleAuth} from 'google-auth-library';
import got from 'got';

const auth = new GoogleAuth();
Expand All @@ -37,8 +37,8 @@ const renderRequest = async markdown => {
},
body: markdown,
timeout: {
request: 10000
}
request: 10000,
},
};

try {
Expand Down
5 changes: 1 addition & 4 deletions run/markdown-preview/editor/test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
// limitations under the License.

import assert from 'assert';
import path from 'path';
import supertest from 'supertest';
import {app, buildRenderedHtml} from '../app.js';

describe('Editor unit tests', () => {
describe('Initialize app', () => {
it('should successfully load the index page', async () => {
import { app } from path.join(__dirname, '..', 'app');
const request = supertest(app);
await request.get('/').retry(3).expect(200);
});
Expand All @@ -29,7 +28,6 @@ describe('Editor unit tests', () => {
let template;

before(async () => {
import { buildRenderedHtml } from path.join(__dirname, '..', 'app');
template = await buildRenderedHtml();
});

Expand All @@ -46,7 +44,6 @@ describe('Integration tests', () => {

before(async () => {
process.env.EDITOR_UPSTREAM_RENDER_URL = 'https://www.example.com/';
import { app } from path.join(__dirname, '..', 'app');
request = supertest(app);
});

Expand Down
4 changes: 2 additions & 2 deletions run/markdown-preview/editor/test/system.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import assert from 'assert';
import got from 'got';
import { execSync } from 'child_process';
import { GoogleAuth } from 'google-auth-library';
import {execSync} from 'child_process';
import {GoogleAuth} from 'google-auth-library';

const auth = new GoogleAuth();

Expand Down
4 changes: 3 additions & 1 deletion run/markdown-preview/renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
// limitations under the License.

import app from './app.js';
import pkg from './package.json' assert { type: "json" };
import fs from 'fs';

const pkg = JSON.parse(fs.readFileSync('./package.json'));

const PORT = parseInt(process.env.PORT) || 8080;

Expand Down
3 changes: 1 addition & 2 deletions run/markdown-preview/renderer/test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
// limitations under the License.

import assert from 'assert';
import path from 'path';
import sinon from 'sinon';
import supertest from 'supertest';
import {app} from '../app.js';

let request;

describe('Unit Tests', () => {
before(() => {
import app from path.join(__dirname, '..', 'app');
request = supertest(app);
});

Expand Down
4 changes: 2 additions & 2 deletions run/markdown-preview/renderer/test/system.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import assert from 'assert';
import got from 'got';
import { execSync } from 'child_process';
import { GoogleAuth } from 'google-auth-library';
import {execSync} from 'child_process';
import {GoogleAuth} from 'google-auth-library';

const auth = new GoogleAuth();

Expand Down

0 comments on commit 0129958

Please sign in to comment.