Skip to content

Commit 9832dce

Browse files
authored
refactor: introduce void 0 pkgs (#706)
1 parent 0619592 commit 9832dce

41 files changed

Lines changed: 1526 additions & 2378 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/renovate.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": [
4-
"config:recommended",
5-
":prHourlyLimitNone",
6-
":prConcurrentLimitNone"
7-
],
3+
"extends": ["config:recommended", ":prHourlyLimitNone", ":prConcurrentLimitNone"],
84
"dependencyDashboard": true,
95
"schedule": ["every weekend"],
106
"packageRules": [

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ jobs:
3737
run: pnpm install --frozen-lockfile
3838

3939
- name: Build project and upload bundle
40+
if: ${{ !cancelled() && matrix.node-version == 24 }}
4041
env:
4142
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4243
run: pnpm run build
4344

4445
- name: Linter test
46+
if: ${{ !cancelled() && matrix.node-version == 24 }}
4547
run: pnpm lint
4648

4749
- name: Unit test and save results

.husky/commit-msg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
pnpm commitlint --edit $1
1+
pnpm commitlint --edit $1

.husky/pre-commit

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
41
pnpm nano-staged

.oxfmtrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": []
4+
}

.oxlintrc.json

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"ignorePatterns": ["dist/**"],
4+
"categories": {
5+
"correctness": "error",
6+
"suspicious": "warn",
7+
"pedantic": "warn",
8+
"perf": "warn",
9+
"style": "warn"
10+
},
11+
"plugins": ["import", "unicorn", "oxc", "promise", "jsdoc", "vitest", "node"],
12+
"rules": {
13+
// we should not enforce capitalized comments
14+
"capitalized-comments": "off",
15+
// prefer to export declarations instead of exporting at the end
16+
"group-exports": "off",
17+
// this rule is too restrictive
18+
"init-declarations": "off",
19+
// allow continue in complicated loops
20+
"no-continue": "off",
21+
// warn about console usage but allow it
22+
"no-console": "warn",
23+
// type imports can be duplicated with value imports
24+
"no-duplicate-imports": ["error", { "allowSeparateTypeImports": true }],
25+
// inline comments shall be allowed
26+
"no-inline-comments": "off",
27+
"no-magic-numbers": "off",
28+
// allow nested ternary for better readability in some cases
29+
"no-nested-ternary": "off",
30+
// allow null usage
31+
"no-null": "off",
32+
// ternary operator shall be allowed for simple expressions
33+
"no-ternary": "off",
34+
// normally we do not enforce numeric separator usage
35+
"numeric-separators-style": "off",
36+
// we prefer to sort imports with its pkg name
37+
"sort-imports": "off",
38+
// object keys are not supposed to be sorted in many cases
39+
"sort-keys": "off",
40+
41+
// import plugin rules
42+
43+
"import/exports-last": "off",
44+
// usually we just export vue components as default export without naming it
45+
"import/no-anonymous-default-export": "off",
46+
// a rule that shall not be enabled anyway
47+
"import/no-named-export": "off",
48+
// allow importing stylesheets
49+
"import/no-unassigned-import": ["error", { "allow": ["**/*.css", "**/*.scss"] }],
50+
// named export is preferred
51+
"import/prefer-default-export": "off",
52+
53+
// jsdoc plugin rules
54+
55+
// duplicated typescript related jsdoc shall be warned
56+
"jsdoc/check-tag-names": ["warn", { "typed": true }],
57+
// we do not require types in jsdoc since we use TypeScript
58+
"jsdoc/require-param-type": "off",
59+
// we do not require types in jsdoc since we use TypeScript
60+
"jsdoc/require-returns-type": "off",
61+
62+
"promise/always-return": "off",
63+
// we sometimes need to create new Promise instance
64+
"promise/avoid-new": "off",
65+
// we prefer async/await syntax
66+
"promise/prefer-await-to-then": "off",
67+
68+
// unicorn plugin rules
69+
// filename should not be enforced strictly, e.g. Vue SFC files shall be PascalCased
70+
// we shall expect a project level setting
71+
"unicorn/filename-case": "off",
72+
// toReversed can introduce memory overhead,
73+
// in some chained calls it is better to use reverse as the "reversed" array is also a temp variable.
74+
"unicorn/no-array-reverse": "off",
75+
// toSorted can introduce memory overhead
76+
// in some chained calls it is better to use reverse as the "sorted" array is also a temp variable.
77+
"unicorn/no-array-sort": "off",
78+
// sometimes nested ternary is considerable
79+
"unicorn/no-nested-ternary": "warn",
80+
// Array.at() is too modern for browser targets
81+
"unicorn/prefer-at": "off",
82+
// support starts with chrome71, firefox68. safari12.1, node12
83+
// leaving it to warn for edge cases
84+
"unicorn/prefer-global-this": "warn",
85+
86+
// stylistic rules with default being tweaked
87+
88+
"catch-error-name": ["warn", { "name": "err" }],
89+
"curly": ["warn", "multi-line"],
90+
"max-dependencies": ["warn", { "ignoreTypeImports": true, "max": 15 }],
91+
"max-lines": ["warn", { "max": 500, "skipBlankLines": true, "skipComments": true }],
92+
"max-lines-per-function": [
93+
"warn",
94+
{ "max": 100, "skipBlankLines": true, "skipComments": true }
95+
],
96+
"max-params": ["warn", 4],
97+
"max-statements": ["warn", { "max": 30 }],
98+
99+
// per project settings
100+
"id-length": "off"
101+
},
102+
"overrides": [
103+
{
104+
"files": ["**/*.ts"],
105+
"plugins": ["typescript"],
106+
"rules": {
107+
// we make type casts only when necessary
108+
// "typescript/no-unsafe-type-assertion": "off",
109+
// skipping it for now, may enable it later
110+
// "typescript/switch-exhaustiveness-check": "off",
111+
// a lot of time we are just want to check existence
112+
// "typescript/strict-boolean-expressions": "off"
113+
}
114+
},
115+
{
116+
"files": ["**/__tests__/**"],
117+
"plugins": ["vitest"]
118+
}
119+
]
120+
}

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["oxc.oxc-vscode", "vitest.explorer"]
3+
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.defaultFormatter": "oxc.oxc-vscode",
3+
"cSpell.words": ["crypted"]
4+
}

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ export const compare: (
170170
* @param salt Salt length to generate or salt to use, default to 10
171171
* @returns Resulting hash
172172
*/
173-
export const hashSync: (
174-
contentString: string,
175-
salt?: string | number,
176-
) => string;
173+
export const hashSync: (contentString: string, salt?: string | number) => string;
177174
/**
178175
* Asynchronously generates a hash for the given string.
179176
*
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { describe, expect, it } from "vitest";
22

33
import { decodeBase64, encodeBase64 } from "../src/base64.js";
44

5-
describe("encodeBase64", () => {
5+
describe(encodeBase64, () => {
66
it("should encode byte array to base64 string", () => {
77
expect(
88
encodeBase64(
99
[
10-
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
11-
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
10+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
11+
0x0f, 0x10,
1212
],
1313
16,
1414
),
@@ -22,11 +22,11 @@ describe("encodeBase64", () => {
2222
});
2323
});
2424

25-
describe("decodeBase64", () => {
25+
describe(decodeBase64, () => {
2626
it("should decode base64 string to byte array", () => {
2727
expect(decodeBase64("..CA.uOD/eaGAOmJB.yMBv.", 16)).toEqual([
28-
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
29-
0x0c, 0x0d, 0x0e, 0x0f,
28+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
29+
0x0f,
3030
]);
3131
});
3232

0 commit comments

Comments
 (0)