Skip to content

update CI #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- '18'
- '20'
- '22'
- '24'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
cache: npm
node-version: "18"
node-version: "20"

# npm@9 may fail with https://github.com/npm/cli/issues/6723
# npm@10 may fail with "GitFetcher requires an Arborist constructor to pack a tarball"
Expand Down
203 changes: 116 additions & 87 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,112 +11,141 @@ import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [{
export default [
{
ignores: ["**/*.js", "test/deno*", "test/bun*"],
}, ...fixupConfigRules(compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
)), {
},
...fixupConfigRules(
compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
),
),
{
plugins: {
"@typescript-eslint": fixupPluginRules(typescriptEslintEslintPlugin),
tsdoc,
"@typescript-eslint": fixupPluginRules(typescriptEslintEslintPlugin),
tsdoc,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
project: "./tsconfig.json",
},
parserOptions: {
project: "./tsconfig.json",
},
},

settings: {},

rules: {
"no-constant-condition": ["warn", {
checkLoops: false,
}],
"no-constant-condition": [
"warn",
{
checkLoops: false,
},
],

"no-useless-escape": "warn",
"no-console": "warn",
"no-var": "warn",
"no-return-await": "warn",
"prefer-const": "warn",
"guard-for-in": "warn",
curly: "warn",
"no-param-reassign": "warn",
"prefer-spread": "warn",
"import/no-unresolved": "off",
"import/no-cycle": "error",
"import/no-default-export": "warn",
"tsdoc/syntax": "warn",
"@typescript-eslint/await-thenable": "warn",
"no-useless-escape": "warn",
"no-console": "warn",
"no-var": "warn",
"no-return-await": "warn",
"prefer-const": "warn",
"guard-for-in": "warn",
curly: "warn",
"no-param-reassign": "warn",
"prefer-spread": "warn",
"import/no-unresolved": "off",
"import/no-cycle": "error",
"import/no-default-export": "warn",
"tsdoc/syntax": "warn",
"@typescript-eslint/await-thenable": "warn",

"@typescript-eslint/array-type": ["warn", {
default: "generic",
}],
"@typescript-eslint/array-type": [
"warn",
{
default: "generic",
},
],

"@typescript-eslint/naming-convention": ["warn", {
selector: "default",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
}, {
selector: "typeLike",
format: ["PascalCase"],
leadingUnderscore: "allow",
}],
"@typescript-eslint/naming-convention": [
"warn",
{
selector: "default",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
},
{
selector: "typeLike",
format: ["PascalCase"],
leadingUnderscore: "allow",
},
],

"@typescript-eslint/restrict-plus-operands": "warn",
//"@typescript-eslint/no-throw-literal": "warn",
"@typescript-eslint/unbound-method": "warn",
"@typescript-eslint/explicit-module-boundary-types": "warn",
//"@typescript-eslint/no-extra-semi": "warn",
"@typescript-eslint/no-extra-non-null-assertion": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
//"@typescript-eslint/no-throw-literal": "warn",
"@typescript-eslint/unbound-method": "warn",
"@typescript-eslint/explicit-module-boundary-types": "warn",
//"@typescript-eslint/no-extra-semi": "warn",
"@typescript-eslint/no-extra-non-null-assertion": "warn",

"@typescript-eslint/no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
}],
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
},
],

"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-for-in-array": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-for-in-array": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-call": "warn",

"@typescript-eslint/no-unnecessary-condition": ["warn", {
allowConstantLoopConditions: true,
}],
"@typescript-eslint/no-unnecessary-condition": [
"warn",
{
allowConstantLoopConditions: true,
},
],

"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/no-implied-eval": "warn",
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
"@typescript-eslint/no-invalid-void-type": "warn",
"@typescript-eslint/no-loss-of-precision": "warn",
"@typescript-eslint/no-confusing-void-expression": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-includes": "warn",
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/prefer-regexp-exec": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-ts-expect-error": "warn",
"@typescript-eslint/indent": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/no-implied-eval": "warn",
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
"@typescript-eslint/no-invalid-void-type": "warn",
"@typescript-eslint/no-loss-of-precision": "warn",
"@typescript-eslint/no-confusing-void-expression": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-includes": "warn",
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/prefer-regexp-exec": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-ts-expect-error": "warn",
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
disallowTypeAnnotations: false,
},
],
"@typescript-eslint/indent": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": "off",
},
}];
},
];
4 changes: 2 additions & 2 deletions src/CachedKeyDecoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class CachedKeyDecoder implements KeyDecoder {
hit = 0;
miss = 0;
private readonly caches: Array<Array<KeyCacheRecord>>;
private readonly maxKeyLength: number;
private readonly maxLengthPerKey: number;
readonly maxKeyLength: number;
readonly maxLengthPerKey: number;

constructor(maxKeyLength = DEFAULT_MAX_KEY_LENGTH, maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY) {
this.maxKeyLength = maxKeyLength;
Expand Down
8 changes: 5 additions & 3 deletions src/Decoder.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { prettyByte } from "./utils/prettyByte.ts";
import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec.ts";
import { ExtensionCodec } from "./ExtensionCodec.ts";
import { getInt64, getUint64, UINT32_MAX } from "./utils/int.ts";
import { utf8Decode } from "./utils/utf8.ts";
import { ensureUint8Array } from "./utils/typedArrays.ts";
import { CachedKeyDecoder, KeyDecoder } from "./CachedKeyDecoder.ts";
import { CachedKeyDecoder } from "./CachedKeyDecoder.ts";
import { DecodeError } from "./DecodeError.ts";
import type { ContextOf } from "./context.ts";
import type { ExtensionCodecType } from "./ExtensionCodec.ts";
import type { KeyDecoder } from "./CachedKeyDecoder.ts";

export type DecoderOptions<ContextType = undefined> = Readonly<
Partial<{
Expand Down Expand Up @@ -70,7 +72,7 @@ export type DecoderOptions<ContextType = undefined> = Readonly<

/**
* A function to convert decoded map key to a valid JS key type.
*
*
* Defaults to a function that throws an error if the key is not a string or a number.
*/
mapKeyConverter: (key: unknown) => MapKeyType;
Expand Down
3 changes: 2 additions & 1 deletion src/Encoder.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { utf8Count, utf8Encode } from "./utils/utf8.ts";
import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec.ts";
import { ExtensionCodec } from "./ExtensionCodec.ts";
import { setInt64, setUint64 } from "./utils/int.ts";
import { ensureUint8Array } from "./utils/typedArrays.ts";
import type { ExtData } from "./ExtData.ts";
import type { ContextOf } from "./context.ts";
import type { ExtensionCodecType } from "./ExtensionCodec.ts";

export const DEFAULT_MAX_DEPTH = 100;
export const DEFAULT_INITIAL_BUFFER_SIZE = 2048;
Expand Down