Skip to content

Commit

Permalink
Merge branch 'main' into improve-enumToMap
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Jan 30, 2024
2 parents cbf8a30 + 32f05c1 commit 5a20f05
Show file tree
Hide file tree
Showing 18 changed files with 1,363 additions and 1,731 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
run: npx mocha --timeout 30000 -r ts-node/register/type-check test/*-test.ts

lint:
name: Run TSLint
name: Run ESLint
runs-on: ubuntu-latest
steps:
- name: Fetch code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ["javascript", "python", "typescript"]
language: ["javascript", "typescript"]
# CodeQL supports [ $supported-codeql-languages ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: SARIF file
path: results.sarif
Expand Down
4 changes: 2 additions & 2 deletions bin/build_wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (!platform && process.argv[2]) {
if (process.argv[2] === '--prebuild') {
const cmd = `docker build --platform=${platform.toString().trim()} -t llhttp_wasm_builder .`;

/* tslint:disable-next-line no-console */
// eslint-disable-next-line no-console
console.log(`> ${cmd}\n\n`);
execSync(cmd, { stdio: 'inherit' });

Expand Down Expand Up @@ -43,7 +43,7 @@ if (process.argv[2] === '--docker') {
}
cmd += ` --mount type=bind,source=${WASM_SRC}/build,target=/home/node/llhttp/build llhttp_wasm_builder npm run wasm`;

/* tslint:disable-next-line no-console */
// eslint-disable-next-line no-console
console.log(`> ${cmd}\n\n`);
execSync(cmd, { cwd: WASM_SRC, stdio: 'inherit' });
process.exit(0);
Expand Down
7 changes: 5 additions & 2 deletions bin/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
import { mkdirSync, readFileSync, writeFileSync } from 'fs';
import { LLParse } from 'llparse';
import { dirname, resolve } from 'path';
import { parse } from 'semver';
import { CHeaders, HTTP } from '../src/llhttp';

// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
const semverRE = /^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/

const C_FILE = resolve(__dirname, '../build/c/llhttp.c');
const HEADER_FILE = resolve(__dirname, '../build/llhttp.h');

const pkg = JSON.parse(
readFileSync(resolve(__dirname, '..', 'package.json')).toString(),
);
const version = parse(pkg.version)!;

const version = pkg.version.match(semverRE)?.groups;
const llparse = new LLParse('llhttp__internal');

const cHeaders = new CHeaders();
Expand Down
50 changes: 50 additions & 0 deletions eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@stylistic/recommended-extends"
],
"rules": {
"max-len": [
"error",
{
"code": 120
}
],
"no-console": "error",
"@typescript-eslint/no-unused-vars": "error",
"@stylistic/array-bracket-spacing": ["error", "always"],
"@stylistic/operator-linebreak": ["error", "after"],
"@stylistic/brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"@stylistic/member-delimiter-style": ["error", {
"overrides": {
"interface": {
"multiline": {
"delimiter": "semi",
"requireLast": true
}
}
}
}],
"indent": "off",
"@stylistic/indent": ["error", 2, {
"SwitchCase": 1,
"FunctionDeclaration": { "parameters": "first" },
"FunctionExpression": { "parameters": "first" }
}],
"semi": "off",
"@stylistic/semi": ["error", "always"]
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"tsconfig.eslint.json"
],
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true,
"experimentalObjectRestSpread": true
}
}
}
Loading

0 comments on commit 5a20f05

Please sign in to comment.