Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit 6efa7cf

Browse files
authored
chore: add prettier check in linting step (#1764)
1 parent 56135b5 commit 6efa7cf

7 files changed

Lines changed: 43 additions & 136 deletions

File tree

lib/fabricator.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ const script = `
4141
process.stdin.resume();
4242
`;
4343

44-
const children: Record<string, ChildProcessByStdio<Writable, Readable, null>> =
45-
{};
44+
const children: Record<
45+
string,
46+
ChildProcessByStdio<Writable, Readable, null>
47+
> = {};
4648

4749
export function fabricate(
4850
bakes: string[],

lib/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ export async function exec(argv2: string[]) {
540540

541541
const { bytecode } = argv;
542542

543-
const nativeBuild = argv['native-build']
543+
const nativeBuild = argv['native-build'];
544544

545545
for (const target of targets) {
546546
target.forceBuild = forceBuild;
@@ -678,7 +678,7 @@ export async function exec(argv2: string[]) {
678678
target: target as Target,
679679
symLinks,
680680
doCompress,
681-
nativeBuild
681+
nativeBuild,
682682
});
683683

684684
if (target.platform !== 'win' && target.output) {

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@
7171
"clean": "rimraf lib-es5",
7272
"build": "npm run clean && tsc",
7373
"start": "tsc --watch",
74-
"lint": "eslint lib prelude test",
75-
"lint:fix": "npm run lint -- --fix",
74+
"lint": "npm run lint:style && npm run lint:code",
75+
"lint:style": "prettier -c \"{lib,prelude,test}/**/*.{ts,js}\"",
76+
"lint:code": "eslint lib prelude test",
77+
"fix": "npm run lint:style -- -w && npm run lint:code -- --fix",
7678
"prepare": "npm run build",
7779
"prepublishOnly": "npm run lint",
7880
"test": "npm run build && node test/test.js node14 no-npm && node test/test.js node12 no-npm && node test/test.js node10 no-npm && node test/test.js host only-npm"

test/test-46-input-package-json-outputdir/main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ const input = '.';
1313
const newcomers = [
1414
'out/palookaville-linux',
1515
'out/palookaville-macos',
16-
'out/palookaville-win.exe'
16+
'out/palookaville-win.exe',
1717
];
1818

1919
const before = utils.filesBefore(newcomers);
2020

21-
utils.pkg.sync([
22-
input
23-
], { stdio: 'inherit' });
21+
utils.pkg.sync([input], { stdio: 'inherit' });
2422

2523
utils.filesAfter(before, newcomers);
2624
utils.vacuum.sync('out');

test/test-50-signature/main.js

Lines changed: 10 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -22,117 +22,16 @@ let spoiler = fs.readFileSync(output);
2222
spoiler = Buffer.concat([
2323
spoiler,
2424
Buffer.from([
25-
0x01,
26-
0x12,
27-
0x23,
28-
0x34,
29-
0x45,
30-
0x56,
31-
0x67,
32-
0x78,
33-
0x89,
34-
0x9a,
35-
0xab,
36-
0xbc,
37-
0xcd,
38-
0xde,
39-
0xef,
40-
0xfe,
41-
0x01,
42-
0x12,
43-
0x23,
44-
0x34,
45-
0x45,
46-
0x56,
47-
0x67,
48-
0x78,
49-
0x89,
50-
0x9a,
51-
0xab,
52-
0xbc,
53-
0xcd,
54-
0xde,
55-
0xef,
56-
0xfe,
57-
0x01,
58-
0x12,
59-
0x23,
60-
0x34,
61-
0x45,
62-
0x56,
63-
0x67,
64-
0x78,
65-
0x89,
66-
0x9a,
67-
0xab,
68-
0xbc,
69-
0xcd,
70-
0xde,
71-
0xef,
72-
0xfe,
73-
0x01,
74-
0x12,
75-
0x23,
76-
0x34,
77-
0x45,
78-
0x56,
79-
0x67,
80-
0x78,
81-
0x89,
82-
0x9a,
83-
0xab,
84-
0xbc,
85-
0xcd,
86-
0xde,
87-
0xef,
88-
0xfe,
89-
0x01,
90-
0x12,
91-
0x23,
92-
0x34,
93-
0x45,
94-
0x56,
95-
0x67,
96-
0x78,
97-
0x89,
98-
0x9a,
99-
0xab,
100-
0xbc,
101-
0xcd,
102-
0xde,
103-
0xef,
104-
0xfe,
105-
0x01,
106-
0x12,
107-
0x23,
108-
0x34,
109-
0x45,
110-
0x56,
111-
0x67,
112-
0x78,
113-
0x89,
114-
0x9a,
115-
0xab,
116-
0xbc,
117-
0xcd,
118-
0xde,
119-
0xef,
120-
0xfe,
121-
0x01,
122-
0x12,
123-
0x23,
124-
0x34,
125-
0x45,
126-
0x56,
127-
0x67,
128-
0x78,
129-
0x89,
130-
0x9a,
131-
0xab,
132-
0xbc,
133-
0xcd,
134-
0xde,
135-
0xef,
25+
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
26+
0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
27+
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34,
28+
0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe,
29+
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
30+
0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
31+
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34,
32+
0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe,
33+
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
34+
0xcd, 0xde, 0xef,
13635
]),
13736
]);
13837
fs.writeFileSync(output, spoiler);

test/test-79-npm/node-notifier/node-notifier.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ var notifier = require('node-notifier');
66
var utils = require('node-notifier/lib/utils.js');
77
var whichArgument;
88

9-
utils.command = utils.fileCommandJson = utils.immediateFileCommand = function (
10-
filename
11-
) {
12-
var forLinux = filename === whichArgument; // 'notify-send' is built-in on linux
13-
var forNonLinux = fs.existsSync(filename) && path.isAbsolute(filename);
14-
if ((forLinux || forNonLinux) && filename.indexOf('snapshot') < 0) {
15-
console.log('ok');
16-
}
17-
process.exit();
18-
};
9+
utils.command =
10+
utils.fileCommandJson =
11+
utils.immediateFileCommand =
12+
function (filename) {
13+
var forLinux = filename === whichArgument; // 'notify-send' is built-in on linux
14+
var forNonLinux = fs.existsSync(filename) && path.isAbsolute(filename);
15+
if ((forLinux || forNonLinux) && filename.indexOf('snapshot') < 0) {
16+
console.log('ok');
17+
}
18+
process.exit();
19+
};
1920

2021
var which = require('which');
2122
which.sync = function (filename) {

test/utils.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,15 @@ module.exports.shouldSkipPnpm = function () {
171171
const REQUIRED_MINOR_VERSION = 19;
172172

173173
const MAJOR_VERSION = parseInt(process.version.match(/v([0-9]+)/)[1], 10);
174-
const MINOR_VERSION = parseInt(process.version.match(/v[0-9]+\.([0-9]+)/)[1], 10);
175-
176-
const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION
177-
const isDisallowedMinor = MAJOR_VERSION === REQUIRED_MAJOR_VERSION && MINOR_VERSION < REQUIRED_MINOR_VERSION;
174+
const MINOR_VERSION = parseInt(
175+
process.version.match(/v[0-9]+\.([0-9]+)/)[1],
176+
10
177+
);
178+
179+
const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION;
180+
const isDisallowedMinor =
181+
MAJOR_VERSION === REQUIRED_MAJOR_VERSION &&
182+
MINOR_VERSION < REQUIRED_MINOR_VERSION;
178183
if (isDisallowedMajor || isDisallowedMinor) {
179184
const need = `${REQUIRED_MAJOR_VERSION}.${REQUIRED_MINOR_VERSION}`;
180185
const got = `${MAJOR_VERSION}.${MINOR_VERSION}`;
@@ -183,4 +188,4 @@ module.exports.shouldSkipPnpm = function () {
183188
}
184189

185190
return false;
186-
}
191+
};

0 commit comments

Comments
 (0)