From d3c6b593187998a48ad1edd45c0fff0352171f96 Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Thu, 25 May 2023 19:27:50 +0300 Subject: [PATCH 1/6] fix readme heading --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32065945..40463cf1 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ so rules with this modifier support all other basic modifiers like `$domain`, `$ The value of the `$redirect` modifier must be the name of the resource that will be used for redirection. See the list of [available redirect resources](./wiki/about-redirects.md#redirect-resources). -#### Examples +### Examples * `||example.org/script.js$script,redirect=noopjs` — redirects all requests to `script.js` to the resource named `noopjs`. From f3e9b83bf8ef76a21313ebd8efef8c3b2da6cad3 Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Thu, 25 May 2023 19:35:10 +0300 Subject: [PATCH 2/6] improve markdownlint config --- .markdownlint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.markdownlint.json b/.markdownlint.json index 35e1ea86..137f75f6 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -7,5 +7,6 @@ "no-multiple-blanks": { "maximum": 2 }, "no-inline-html": { "allowed_elements": ["a"]}, "no-duplicate-header": { "siblings_only": true }, - "no-blanks-blockquote": false + "no-blanks-blockquote": false, + "ul-style": { "style": "dash" } } From 3cf0bbd287a70c368423e30a9f62a60d4bd68897 Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Thu, 25 May 2023 19:35:46 +0300 Subject: [PATCH 3/6] fix md lint errors --- CHANGELOG.md | 3 +- README.md | 98 ++++++++++++++++++++++++++-------------------------- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85eca474..a51775f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- ability for `prevent-element-src-loading` scriptlet to prevent inline `onerror` and match `link` tag [#276](https://github.com/AdguardTeam/Scriptlets/issues/276) +- ability for `prevent-element-src-loading` scriptlet to prevent inline `onerror` + and match `link` tag [#276](https://github.com/AdguardTeam/Scriptlets/issues/276) - new special value modifiers for `set-constant` [#316](https://github.com/AdguardTeam/Scriptlets/issues/316) ### Changed diff --git a/README.md b/README.md index 40463cf1..0970d28a 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,22 @@ AdGuard's Scriptlets and Redirect resources library which provides extended capabilities for content blocking. -* [Scriptlets](#scriptlets) - * [Syntax](#scriptlet-syntax) - * [Available scriptlets](./wiki/about-scriptlets.md#scriptlets) - * [Scriptlets compatibility table](./wiki/compatibility-table.md#scriptlets) - * [Trusted scriptlets](#trusted-scriptlets) - * [Restriction](#trusted-scriptlets-restriction) - * [Available trusted scriptlets](./wiki/about-trusted-scriptlets.md#trusted-scriptlets) -* [Redirect resources](#redirect-resources) - * [Syntax](#redirect-syntax) - * [Available redirect resources](./wiki/about-redirects.md#redirect-resources) - * [Redirect resources compatibility table](./wiki/compatibility-table.md#redirects) -* [How to build](#how-to-build) -* [How to test](#how-to-test) -* [How to update wiki](#how-to-update-wiki) -* [Browser compatibility](#browser-compatibility) -* [Projects using Scriptlets](#used-by) +- [Scriptlets](#scriptlets) + - [Syntax](#scriptlet-syntax) + - [Available scriptlets](./wiki/about-scriptlets.md#scriptlets) + - [Scriptlets compatibility table](./wiki/compatibility-table.md#scriptlets) + - [Trusted scriptlets](#trusted-scriptlets) + - [Restriction](#trusted-scriptlets-restriction) + - [Available trusted scriptlets](./wiki/about-trusted-scriptlets.md#trusted-scriptlets) +- [Redirect resources](#redirect-resources) + - [Syntax](#redirect-syntax) + - [Available redirect resources](./wiki/about-redirects.md#redirect-resources) + - [Redirect resources compatibility table](./wiki/compatibility-table.md#redirects) +- [How to build](#how-to-build) +- [How to test](#how-to-test) +- [How to update wiki](#how-to-update-wiki) +- [Browser compatibility](#browser-compatibility) +- [Projects using Scriptlets](#used-by) * * * @@ -34,24 +34,24 @@ Please note, that in order to achieve cross-blocker compatibility, we also suppo rule = [domains] "#%#//scriptlet(" scriptletName arguments ")" ``` -* `scriptletName` (mandatory) is a name of the scriptlet from AdGuard's scriptlets library -* `arguments` (optional) a list of `String` arguments (no other types of arguments are supported) +- `scriptletName` (mandatory) is a name of the scriptlet from AdGuard's scriptlets library +- `arguments` (optional) a list of `String` arguments (no other types of arguments are supported) > **Remarks** > -> * The meaning of the arguments depends on the scriptlet. +> - The meaning of the arguments depends on the scriptlet. > -> * Special characters in scriptlet argument must be escaped properly: -> * valid: -> * `'prop["nested"]'` -> * `"prop['nested']"` -> * `'prop[\'nested\']'` -> * `"prop[\"nested\"]"` -> * not valid: -> * `'prop['nested']'` -> * `"prop["nested"]"` +> - Special characters in scriptlet argument must be escaped properly: +> - valid: +> - `'prop["nested"]'` +> - `"prop['nested']"` +> - `'prop[\'nested\']'` +> - `"prop[\"nested\"]"` +> - not valid: +> - `'prop['nested']'` +> - `"prop["nested"]"` > -> * You can use either single or double quotes for the scriptlet name and arguments. +> - You can use either single or double quotes for the scriptlet name and arguments. > Single quote is recommended but not for cases when its usage makes readability worse, > e.g. `".css('display','block');"` is more preferred then `'.css(\'display\',\'block\');'`. @@ -66,8 +66,8 @@ example.org#%#//scriptlet('remove-class', 'branding', 'div[class^="inner"]') This rule applies the `abort-on-property-read` scriptlet on all pages of `example.org` and its subdomains, and passes one argument to it (`alert`). -* **[Scriptlets list](./wiki/about-scriptlets.md#scriptlets)** -* **[Scriptlets compatibility table](./wiki/compatibility-table.md#scriptlets)** +- **[Scriptlets list](./wiki/about-scriptlets.md#scriptlets)** +- **[Scriptlets compatibility table](./wiki/compatibility-table.md#scriptlets)** ### Trusted scriptlets @@ -81,9 +81,9 @@ to be easily distinguished from common scriptlets. Trusted scriptlets application must be restricted due to dangerous nature of their capabilities. Allowed sources of trusted scriptlets are: -* filters created by AdGuard Team, -* custom filters which were installed as `trusted`, -* user rules. +- filters created by AdGuard Team, +- custom filters which were installed as `trusted`, +- user rules. > Trusted scriptlets has no compatibility table as they are not compatible with any other blocker. @@ -109,10 +109,10 @@ See the list of [available redirect resources](./wiki/about-redirects.md#redirec ### Examples -* `||example.org/script.js$script,redirect=noopjs` — redirects all requests to `script.js` - to the resource named `noopjs`. -* `||example.org/test.mp4$media,redirect=noopmp4-1s` — requests to `example.org/test.mp4` will be redirected - to the resource named `noopmp4-1s`. +- `||example.org/script.js$script,redirect=noopjs` — redirects all requests to `script.js` + to the resource named `noopjs`. +- `||example.org/test.mp4$media,redirect=noopmp4-1s` — requests to `example.org/test.mp4` will be redirected + to the resource named `noopmp4-1s`. > `$redirect` rules priority is higher than the regular basic blocking rules' priority. > This means that if there's a basic blocking rule (even with `$important` modifier), @@ -123,8 +123,8 @@ See the list of [available redirect resources](./wiki/about-redirects.md#redirec > uBlock Origin specifies additional resource name `none` that can disable other redirect rules. > AdGuard does not support it, use `$badfilter` to disable specific rules. -* **[Redirect resources list](./wiki/about-redirects.md#redirect-resources)** -* **[Redirect resources compatibility table](./wiki/compatibility-table.md#redirects)** +- **[Redirect resources list](./wiki/about-redirects.md#redirect-resources)** +- **[Redirect resources compatibility table](./wiki/compatibility-table.md#redirects)** * * * @@ -618,12 +618,12 @@ There are two scripts to update wiki: ## Projects using Scriptlets -* [CoreLibs](https://github.com/AdguardTeam/CoreLibs) (updates automatically) -* [TSUrlFilter](https://github.com/AdguardTeam/tsurlfilter) -* [FiltersCompiler](https://github.com/AdguardTeam/FiltersCompiler) - (`tsurlfilter`'s update might be required as well) -* [AdguardBrowserExtension](https://github.com/AdguardTeam/AdguardBrowserExtension) - (`tsurlfilter` also should be updated) -* [AdguardForSafari](https://github.com/AdguardTeam/AdGuardForSafari) (`adguard-resources` should be updated) -* [AdguardForiOS](https://github.com/AdguardTeam/AdguardForiOS) - (`tsurlfilter` should be updated in `advanced-adblocker-web-extension`) +- [CoreLibs](https://github.com/AdguardTeam/CoreLibs) (updates automatically) +- [TSUrlFilter](https://github.com/AdguardTeam/tsurlfilter) +- [FiltersCompiler](https://github.com/AdguardTeam/FiltersCompiler) + (`tsurlfilter`'s update might be required as well) +- [AdguardBrowserExtension](https://github.com/AdguardTeam/AdguardBrowserExtension) + (`tsurlfilter` also should be updated) +- [AdguardForSafari](https://github.com/AdguardTeam/AdGuardForSafari) (`adguard-resources` should be updated) +- [AdguardForiOS](https://github.com/AdguardTeam/AdguardForiOS) + (`tsurlfilter` should be updated in `advanced-adblocker-web-extension`) From 75758adf36ea7bb5ad05db9318830e4c579f9228 Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Thu, 25 May 2023 22:42:45 +0300 Subject: [PATCH 4/6] add lint:md as separate script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c86eb69c..1224d5f5 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "browserstack": "babel-node scripts/build-tests.js && node browserstack.js", "gui-test": "babel-node scripts/build-tests.js && open http://localhost:8585 && node ./tests/server.js", "jest": "jest trusted-set-cookie-reload.spec.js", - "lint": "eslint --cache . && markdownlint .", + "lint": "eslint --cache . && yarn lint:md", + "lint:md": "markdownlint .", "lint-staged": "lint-staged", "prepare": "husky install", "wiki:build-table": "node ./scripts/check-sources-updates.js && node ./scripts/build-compatibility-table.js", From 9a1f2b662f3ffca5bac229b920907fd5b15508eb Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Thu, 25 May 2023 22:42:49 +0300 Subject: [PATCH 5/6] add lint:md on pre-commit --- .husky/pre-commit | 1 + 1 file changed, 1 insertion(+) diff --git a/.husky/pre-commit b/.husky/pre-commit index 8187307a..f924d5cc 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -16,4 +16,5 @@ if ([[ `git diff --cached --name-only --diff-filter=ACM` == *"dist/"* ]] && [[ ! fi yarn lint-staged +yarn lint:md yarn test From 55731458b7c550bfaf2d94102ca8ac922f477f73 Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Thu, 25 May 2023 22:44:50 +0300 Subject: [PATCH 6/6] fix test specs - run linter for pull requests --- bamboo-specs/test.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bamboo-specs/test.yaml b/bamboo-specs/test.yaml index 37eae877..b54d4b70 100644 --- a/bamboo-specs/test.yaml +++ b/bamboo-specs/test.yaml @@ -32,8 +32,16 @@ Build: ls -alt yarn install + + # build docs + yarn wiki:build-docs + node ./scripts/build-compatibility-table.js + # lint code and docs + yarn lint + yarn test yarn build + rm -rf node_modules artifacts: - name: scriptlets.corelibs.json