Skip to content

Commit

Permalink
chore: Updated toolchain.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Jan 13, 2025
1 parent b1272a1 commit cb464dd
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 2,401 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,28 @@ jobs:

- name: Run lint command
run: npm run lint

build-wasm:
name: Build WebAssembly
runs-on: ubuntu-latest
steps:
- name: Fetch code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1

# Skip macOS & Windows, cache there is slower
- name: Restore node_modules cache for Linux
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
if: runner.os == 'Linux'
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci --ignore-scripts

- name: Build WebAssembly
run: npm run build-wasm
2 changes: 1 addition & 1 deletion bin/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { dirname, resolve } from 'path';
import { CHeaders, HTTP } from '../src/llhttp';

// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
// eslint-disable-next-line @stylistic/js/max-len
// eslint-disable-next-line @stylistic/max-len
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');
Expand Down
85 changes: 33 additions & 52 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,66 +1,47 @@
import stylisticJs from '@stylistic/eslint-plugin-js'
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import stylistic from "@stylistic/eslint-plugin";

export default tseslint.config(
{ ignores: ["build", "lib", "examples", "bench"] },
{
ignores: ["build", "lib", "examples", "bench", "eslint.config.mjs"]
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
{
"languageOptions": {
"parser": tseslint.parser,
"parserOptions": {
"lib": ["es2023"],
"module": "commonjs",
"moduleResolution": "node",
"target": "es2022",

"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"include": [
"bin/**/*.ts",
"src/**/*.ts",
"test/**/*.ts"
],
"outDir": "./lib",
"declaration": true,
"pretty": true,
"sourceMap": true
},
"globals": {
...globals.commonjs,
...globals.node,
...globals.es6
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true
},
},
},
{
plugins: {
'@stylistic/js': stylisticJs
"@stylistic": stylistic,
},
files: [
"bin/**/*.ts",
'bench/**/*.ts',
'src/**/*.ts',
'test/**/*.ts',
],
files: ["bin/**/*.ts", "bench/**/*.ts", "src/**/*.ts", "test/**/*.ts"],
rules: {
'@stylistic/js/max-len': [ 2, {
'code': 120,
'ignoreComments': true
} ],
"@stylistic/js/array-bracket-spacing": ["error", "always"],
"@stylistic/js/operator-linebreak": ["error", "after"],
"@stylistic/js/linebreak-style": ["error", "unix"],
"@stylistic/js/brace-style": ["error", "1tbs", { "allowSingleLine": true }],
'@stylistic/js/indent': ["error", 2, {
"SwitchCase": 1,
"FunctionDeclaration": { "parameters": "first" },
"FunctionExpression": { "parameters": "first" }
}],
}
"@stylistic/max-len": [
2,
{
code: 120,
ignoreComments: true,
},
],
"@stylistic/array-bracket-spacing": ["error", "always"],
"@stylistic/operator-linebreak": ["error", "after"],
"@stylistic/linebreak-style": ["error", "unix"],
"@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }],
"@stylistic/indent": [
"error",
2,
{
SwitchCase: 1,
FunctionDeclaration: { parameters: "first" },
FunctionExpression: { parameters: "first" },
},
],
},
}
);
Loading

0 comments on commit cb464dd

Please sign in to comment.