Skip to content

Commit e4976db

Browse files
chore: update configuration files for improved development workflow by following the newest remix-auth-strategy-template
- Add Biome.json for linting and formatting - Update ESLint configuration - Modify TypeScript configuration - Add TypeDoc configuration - Create exports validation script
1 parent 5e8f111 commit e4976db

File tree

5 files changed

+134
-32
lines changed

5 files changed

+134
-32
lines changed

.eslintrc.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/* eslint-disable unicorn/prefer-module */
22
module.exports = {
3-
root: true,
4-
parser: "@typescript-eslint/parser",
5-
plugins: ["@typescript-eslint", "unicorn", "jest", "prettier"],
6-
extends: [
7-
"plugin:unicorn/recommended",
8-
"plugin:@typescript-eslint/recommended",
9-
],
10-
rules: {
11-
"prefer-const": "off",
12-
"@typescript-eslint/explicit-module-boundary-types": "off",
13-
"@typescript-eslint/no-non-null-assertion": "off",
14-
"no-unused-vars": "off",
15-
"no-var": "off",
16-
"unicorn/no-null": "off",
17-
"unicorn/prefer-node-protocol": "off",
18-
"unicorn/filename-case": "off",
19-
"unicorn/prevent-abbreviations": "off",
20-
},
3+
root: true,
4+
parser: "@typescript-eslint/parser",
5+
plugins: ["@typescript-eslint", "unicorn", "jest", "prettier"],
6+
extends: [
7+
"plugin:unicorn/recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
],
10+
rules: {
11+
"prefer-const": "off",
12+
"@typescript-eslint/explicit-module-boundary-types": "off",
13+
"@typescript-eslint/no-non-null-assertion": "off",
14+
"no-unused-vars": "off",
15+
"no-var": "off",
16+
"unicorn/no-null": "off",
17+
"unicorn/prefer-node-protocol": "off",
18+
"unicorn/filename-case": "off",
19+
"unicorn/prevent-abbreviations": "off",
20+
},
2121
};

biome.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true,
10+
"correctness": {
11+
"useHookAtTopLevel": "error"
12+
},
13+
"performance": {
14+
"noBarrelFile": "error",
15+
"noReExportAll": "error"
16+
},
17+
"style": {
18+
"noDefaultExport": "error",
19+
"noNegationElse": "error",
20+
"useConst": "off",
21+
"useExportType": "off",
22+
"useImportType": "off"
23+
},
24+
"suspicious": {
25+
"noConsoleLog": "warn",
26+
"noEmptyBlockStatements": "warn",
27+
"noSkippedTests": "error"
28+
}
29+
}
30+
},
31+
"formatter": { "enabled": true },
32+
"vcs": {
33+
"enabled": true,
34+
"clientKind": "git",
35+
"defaultBranch": "main",
36+
"useIgnoreFile": true
37+
},
38+
"overrides": [
39+
{
40+
"include": ["**/*.md"],
41+
"formatter": { "indentStyle": "tab" }
42+
}
43+
]
44+
}

scripts/exports.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
async function main() {
2+
let proc = Bun.spawn([
3+
"bunx",
4+
"attw",
5+
"-f",
6+
"table-flipped",
7+
"--no-emoji",
8+
"--no-color",
9+
"--pack",
10+
]);
11+
12+
let text = await new Response(proc.stdout).text();
13+
14+
let entrypointLines = text
15+
.slice(text.indexOf('"remix-i18next/'))
16+
.split("\n")
17+
.filter(Boolean)
18+
.filter((line) => !line.includes("─"))
19+
.map((line) =>
20+
line
21+
.replaceAll(/[^\d "()/A-Za-z-]/g, "")
22+
.replaceAll("90m│39m", "│")
23+
.replaceAll(/^/g, "")
24+
.replaceAll(/$/g, ""),
25+
);
26+
27+
let pkg = await Bun.file("package.json").json();
28+
let entrypoints = entrypointLines.map((entrypointLine) => {
29+
let [entrypoint, ...resolutionColumns] = entrypointLine.split("│");
30+
if (!entrypoint) throw new Error("Entrypoint not found");
31+
if (!resolutionColumns[2]) throw new Error("ESM resolution not found");
32+
if (!resolutionColumns[3]) throw new Error("Bundler resolution not found");
33+
return {
34+
entrypoint: entrypoint.replace(pkg.name, ".").trim(),
35+
esm: resolutionColumns[2].trim(),
36+
bundler: resolutionColumns[3].trim(),
37+
};
38+
});
39+
40+
let entrypointsWithProblems = entrypoints.filter(
41+
(item) => item.esm.includes("fail") || item.bundler.includes("fail"),
42+
);
43+
44+
if (entrypointsWithProblems.length > 0) {
45+
console.error("Entrypoints with problems:");
46+
process.exit(1);
47+
}
48+
}
49+
50+
await main().catch((error) => {
51+
console.error(error);
52+
process.exit(1);
53+
});
54+
55+
export {};

tsconfig.json

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
{
2-
"compilerOptions": {
3-
"lib": ["DOM", "DOM.Iterable", "ES2019"],
4-
"esModuleInterop": true,
5-
"moduleResolution": "Node",
6-
"module": "CommonJS",
7-
"target": "ES2019",
8-
"strict": true,
9-
"skipLibCheck": true,
10-
"declaration": true,
11-
"jsx": "react-jsx",
12-
"outDir": "./build"
13-
},
14-
"exclude": ["node_modules"],
15-
"include": ["src/**/*.ts", "src/**/*.tsx"]
2+
/* Change to `@total-typescript/tsconfig/tsc/dom/library` for DOM usage */
3+
"extends": "@total-typescript/tsconfig/tsc/no-dom/library",
4+
"include": ["src/**/*"],
5+
"exclude": ["src/**/*.test.*"],
6+
"compilerOptions": {
7+
"outDir": "./build"
8+
}
169
}

typedoc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"includeVersion": true,
4+
"entryPoints": ["./src/index.ts"],
5+
"out": "docs",
6+
"json": "docs/index.json",
7+
"cleanOutputDir": true,
8+
"plugin": ["typedoc-plugin-mdn-links"],
9+
"categorizeByGroup": false
10+
}

0 commit comments

Comments
 (0)