Skip to content

Commit

Permalink
refactor: organize types, errors, and imports (#275)
Browse files Browse the repository at this point in the history
* refactor: re-organize types and errors

* style: remove extra empty line

* chore(deps): update dependencies

* style: sort imports via @trivago/prettier-plugin-sort-imports

* docs: fix undesired automatic formatting [skip ci]

* style: ignore files

Co-authored-by: Lucie <[email protected]>
  • Loading branch information
angeloashmore and lihbr authored Jan 21, 2023
1 parent a3a6609 commit 90245e2
Show file tree
Hide file tree
Showing 181 changed files with 7,931 additions and 5,567 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CHANGELOG.md

# .gitignore copy

# custom
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CHANGELOG.md

# .gitignore copy

# custom
Expand Down
22 changes: 21 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
{
"plugins": ["prettier-plugin-jsdoc"],
"plugins": ["prettier-plugin-jsdoc", "@trivago/prettier-plugin-sort-imports"],
"jsdocCapitalizeDescription": false,
"jsdocSeparateReturnsFromParam": true,
"jsdocSingleLineComment": false,
"tsdoc": true,
"importOrder": [
"^node:(.*)$",
"<THIRD_PARTY_MODULES>",
"^(?!.*/src(?:/|$)).*/__testutils__(?:/|$)",
"^(?!.*/src(?:/|$)).*/__fixtures__(?:/|$)",
"^(?!.*/src(?:/|$)).*/lib(?:/|$)",
"^(?!.*/src(?:/|$)).*/types(?:/|$)",
"^(?!.*/src(?:/|$)).*/errors(?:/|$)",
"^(?!.*/src(?:/|$))../../../../../",
"^(?!.*/src(?:/|$))../../../../",
"^(?!.*/src(?:/|$))../../../",
"^(?!.*/src(?:/|$))../../",
"^(?!.*/src(?:/|$))../",
"^(?!.*/src(?:/|$))./(.*/)+",
"^(?!.*/src(?:/|$))./",
"/src(?:/|$)"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderGroupNamespaceSpecifiers": true,
"printWidth": 80,
"useTabs": true,
"semi": true,
Expand Down
20 changes: 19 additions & 1 deletion .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
const pkg = require("./package.json");

module.exports = [pkg.module, pkg.main].filter(Boolean).map(path => ({ path }));
module.exports = [
...new Set([
pkg.main,
pkg.module,
...Object.values(pkg.exports).flatMap((exportTypes) => {
if (typeof exportTypes === "string") {
return exportTypes;
} else {
return Object.values(exportTypes);
}
}),
]),
]
.filter((path) => {
return path && path !== "./package.json";
})
.map((path) => {
return { path };
});
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Anyone can, and is welcome to, contribute to the project by opening bug reports
**🚨 &nbsp;Bug reports**

> **Note**: An automated reply is posted when a bug report is opened to explain our maintenance schedule.
Every Wednesday is _bug squashing day_. During this day, we respond to and/or fix bug reports.

At the end of each Wednesday (assuming there were issues to fix), or later during the week if reviews are required, a _patch_ version is [released](#publishing) containing any fixes that were needed. Releasing multiple patches during the same week should be avoided.
Expand All @@ -179,6 +180,7 @@ Ideally, all opened bug reports are addressed each Wednesday. If a particular bu
**🙋‍♀️ &nbsp;Feature requests**

> **Note**: An automated message gets sent to people creating feature requests about this process.
Every last week of a month is _feature week_. During this week, we implement new features. Discussing and coming up with implementation proposals can happen before that week, but implementations are targeted for the last week.

At the end of the week (assuming there were features to implement), a _minor_ version is [released](#publishing) containing the new features. Releasing multiple minors during the same week should be avoided.
Expand Down
3 changes: 1 addition & 2 deletions examples/custom-query-timeout/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as prismic from "@prismicio/client";
import fetch, { AbortError } from "node-fetch";

// AbortController was added in node v14.17.0 globally. If you are using a node
// version >=14.17.0, or are not in a node environment, remove this line.
import { AbortController } from "abort-controller";
import fetch, { AbortError } from "node-fetch";

// A global timeout can be implemented like the following. This timeout will
// apply to all network requests made by the client.
Expand Down
2 changes: 1 addition & 1 deletion examples/with-express/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as prismic from "@prismicio/client";
import fetch from "node-fetch";
import express from "express";
import fetch from "node-fetch";
import QuickLRU from "quick-lru";

const cache = new QuickLRU({
Expand Down
Loading

0 comments on commit 90245e2

Please sign in to comment.