Skip to content

Commit 0129958

Browse files
committed
fix: eslint fixes
1 parent aaf638a commit 0129958

File tree

9 files changed

+22
-17
lines changed

9 files changed

+22
-17
lines changed

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
"node/no-unpublished-import": ["off"],
1111
"node/no-unpublished-require": ["off"],
1212
"node/no-unsupported-features/es-syntax": ["off"]
13+
},
14+
"parserOptions": {
15+
"sourceType": "module"
1316
}
1417
}

run/markdown-preview/editor/app.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ export const buildRenderedHtml = async () => {
2828
const dirname = process.cwd();
2929

3030
try {
31-
markdownDefault = await fs.promises.readFile(dirname + '/templates/markdown.md');
31+
markdownDefault = await fs.promises.readFile(
32+
dirname + '/templates/markdown.md'
33+
);
3234
compiledTemplate = handlebars.compile(
3335
await fs.promises.readFile(dirname + '/templates/index.html', 'utf8')
3436
);
3537
renderedHtml = compiledTemplate({default: markdownDefault});
36-
38+
3739
return renderedHtml;
3840
} catch (err) {
3941
throw Error('Error loading template: ', err);

run/markdown-preview/editor/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
// limitations under the License.
1414

1515
import app from './app.js';
16-
import pkg from './package.json' assert { type: "json" };
16+
import fs from 'fs';
17+
18+
const pkg = JSON.parse(fs.readFileSync('./package.json'));
1719

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

run/markdown-preview/editor/render.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// [START cloudrun_secure_request]
1616
// [START run_secure_request]
1717

18-
import { GoogleAuth } from 'google-auth-library';
18+
import {GoogleAuth} from 'google-auth-library';
1919
import got from 'got';
2020

2121
const auth = new GoogleAuth();
@@ -37,8 +37,8 @@ const renderRequest = async markdown => {
3737
},
3838
body: markdown,
3939
timeout: {
40-
request: 10000
41-
}
40+
request: 10000,
41+
},
4242
};
4343

4444
try {

run/markdown-preview/editor/test/app.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
// limitations under the License.
1414

1515
import assert from 'assert';
16-
import path from 'path';
1716
import supertest from 'supertest';
17+
import {app, buildRenderedHtml} from '../app.js';
1818

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

3130
before(async () => {
32-
import { buildRenderedHtml } from path.join(__dirname, '..', 'app');
3331
template = await buildRenderedHtml();
3432
});
3533

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

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

run/markdown-preview/editor/test/system.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
import assert from 'assert';
1616
import got from 'got';
17-
import { execSync } from 'child_process';
18-
import { GoogleAuth } from 'google-auth-library';
17+
import {execSync} from 'child_process';
18+
import {GoogleAuth} from 'google-auth-library';
1919

2020
const auth = new GoogleAuth();
2121

run/markdown-preview/renderer/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
// limitations under the License.
1414

1515
import app from './app.js';
16-
import pkg from './package.json' assert { type: "json" };
16+
import fs from 'fs';
17+
18+
const pkg = JSON.parse(fs.readFileSync('./package.json'));
1719

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

run/markdown-preview/renderer/test/app.test.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313
// limitations under the License.
1414

1515
import assert from 'assert';
16-
import path from 'path';
1716
import sinon from 'sinon';
1817
import supertest from 'supertest';
18+
import {app} from '../app.js';
1919

2020
let request;
2121

2222
describe('Unit Tests', () => {
2323
before(() => {
24-
import app from path.join(__dirname, '..', 'app');
2524
request = supertest(app);
2625
});
2726

run/markdown-preview/renderer/test/system.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
import assert from 'assert';
1616
import got from 'got';
17-
import { execSync } from 'child_process';
18-
import { GoogleAuth } from 'google-auth-library';
17+
import {execSync} from 'child_process';
18+
import {GoogleAuth} from 'google-auth-library';
1919

2020
const auth = new GoogleAuth();
2121

0 commit comments

Comments
 (0)