Skip to content

Commit

Permalink
chore: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 27, 2023
1 parent cc99946 commit ee1ced8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -21,6 +21,7 @@
"build": "pnpm unbuild",
"dev": "pnpm unbuild test/fixture",
"lint": "eslint --ext .ts,.js . && prettier -c src test",
"lint:fix": "eslint --fix --ext .ts,.js . && prettier -w src test",
"prepack": "pnpm unbuild",
"release": "vitest run && changelogen --release && git push --follow-tags && npm publish",
"stub": "pnpm unbuild --stub",
Expand Down
2 changes: 1 addition & 1 deletion src/builder/plugins/esbuild.ts
Expand Up @@ -10,7 +10,7 @@ const defaultLoaders: { [ext: string]: Loader } = {
".ts": "ts",
".js": "js",
".tsx": "tsx",
".jsx": "jsx"
".jsx": "jsx",
};

export interface Options {
Expand Down
8 changes: 5 additions & 3 deletions src/builder/rollup.ts
Expand Up @@ -270,9 +270,11 @@ export function getRollupOptions(ctx: BuildContext): RollupOptions {
[ctx.pkg.name!]: ctx.options.rootDir,
...ctx.options.alias,
...(Array.isArray(ctx.options.rollup.alias.entries)
? Object.fromEntries(ctx.options.rollup.alias.entries.map(entry => {
return [entry.find, entry.replacement]
}))
? Object.fromEntries(
ctx.options.rollup.alias.entries.map((entry) => {
return [entry.find, entry.replacement];
})
)
: ctx.options.rollup.alias.entries),
},
}),
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Expand Up @@ -67,7 +67,7 @@ export interface BuildOptions {
declaration?: boolean;
outDir: string;
stub: boolean;
externals: (string|RegExp)[];
externals: (string | RegExp)[];
dependencies: string[];
peerDependencies: string[];
devDependencies: string[];
Expand Down
8 changes: 6 additions & 2 deletions src/utils.ts
Expand Up @@ -163,6 +163,10 @@ export function extractExportFilenames(
);
}

export function arrayIncludes (arr: (string|RegExp)[], searchElement: string) {
return arr.some(entry => entry instanceof RegExp ? entry.test(searchElement) : entry === searchElement);
export function arrayIncludes(arr: (string | RegExp)[], searchElement: string) {
return arr.some((entry) =>
entry instanceof RegExp
? entry.test(searchElement)
: entry === searchElement
);
}
6 changes: 5 additions & 1 deletion test/utils.test.ts
@@ -1,5 +1,9 @@
import { describe, it, expect } from "vitest";
import { arrayIncludes, extractExportFilenames, inferExportType } from "../src/utils";
import {
arrayIncludes,
extractExportFilenames,
inferExportType,
} from "../src/utils";

describe("inferExportType", () => {
it("infers export type by condition", () => {
Expand Down

0 comments on commit ee1ced8

Please sign in to comment.