Skip to content

Commit 5e677f7

Browse files
fix: fixed lint errors
1 parent ae9aa44 commit 5e677f7

File tree

31 files changed

+167
-214
lines changed

31 files changed

+167
-214
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: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ describe('testing locking', () => {
2929

3030
test('file should fail to be found to be locked', done => {
3131
lockFile(getFilePath('package.fail.json'), (error: Error) => {
32-
expect(error.message).toMatch(
33-
/ENOENT: no such file or directory, stat '(.*)package.fail.json'/
34-
);
32+
expect(error.message).toMatch(/ENOENT: no such file or directory, stat '(.*)package.fail.json'/);
3533
done();
3634
});
3735
});
@@ -53,34 +51,28 @@ describe('testing locking', () => {
5351

5452
test('read file with no options should to be found to be read it as object', done => {
5553
const options = {
56-
parse: true
54+
parse: true,
5755
};
58-
readFile(
59-
getFilePath('package.json'),
60-
options,
61-
(error: Error, data: any) => {
62-
expect(error).toBeNull();
63-
expect(data).toMatchSnapshot();
64-
done();
65-
}
66-
);
56+
readFile(getFilePath('package.json'), options, (error: Error, data: any) => {
57+
expect(error).toBeNull();
58+
expect(data).toMatchSnapshot();
59+
done();
60+
});
6761
});
6862

6963
test('read file with options (parse) should to be not found to be read it', done => {
7064
const options = {
71-
parse: true
65+
parse: true,
7266
};
7367
readFile(getFilePath('package.fail.json'), options, (error: Error) => {
74-
expect(error.message).toMatch(
75-
/ENOENT: no such file or directory, open '(.*)package.fail.json'/
76-
);
68+
expect(error.message).toMatch(/ENOENT: no such file or directory, open '(.*)package.fail.json'/);
7769
done();
7870
});
7971
});
8072

8173
test('read file with options should to be found to be read it and fails to be parsed', done => {
8274
const options = {
83-
parse: true
75+
parse: true,
8476
};
8577
const errorMessage =
8678
process.platform === 'win32'
@@ -95,24 +87,20 @@ describe('testing locking', () => {
9587
test('read file with options (parse, lock) should to be found to be read it as object', done => {
9688
const options = {
9789
parse: true,
98-
lock: true
90+
lock: true,
9991
};
100-
readFile(
101-
getFilePath('package2.json'),
102-
options,
103-
(error: Error, data: any) => {
104-
expect(error).toBeNull();
105-
expect(data).toMatchSnapshot();
106-
removeTempFile('package2.json.lock');
107-
done();
108-
}
109-
);
92+
readFile(getFilePath('package2.json'), options, (error: Error, data: any) => {
93+
expect(error).toBeNull();
94+
expect(data).toMatchSnapshot();
95+
removeTempFile('package2.json.lock');
96+
done();
97+
});
11098
});
11199

112100
test('read file with options (parse, lock) should to be found to be read it and fails to be parsed', done => {
113101
const options = {
114102
parse: true,
115-
lock: true
103+
lock: true,
116104
};
117105
const errorMessage =
118106
process.platform === 'win32'

core/file-locking/src/index.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import locker from 'lockfile';
21
import fs from 'fs';
32
import path from 'path';
43

4+
import locker from 'lockfile';
55
import { Callback } from '@verdaccio/types';
66

77
// locks a file by creating a lock file
@@ -49,7 +49,7 @@ const lockFile = function(name: string, callback: Callback): void {
4949
// number of times to attempt to create a lock
5050
retries: 100,
5151
// time (ms) between tries
52-
retryWait: 100
52+
retryWait: 100,
5353
};
5454
const lockFileName = `${name}.lock`;
5555
locker.lock(lockFileName, lockOpts, () => {
@@ -93,11 +93,7 @@ const unlockFile = function(name: string, next: Callback): void {
9393
* @param {*} options
9494
* @param {*} callback
9595
*/
96-
function readFile(
97-
name: string,
98-
options: any = {},
99-
callback: any = (): void => {}
100-
): void {
96+
function readFile(name: string, options: any = {}, callback: any = (): void => {}): void {
10197
if (typeof options === 'function') {
10298
callback = options;
10399
options = {};

0 commit comments

Comments
 (0)