Skip to content

Commit

Permalink
chore: run format
Browse files Browse the repository at this point in the history
  • Loading branch information
bryceosterhaus committed Dec 16, 2024
1 parent 309fd3b commit c586938
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions projects/npm-tools/packages/npm-scripts/src/scripts/prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ async function main(...args) {
return () => {
options[key] = value;
};
} else {
}
else {
return (value) => {
options[key] = value;
};
Expand Down Expand Up @@ -106,19 +107,24 @@ async function main(...args) {
Object.entries(OPTS).find(([option, callback]) => {
if (option.endsWith('=')) {
if (arg === option.slice(0, -1)) {

// eg. "--some-opt value"

const value = args[++i];

handler = callback.bind(null, value);
} else if (arg.startsWith(option)) {
}
else if (arg.startsWith(option)) {

// eg. "--some-opt=value"

const value = arg.slice(option.length);

handler = callback.bind(null, value);
}
} else if (arg === option) {
}
else if (arg === option) {

// eg. "--flag"

handler = callback;
Expand All @@ -129,16 +135,21 @@ async function main(...args) {

if (handler) {
handler();
} else if (arg.startsWith('-')) {
}
else if (arg.startsWith('-')) {

// Unknown option, just ignore it.
} else if (isGlob(arg)) {

}
else if (isGlob(arg)) {
getPaths([arg], [], IGNORE_FILE).forEach((filepath) => {
files.push({
contents: null,
filepath,
});
});
} else {
}
else {
files.push({
contents: null,
filepath: arg,
Expand All @@ -149,6 +160,7 @@ async function main(...args) {
const config = getMergedConfig('prettier');

if (options.stdin) {

// When `--stdin` is in effect, Prettier ignores file arguments
// and the `--write` option, requires --stdin-filepath, and
// prints the output to stdout.
Expand Down Expand Up @@ -190,7 +202,8 @@ async function main(...args) {

if (isJSP(filepath)) {
formattedContents = await formatJSP(contents, prettierOptions);
} else {
}
else {
formattedContents = format(contents, prettierOptions);
}

Expand Down

0 comments on commit c586938

Please sign in to comment.