Skip to content
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
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8

[*.json]
indent_style = space
indent_size = 2
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
out
node_modules
out
7 changes: 2 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const IMPORT_PLUGIN_RULES = {
const JSDOC_PLUGIN_RULES = {
// Types are described in TypeScript
'jsdoc/require-param-type': 'off',
'jsdoc/require-throws-type': 'off',
'jsdoc/no-undefined-types': 'off',
'jsdoc/require-returns-type': 'off',

Expand Down Expand Up @@ -265,10 +266,6 @@ function mergeRules(...ruleSets) {
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: path.join(__dirname),
project: 'tsconfig.eslint.json',
},
plugins: [
'import',
'import-newlines',
Expand All @@ -285,7 +282,7 @@ module.exports = {
'plugin:n/recommended',
],
ignorePatterns: [
'dist',
'out',
'coverage',
],
settings: {
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,36 @@ jobs:
- name: List files
run: ls -alt

- name: Build shared library
run: pnpm --filter @vscode-adblock-syntax/shared build

- name: Check TypeScript types
run: pnpm test:compile

- name: Run markdownlint
run: pnpm lint:md

- name: Run ESLint
run: pnpm lint:ts
run: pnpm lint:code

- name: Run Jest tests
- name: Run Vitest tests
run: pnpm test

- name: Build extension
run: pnpm build

- name: Package extension
run: pnpm package

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: vscode-adblock-build
path: |
out/vscode-adblock.vsix
syntaxes/out/adblock.plist
retention-days: 30

notify:
name: Send Slack notification on failure
needs: check_code
Expand Down
12 changes: 12 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// See: https://typicode.github.io/husky/how-to.html#ci-server-and-docker
import ci from 'ci-info';

// Do not initialize Husky in CI environments.
if (ci.isCI) {
console.log('Skipping Husky initialization, because we detected a CI environment:', ci.name);
process.exit(0);
}

// Initialize Husky programmatically.
const husky = (await import('husky')).default;
console.log(husky());
10 changes: 7 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
pnpm test:compile
pnpm lint:staged
pnpm test
# Exit immediately if a command fails
set -e

lint-staged

# Corepack automatically adds a "packageManager" field to package.json.
# We don't want to commit this field, so we remove it from the staged version
# while keeping it in the working directory for local development.
if git diff --cached --name-only | grep -q "package.json"; then
echo "package.json is being committed. Checking if packageManager field is present..."

Expand Down
4 changes: 0 additions & 4 deletions .lintstagedrc

This file was deleted.

22 changes: 22 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Lint-staged configuration for the monorepo root.
*
* Delegates to workspace-level configs for package-specific linting with
* type checking (tsc-files) and related tests (vitest related).
*
* @type {import('lint-staged').Config}
*/

module.exports = {
// Root markdown files
'*.md': 'markdownlint',

// Root-level tools and scripts
'tools/**/*.{ts,js,cjs,mjs}': 'eslint --cache',

// Delegate to workspace configs (they have tsc-files + vitest related)
'client/**/*.{ts,js,md}': () => 'pnpm --filter @vscode-adblock-syntax/client exec lint-staged',
'server/**/*.{ts,js,md}': () => 'pnpm --filter @vscode-adblock-syntax/server exec lint-staged',
'shared/**/*.{ts,js,md}': () => 'pnpm --filter @vscode-adblock-syntax/shared exec lint-staged',
'syntaxes/**/*.{ts,js,md,yaml-tmlanguage}': () => 'pnpm --filter @vscode-adblock-syntax/syntaxes exec lint-staged',
};
36 changes: 29 additions & 7 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
{
"ul-indent": { "indent": 4 },
"ul-indent": {
"indent": 4
},
"line-length": {
"stern": true,
"line_length": 120
},
"no-multiple-blanks": { "maximum": 2 },
"no-inline-html": { "allowed_elements": ["a", "details", "summary", "img", "pre"]},
"no-duplicate-heading": { "siblings_only": true },
"no-multiple-blanks": {
"maximum": 2
},
"no-inline-html": {
"allowed_elements": [
"a",
"details",
"summary",
"img",
"pre",
"div",
"p"
]
},
"no-duplicate-heading": {
"siblings_only": true
},
"no-blanks-blockquote": false,
"no-bare-urls": false,
"ul-style": { "style": "dash" },
"blanks-around-fences": { "list_items": false },
"emphasis-style": { "style": "asterisk" }
"ul-style": {
"style": "dash"
},
"blanks-around-fences": {
"list_items": false
},
"emphasis-style": {
"style": "asterisk"
}
}
14 changes: 8 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"recommendations": [
"connor4312.esbuild-problem-matchers",
"dbaeumer.vscode-eslint"
]
}
{
"recommendations": [
"dbaeumer.vscode-eslint",
"davidanson.vscode-markdownlint",
"vitest.explorer",
"editorconfig.editorconfig"
]
}
160 changes: 151 additions & 9 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,81 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Shared lib rspack build (watch)",
"type": "shell",
"command": "pnpm exec cross-env NODE_ENV=dev pnpm --silent --filter @vscode-adblock-syntax/shared rspack --watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"reveal": "never",
"close": true
},
"problemMatcher": {
"owner": "rspack",
"source": "rspack",
"fileLocation": [
"relative",
"${workspaceFolder}/shared"
],
"pattern": [
{
// ERROR in ./src/server.ts 8:0-25
"regexp": "^(ERROR|WARNING) in\\s+(.+)\\s+(\\d+):(\\d+)(?:-\\d+)?",
"severity": 1, // ERROR | WARNING
"file": 2, // ./src/server.ts
"line": 3, // 8
"column": 4 // 0
},
{
// × Module not found: ...
"regexp": "^\\s+×\\s+(.*)$",
"message": 1
}
],
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": ".*"
},
// e.g.: "Rspack 1.6.7 compiled with 1 error in 71 ms"
"endsPattern": {
"regexp": "Rspack .* compiled .*"
}
}
},
},
{
"label": "Shared lib tsc build (watch)",
"type": "shell",
"command": "pnpm --silent --filter @vscode-adblock-syntax/shared exec tsc --project tsconfig.build.json --emitDeclarationOnly --watch --preserveWatchOutput",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"reveal": "never",
"close": true
},
"problemMatcher": "$tsc-watch"
},
{
"label": "Shared lib dev build (watch)",
"dependsOn": [
"Shared lib rspack build (watch)",
"Shared lib tsc build (watch)"
]
},
{
"label": "Server dev build (watch)",
"type": "npm",
"script": "watch:server",
"type": "shell",
"command": "pnpm exec cross-env NODE_ENV=dev pnpm --silent --filter @vscode-adblock-syntax/server build --watch",
"isBackground": true,
"group": {
"kind": "build",
Expand All @@ -15,12 +86,47 @@
"reveal": "never",
"close": true
},
"problemMatcher": "$esbuild-watch",
"problemMatcher": {
"owner": "rspack",
"source": "rspack",
"fileLocation": [
"relative",
"${workspaceFolder}/server"
],
"pattern": [
{
// ERROR in ./src/server.ts 8:0-25
"regexp": "^(ERROR|WARNING) in\\s+(.+)\\s+(\\d+):(\\d+)(?:-\\d+)?",
"severity": 1, // ERROR | WARNING
"file": 2, // ./src/server.ts
"line": 3, // 8
"column": 4 // 0
},
{
// × Module not found: ...
"regexp": "^\\s+×\\s+(.*)$",
"message": 1
}
],
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": ".*"
},
// e.g.: "Rspack 1.6.7 compiled with 1 error in 71 ms"
"endsPattern": {
"regexp": "Rspack .* compiled .*"
}
}
},
"dependsOn": [
"Shared lib dev build (watch)"
]
},
{
"label": "Client dev build (watch)",
"type": "npm",
"script": "watch:client",
"type": "shell",
"command": "pnpm exec cross-env NODE_ENV=dev pnpm --silent --filter @vscode-adblock-syntax/client build --watch",
"isBackground": true,
"group": {
"kind": "build",
Expand All @@ -31,12 +137,47 @@
"reveal": "never",
"close": true
},
"problemMatcher": "$esbuild-watch",
"problemMatcher": {
"owner": "rspack",
"source": "rspack",
"fileLocation": [
"relative",
"${workspaceFolder}/client"
],
"pattern": [
{
// ERROR in ./src/server.ts 8:0-25
"regexp": "^(ERROR|WARNING) in\\s+(.+)\\s+(\\d+):(\\d+)(?:-\\d+)?",
"severity": 1, // ERROR | WARNING
"file": 2, // ./src/server.ts
"line": 3, // 8
"column": 4 // 0
},
{
// × Module not found: ...
"regexp": "^\\s+×\\s+(.*)$",
"message": 1
}
],
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": ".*"
},
// e.g.: "Rspack 1.6.7 compiled with 1 error in 71 ms"
"endsPattern": {
"regexp": "Rspack .* compiled .*"
}
}
},
"dependsOn": [
"Shared lib dev build (watch)"
]
},
{
"label": "Grammar dev build (watch)",
"type": "npm",
"script": "watch:grammar",
"type": "shell",
"command": "pnpm exec cross-env NODE_ENV=dev pnpm --silent --filter @vscode-adblock-syntax/syntaxes build --watch",
"isBackground": true,
"group": {
"kind": "build",
Expand Down Expand Up @@ -76,10 +217,11 @@
"label": "Extension dev build (watch)",
"dependsOrder": "sequence",
"dependsOn": [
"Shared lib dev build (watch)",
"Grammar dev build (watch)",
"Server dev build (watch)",
"Client dev build (watch)"
],
]
},
// Terminate watch tasks after debugging
// https://github.com/microsoft/vscode/issues/90786#issuecomment-587415345
Expand Down
Loading