Skip to content

Commit

Permalink
chore: add prettier check in linting step (vercel#1764)
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatiusmb authored and pcnate committed Aug 15, 2023
1 parent 39890a0 commit 51307fa
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 136 deletions.
6 changes: 4 additions & 2 deletions lib/fabricator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ const script = `
process.stdin.resume();
`;

const children: Record<string, ChildProcessByStdio<Writable, Readable, null>> =
{};
const children: Record<
string,
ChildProcessByStdio<Writable, Readable, null>
> = {};

export function fabricate(
bakes: string[],
Expand Down
4 changes: 2 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ export async function exec(argv2: string[]) {

const { bytecode } = argv;

const nativeBuild = argv['native-build']
const nativeBuild = argv['native-build'];

for (const target of targets) {
target.forceBuild = forceBuild;
Expand Down Expand Up @@ -678,7 +678,7 @@ export async function exec(argv2: string[]) {
target: target as Target,
symLinks,
doCompress,
nativeBuild
nativeBuild,
});

if (target.platform !== 'win' && target.output) {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@
"clean": "rimraf lib-es5",
"build": "npm run clean && tsc",
"start": "tsc --watch",
"lint": "eslint lib prelude test",
"lint:fix": "npm run lint -- --fix",
"lint": "npm run lint:style && npm run lint:code",
"lint:style": "prettier -c \"{lib,prelude,test}/**/*.{ts,js}\"",
"lint:code": "eslint lib prelude test",
"fix": "npm run lint:style -- -w && npm run lint:code -- --fix",
"prepare": "npm run build",
"prepublishOnly": "npm run lint",
"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"
Expand Down
6 changes: 2 additions & 4 deletions test/test-46-input-package-json-outputdir/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ const input = '.';
const newcomers = [
'out/palookaville-linux',
'out/palookaville-macos',
'out/palookaville-win.exe'
'out/palookaville-win.exe',
];

const before = utils.filesBefore(newcomers);

utils.pkg.sync([
input
], { stdio: 'inherit' });
utils.pkg.sync([input], { stdio: 'inherit' });

utils.filesAfter(before, newcomers);
utils.vacuum.sync('out');
121 changes: 10 additions & 111 deletions test/test-50-signature/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,117 +22,16 @@ let spoiler = fs.readFileSync(output);
spoiler = Buffer.concat([
spoiler,
Buffer.from([
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34,
0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe,
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34,
0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe,
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
0xcd, 0xde, 0xef,
]),
]);
fs.writeFileSync(output, spoiler);
Expand Down
21 changes: 11 additions & 10 deletions test/test-79-npm/node-notifier/node-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ var notifier = require('node-notifier');
var utils = require('node-notifier/lib/utils.js');
var whichArgument;

utils.command = utils.fileCommandJson = utils.immediateFileCommand = function (
filename
) {
var forLinux = filename === whichArgument; // 'notify-send' is built-in on linux
var forNonLinux = fs.existsSync(filename) && path.isAbsolute(filename);
if ((forLinux || forNonLinux) && filename.indexOf('snapshot') < 0) {
console.log('ok');
}
process.exit();
};
utils.command =
utils.fileCommandJson =
utils.immediateFileCommand =
function (filename) {
var forLinux = filename === whichArgument; // 'notify-send' is built-in on linux
var forNonLinux = fs.existsSync(filename) && path.isAbsolute(filename);
if ((forLinux || forNonLinux) && filename.indexOf('snapshot') < 0) {
console.log('ok');
}
process.exit();
};

var which = require('which');
which.sync = function (filename) {
Expand Down
15 changes: 10 additions & 5 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,15 @@ module.exports.shouldSkipPnpm = function () {
const REQUIRED_MINOR_VERSION = 19;

const MAJOR_VERSION = parseInt(process.version.match(/v([0-9]+)/)[1], 10);
const MINOR_VERSION = parseInt(process.version.match(/v[0-9]+\.([0-9]+)/)[1], 10);

const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION
const isDisallowedMinor = MAJOR_VERSION === REQUIRED_MAJOR_VERSION && MINOR_VERSION < REQUIRED_MINOR_VERSION;
const MINOR_VERSION = parseInt(
process.version.match(/v[0-9]+\.([0-9]+)/)[1],
10
);

const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION;
const isDisallowedMinor =
MAJOR_VERSION === REQUIRED_MAJOR_VERSION &&
MINOR_VERSION < REQUIRED_MINOR_VERSION;
if (isDisallowedMajor || isDisallowedMinor) {
const need = `${REQUIRED_MAJOR_VERSION}.${REQUIRED_MINOR_VERSION}`;
const got = `${MAJOR_VERSION}.${MINOR_VERSION}`;
Expand All @@ -183,4 +188,4 @@ module.exports.shouldSkipPnpm = function () {
}

return false;
}
};

0 comments on commit 51307fa

Please sign in to comment.