Skip to content

Commit ae9aa44

Browse files
fix: quotes should be single
1 parent c80e915 commit ae9aa44

File tree

4 files changed

+159
-91
lines changed

4 files changed

+159
-91
lines changed

core/commons-api/test/errors.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
getUnauthorized,
1212
getForbidden,
1313
getServiceUnavailable,
14-
getCode,
14+
getCode
1515
} from '../src/index';
1616

1717
describe('testing errors', () => {

core/file-locking/src/__tests__/lock.spec.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import path from "path";
2-
import fs from "fs";
1+
import path from 'path';
2+
import fs from 'fs';
33

4-
import { lockFile, unlockFile, readFile } from "../index";
4+
import { lockFile, unlockFile, readFile } from '../index';
55

66
interface Error {
77
message: string;
@@ -18,45 +18,45 @@ const removeTempFile = (filename: string): void => {
1818
});
1919
};
2020

21-
describe("testing locking", () => {
22-
test("file should be found to be locked", done => {
23-
lockFile(getFilePath("package.json"), (error: Error) => {
21+
describe('testing locking', () => {
22+
test('file should be found to be locked', done => {
23+
lockFile(getFilePath('package.json'), (error: Error) => {
2424
expect(error).toBeNull();
25-
removeTempFile("package.json.lock");
25+
removeTempFile('package.json.lock');
2626
done();
2727
});
2828
});
2929

30-
test("file should fail to be found to be locked", done => {
31-
lockFile(getFilePath("package.fail.json"), (error: Error) => {
30+
test('file should fail to be found to be locked', done => {
31+
lockFile(getFilePath('package.fail.json'), (error: Error) => {
3232
expect(error.message).toMatch(
3333
/ENOENT: no such file or directory, stat '(.*)package.fail.json'/
3434
);
3535
done();
3636
});
3737
});
3838

39-
test("file should to be found to be unLock", done => {
40-
unlockFile(getFilePath("package.json.lock"), (error: Error) => {
39+
test('file should to be found to be unLock', done => {
40+
unlockFile(getFilePath('package.json.lock'), (error: Error) => {
4141
expect(error).toBeNull();
4242
done();
4343
});
4444
});
4545

46-
test("read file with no options should to be found to be read it as string", done => {
47-
readFile(getFilePath("package.json"), (error: Error, data: any) => {
46+
test('read file with no options should to be found to be read it as string', done => {
47+
readFile(getFilePath('package.json'), (error: Error, data: any) => {
4848
expect(error).toBeNull();
4949
expect(data).toMatchSnapshot();
5050
done();
5151
});
5252
});
5353

54-
test("read file with no options should to be found to be read it as object", done => {
54+
test('read file with no options should to be found to be read it as object', done => {
5555
const options = {
5656
parse: true
5757
};
5858
readFile(
59-
getFilePath("package.json"),
59+
getFilePath('package.json'),
6060
options,
6161
(error: Error, data: any) => {
6262
expect(error).toBeNull();
@@ -66,61 +66,61 @@ describe("testing locking", () => {
6666
);
6767
});
6868

69-
test("read file with options (parse) should to be not found to be read it", done => {
69+
test('read file with options (parse) should to be not found to be read it', done => {
7070
const options = {
7171
parse: true
7272
};
73-
readFile(getFilePath("package.fail.json"), options, (error: Error) => {
73+
readFile(getFilePath('package.fail.json'), options, (error: Error) => {
7474
expect(error.message).toMatch(
7575
/ENOENT: no such file or directory, open '(.*)package.fail.json'/
7676
);
7777
done();
7878
});
7979
});
8080

81-
test("read file with options should to be found to be read it and fails to be parsed", done => {
81+
test('read file with options should to be found to be read it and fails to be parsed', done => {
8282
const options = {
8383
parse: true
8484
};
8585
const errorMessage =
86-
process.platform === "win32"
87-
? "Unexpected token } in JSON at position 47"
88-
: "Unexpected token } in JSON at position 44";
89-
readFile(getFilePath("wrong.package.json"), options, (error: Error) => {
86+
process.platform === 'win32'
87+
? 'Unexpected token } in JSON at position 47'
88+
: 'Unexpected token } in JSON at position 44';
89+
readFile(getFilePath('wrong.package.json'), options, (error: Error) => {
9090
expect(error.message).toEqual(errorMessage);
9191
done();
9292
});
9393
});
9494

95-
test("read file with options (parse, lock) should to be found to be read it as object", done => {
95+
test('read file with options (parse, lock) should to be found to be read it as object', done => {
9696
const options = {
9797
parse: true,
9898
lock: true
9999
};
100100
readFile(
101-
getFilePath("package2.json"),
101+
getFilePath('package2.json'),
102102
options,
103103
(error: Error, data: any) => {
104104
expect(error).toBeNull();
105105
expect(data).toMatchSnapshot();
106-
removeTempFile("package2.json.lock");
106+
removeTempFile('package2.json.lock');
107107
done();
108108
}
109109
);
110110
});
111111

112-
test("read file with options (parse, lock) should to be found to be read it and fails to be parsed", done => {
112+
test('read file with options (parse, lock) should to be found to be read it and fails to be parsed', done => {
113113
const options = {
114114
parse: true,
115115
lock: true
116116
};
117117
const errorMessage =
118-
process.platform === "win32"
119-
? "Unexpected token } in JSON at position 47"
120-
: "Unexpected token } in JSON at position 44";
121-
readFile(getFilePath("wrong.package.json"), options, (error: Error) => {
118+
process.platform === 'win32'
119+
? 'Unexpected token } in JSON at position 47'
120+
: 'Unexpected token } in JSON at position 44';
121+
readFile(getFilePath('wrong.package.json'), options, (error: Error) => {
122122
expect(error.message).toEqual(errorMessage);
123-
removeTempFile("wrong.package.json.lock");
123+
removeTempFile('wrong.package.json.lock');
124124
done();
125125
});
126126
});

core/file-locking/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import locker from "lockfile";
2-
import fs from "fs";
3-
import path from "path";
1+
import locker from 'lockfile';
2+
import fs from 'fs';
3+
import path from 'path';
44

5-
import { Callback } from "@verdaccio/types";
5+
import { Callback } from '@verdaccio/types';
66

77
// locks a file by creating a lock file
88
const lockFile = function(name: string, callback: Callback): void {
@@ -98,7 +98,7 @@ function readFile(
9898
options: any = {},
9999
callback: any = (): void => {}
100100
): void {
101-
if (typeof options === "function") {
101+
if (typeof options === 'function') {
102102
callback = options;
103103
options = {};
104104
}
@@ -123,7 +123,7 @@ function readFile(
123123

124124
const read = function(): Promise<any> {
125125
return new Promise<any>((resolve, reject): void => {
126-
fs.readFile(name, "utf8", function(err, contents) {
126+
fs.readFile(name, 'utf8', function(err, contents) {
127127
if (err) {
128128
return reject(err);
129129
}

0 commit comments

Comments
 (0)