From 493eab7f11e917d42d4b6cce6a43d81ae4a7240c Mon Sep 17 00:00:00 2001 From: coopw <48886919+coopw1@users.noreply.github.com> Date: Tue, 21 Nov 2023 02:06:31 -0500 Subject: [PATCH 1/2] fix(brave): settings page (#349) * Fixing few little things on settings page * Update version number to 1.0.4 --- styles/brave-search/catppuccin.user.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/styles/brave-search/catppuccin.user.css b/styles/brave-search/catppuccin.user.css index 750c200a70..a19a41c8eb 100644 --- a/styles/brave-search/catppuccin.user.css +++ b/styles/brave-search/catppuccin.user.css @@ -2,7 +2,7 @@ @name Brave Search Catppuccin @namespace github.com/catppuccin/userstyles/styles/brave-search @homepageURL https://github.com/catppuccin/userstyles/tree/main/styles/brave-search -@version 1.0.3 +@version 1.0.4 @description Soothing pastel theme for Brave Search @author Catppuccin @updateURL https://github.com/catppuccin/userstyles/raw/main/styles/brave-search/catppuccin.user.css @@ -66,6 +66,8 @@ @color: @catppuccin[@@lookup][@color-scheme]; color-scheme: @color; + --color-container-highlight: @crust; + --search-serp-container-background: @mantle; --body-bg: @base; --bg-glassy: @mantle; --bg-1: @surface1; From c7344a51ba4ca294b1509b53574fc7c1a115e422 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Tue, 21 Nov 2023 02:32:25 -0500 Subject: [PATCH 2/2] build(lint): use native stylelint config resolution (#350) Co-authored-by: winston --- .stylelintrc.js | 170 +++++++++++++++++++++++++++++++++++ deno.json | 3 +- deno.lock | 24 +++-- scripts/lint/main.ts | 2 +- scripts/lint/stylelint.ts | 184 +++----------------------------------- 5 files changed, 194 insertions(+), 189 deletions(-) create mode 100644 .stylelintrc.js diff --git a/.stylelintrc.js b/.stylelintrc.js new file mode 100644 index 0000000000..5311c3f3cd --- /dev/null +++ b/.stylelintrc.js @@ -0,0 +1,170 @@ +/** + * @type {import('npm:stylelint').Config} + */ +const config = { + extends: "stylelint-config-standard", + customSyntax: "postcss-less", + rules: { + "selector-class-pattern": null, + "custom-property-pattern": null, + "selector-id-pattern": null, + + "rule-empty-line-before": null, + "comment-empty-line-before": null, + "custom-property-empty-line-before": null, + "at-rule-empty-line-before": null, + "declaration-empty-line-before": null, + + "property-no-vendor-prefix": null, + "alpha-value-notation": null, + "color-function-notation": null, + "hue-degree-notation": null, + + // Needed for Stylus v1.5.35 workaround, see #341 + "media-feature-range-notation": "prefix", + + // These are not invalid with Less. + "no-invalid-position-at-import-rule": null, + "no-invalid-double-slash-comments": null, + + "at-rule-disallowed-list": [ + ["/^font.*/"], + { + /** + * @param {string} atRule + */ + message: (atRule) => + `At-rule ${atRule} is not allowed in Catppuccin userstyles`, + }, + ], + "property-disallowed-list": [ + [ + // Disallow setting custom fonts. + "/font.*/", + + // Ideally we could disallow these, but CSS continues to be gross. + // "/animation.*/", + // "/transition.*/", + + // Prefer `border-color` over `border`, `outline-color` over `outline`, etc. + "border", + "outline", + ], + { + /** + * @param {string} prop + */ + message: (prop) => { + if (["border", "outline"].includes(prop)) { + return `Use \`${prop}-color\` instead of \`${prop}\``; + } else { + return `Property \`${prop}\` is not allowed in Catppuccin userstyles`; + } + }, + }, + ], + + "function-no-unknown": [ + true, + { + ignoreFunctions: [ + // Generated from https://lesscss.org/functions/ via `Array.from(document.querySelectorAll('.section-content h3.docs-heading'), heading => heading.textContent.replace('\n', ''))`. + "%", + "abs", + "acos", + "alpha", + "argb", + "asin", + "atan", + "average", + "blue", + "boolean", + "ceil", + "color", + "contrast", + "convert", + "cos", + "darken", + "data-uri", + "default", + "desaturate", + "difference", + "e", + "each", + "escape", + "exclusion", + "extract", + "fade", + "fadein", + "fadeout", + "floor", + "get-unit", + "green", + "greyscale", + "hardlight", + "hsl", + "hsla", + "hsv", + "hsva", + "hsvhue", + "hsvsaturation", + "hsvvalue", + "hue", + "if", + "image-height", + "image-size", + "image-width", + "iscolor", + "isdefined", + "isem", + "iskeyword", + "isnumber", + "ispercentage", + "ispixel", + "isruleset", + "isstring", + "isunit", + "isurl", + "length", + "lighten", + "lightness", + "luma", + "luminance", + "max", + "min", + "mix", + "mod", + "multiply", + "negation", + "overlay", + "percentage", + "pi", + "pow", + "range", + "red", + "replace", + "rgb", + "rgba", + "round", + "saturate", + "saturation", + "screen", + "shade", + "sin", + "softlight", + "spin", + "sqrt", + "svg-gradient", + "tan", + "tint", + "unit", + ], + }, + ], + "function-name-case": null, + + "no-descending-specificity": null, + }, +}; + +module.exports = config; diff --git a/deno.json b/deno.json index 6a4141c8e7..733a23bac5 100644 --- a/deno.json +++ b/deno.json @@ -16,5 +16,6 @@ "lint": "deno run -A ./scripts/lint/main.ts", "lint:fix": "deno task lint --fix", "update-types": "deno run -A ./scripts/update-types.ts" - } + }, + "nodeModulesDir": true } diff --git a/deno.lock b/deno.lock index 1cb61ec22a..88f8c9105a 100644 --- a/deno.lock +++ b/deno.lock @@ -1483,17 +1483,6 @@ } }, "remote": { - "https://deno.land/std@0.150.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", - "https://deno.land/std@0.150.0/_util/os.ts": "3b4c6e27febd119d36a416d7a97bd3b0251b77c88942c8f16ee5953ea13e2e49", - "https://deno.land/std@0.150.0/path/_constants.ts": "df1db3ffa6dd6d1252cc9617e5d72165cd2483df90e93833e13580687b6083c3", - "https://deno.land/std@0.150.0/path/_interface.ts": "ee3b431a336b80cf445441109d089b70d87d5e248f4f90ff906820889ecf8d09", - "https://deno.land/std@0.150.0/path/_util.ts": "c1e9686d0164e29f7d880b2158971d805b6e0efc3110d0b3e24e4b8af2190d2b", - "https://deno.land/std@0.150.0/path/common.ts": "bee563630abd2d97f99d83c96c2fa0cca7cee103e8cb4e7699ec4d5db7bd2633", - "https://deno.land/std@0.150.0/path/glob.ts": "cb5255638de1048973c3e69e420c77dc04f75755524cb3b2e160fe9277d939ee", - "https://deno.land/std@0.150.0/path/mod.ts": "4945b430b759b0b3d98f2a278542cbcf95e0ad2bd8eaaed3c67322b306b2b346", - "https://deno.land/std@0.150.0/path/posix.ts": "c1f7afe274290ea0b51da07ee205653b2964bd74909a82deb07b69a6cc383aaa", - "https://deno.land/std@0.150.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9", - "https://deno.land/std@0.150.0/path/win32.ts": "bd7549042e37879c68ff2f8576a25950abbfca1d696d41d82c7bca0b7e6f452c", "https://deno.land/std@0.206.0/assert/_constants.ts": "8a9da298c26750b28b326b297316cdde860bc237533b07e1337c021379e6b2a9", "https://deno.land/std@0.206.0/assert/_diff.ts": "58e1461cc61d8eb1eacbf2a010932bf6a05b79344b02ca38095f9b805795dc48", "https://deno.land/std@0.206.0/assert/_format.ts": "a69126e8a469009adf4cf2a50af889aca364c349797e63174884a52ff75cf4c7", @@ -1525,13 +1514,21 @@ "https://deno.land/std@0.206.0/assert/mod.ts": "37c49a26aae2b254bbe25723434dc28cd7532e444cf0b481a97c045d110ec085", "https://deno.land/std@0.206.0/assert/unimplemented.ts": "d56fbeecb1f108331a380f72e3e010a1f161baa6956fd0f7cf3e095ae1a4c75a", "https://deno.land/std@0.206.0/assert/unreachable.ts": "4600dc0baf7d9c15a7f7d234f00c23bca8f3eba8b140286aaca7aa998cf9a536", - "https://deno.land/std@0.206.0/collections/_utils.ts": "5114abc026ddef71207a79609b984614e66a63a4bda17d819d56b0e72c51527e", - "https://deno.land/std@0.206.0/collections/deep_merge.ts": "9db788ba56cb05b65c77166b789e58e125dff159b7f41bf4d19dc1cba19ecb8b", "https://deno.land/std@0.206.0/flags/mod.ts": "0948466fc437f017f00c0b972a422b3dc3317a790bcf326429d23182977eaf9f", "https://deno.land/std@0.206.0/fmt/colors.ts": "c51c4642678eb690dcf5ffee5918b675bf01a33fba82acf303701ae1a4f8c8d9", "https://deno.land/std@0.206.0/fmt/printf.ts": "b4ca7dc4b2323b2614c7d11b3e6dc80442e5d56c33665cdf9b9de0dabb80f9ec", "https://deno.land/std@0.206.0/fs/_util.ts": "fbf57dcdc9f7bc8128d60301eece608246971a7836a3bb1e78da75314f08b978", + "https://deno.land/std@0.206.0/fs/copy.ts": "ca19e4837965914471df38fbd61e16f9e8adfe89f9cffb0c83615c83ea3fc2bf", + "https://deno.land/std@0.206.0/fs/empty_dir.ts": "0b4a2508232446eed232ad1243dd4b0f07ac503a281633ae1324d1528df70964", + "https://deno.land/std@0.206.0/fs/ensure_dir.ts": "dc64c4c75c64721d4e3fb681f1382f803ff3d2868f08563ff923fdd20d071c40", + "https://deno.land/std@0.206.0/fs/ensure_file.ts": "39ac83cc283a20ec2735e956adf5de3e8a3334e0b6820547b5772f71c49ae083", + "https://deno.land/std@0.206.0/fs/ensure_link.ts": "c15e69c48556d78aae31b83e0c0ece04b7b8bc0951412f5b759aceb6fde7f0ac", + "https://deno.land/std@0.206.0/fs/ensure_symlink.ts": "b389c8568f0656d145ac7ece472afe710815cccbb2ebfd19da7978379ae143fe", + "https://deno.land/std@0.206.0/fs/eol.ts": "f1f2eb348a750c34500741987b21d65607f352cf7205f48f4319d417fff42842", "https://deno.land/std@0.206.0/fs/exists.ts": "cb59a853d84871d87acab0e7936a4dac11282957f8e195102c5a7acb42546bb8", + "https://deno.land/std@0.206.0/fs/expand_glob.ts": "4f98c508fc9e40d6311d2f7fd88aaad05235cc506388c22dda315e095305811d", + "https://deno.land/std@0.206.0/fs/mod.ts": "bc3d0acd488cc7b42627044caf47d72019846d459279544e1934418955ba4898", + "https://deno.land/std@0.206.0/fs/move.ts": "b4f8f46730b40c32ea3c0bc8eb0fd0e8139249a698883c7b3756424cf19785c9", "https://deno.land/std@0.206.0/fs/walk.ts": "c1e6b43f72a46e89b630140308bd51a4795d416a416b4cfb7cd4bd1e25946723", "https://deno.land/std@0.206.0/path/_common/assert_path.ts": "061e4d093d4ba5aebceb2c4da3318bfe3289e868570e9d3a8e327d91c2958946", "https://deno.land/std@0.206.0/path/_common/basename.ts": "0d978ff818f339cd3b1d09dc914881f4d15617432ae519c1b8fdc09ff8d3789a", @@ -1554,6 +1551,7 @@ "https://deno.land/std@0.206.0/path/extname.ts": "2da4e2490f3b48b7121d19fb4c91681a5e11bd6bd99df4f6f47d7a71bb6ecdf2", "https://deno.land/std@0.206.0/path/format.ts": "3457530cc85d1b4bab175f9ae73998b34fd456c830d01883169af0681b8894fb", "https://deno.land/std@0.206.0/path/from_file_url.ts": "e7fa233ea1dff9641e8d566153a24d95010110185a6f418dd2e32320926043f8", + "https://deno.land/std@0.206.0/path/glob.ts": "b8333cbb4aaaeb54ca6d6c43e0b69fb13c9481c69ed7a3c64a3d0d9daf2af769", "https://deno.land/std@0.206.0/path/glob_to_regexp.ts": "74d7448c471e293d03f05ccb968df4365fed6aaa508506b6325a8efdc01d8271", "https://deno.land/std@0.206.0/path/is_absolute.ts": "67232b41b860571c5b7537f4954c88d86ae2ba45e883ee37d3dec27b74909d13", "https://deno.land/std@0.206.0/path/is_glob.ts": "567dce5c6656bdedfc6b3ee6c0833e1e4db2b8dff6e62148e94a917f289c06ad", diff --git a/scripts/lint/main.ts b/scripts/lint/main.ts index 9fd557ab2e..236bab4709 100755 --- a/scripts/lint/main.ts +++ b/scripts/lint/main.ts @@ -44,7 +44,7 @@ for await (const entry of stylesheets) { ); // advanced linting with stylelint - lint(entry, content, flags.fix); + await lint(entry, content, flags.fix); } // if any files are missing, cause the workflow to fail diff --git a/scripts/lint/stylelint.ts b/scripts/lint/stylelint.ts index ce74d3a0be..81138ee047 100644 --- a/scripts/lint/stylelint.ts +++ b/scripts/lint/stylelint.ts @@ -1,187 +1,23 @@ -import { deepMerge } from "std/collections/deep_merge.ts"; - import * as color from "std/fmt/colors.ts"; +import { WalkEntry } from "std/fs/mod.ts"; +import { relative } from "std/path/mod.ts"; + +import "npm:postcss-less"; import stylelint from "npm:stylelint"; -import stylelintConfigStandard from "npm:stylelint-config-standard"; -import stylelintConfigRecommended from "npm:stylelint-config-recommended"; -import postcssLess from "npm:postcss-less"; +import "npm:stylelint-config-standard"; +import "npm:stylelint-config-recommended"; -import { log } from "@/lint/logger.ts"; -import { relative } from "https://deno.land/std@0.150.0/path/mod.ts"; import { REPO_ROOT } from "@/deps.ts"; -import { WalkEntry } from "std/fs/walk.ts"; - -const config: stylelint.Config = { - customSyntax: postcssLess, - rules: { - "selector-class-pattern": null, - "custom-property-pattern": null, - "selector-id-pattern": null, - - "rule-empty-line-before": null, - "comment-empty-line-before": null, - "custom-property-empty-line-before": null, - "at-rule-empty-line-before": null, - "declaration-empty-line-before": null, - - "property-no-vendor-prefix": null, - "alpha-value-notation": null, - "color-function-notation": null, - "hue-degree-notation": null, - - // less doesn't care about these - "no-invalid-position-at-import-rule": null, - "no-invalid-double-slash-comments": null, - - "at-rule-disallowed-list": [[ - "/^font.*/", - ], { - message: (atRule: string) => - `At-rule ${atRule} is not allowed in Catppuccin userstyles`, - }], - "property-disallowed-list": [[ - // disallow setting fonts - "/font.*/", - - // ideally we could disallow these, but CSS continues to be gross - // "/animation.*/", - // "/transition.*/", - - // prefer `border-color` over `border`, `outline-color` over `outline`, etc. - "border", - "outline", - ], { - message: (prop: string) => { - if (["border", "outline"].includes(prop)) { - return `Use \`${prop}-color\` instead of \`${prop}\``; - } else { - return `Property \`${prop}\` is not allowed in Catppuccin userstyles`; - } - }, - }], - - "function-no-unknown": [ - true, - { - ignoreFunctions: [ - // generated from https://lesscss.org/functions/ - // via `Array.from(document.querySelectorAll('.section-content h3.docs-heading'), heading => heading.textContent.replace('\n', ''))` - "%", - "abs", - "acos", - "alpha", - "argb", - "asin", - "atan", - "average", - "blue", - "boolean", - "ceil", - "color", - "contrast", - "convert", - "cos", - "darken", - "data-uri", - "default", - "desaturate", - "difference", - "e", - "each", - "escape", - "exclusion", - "extract", - "fade", - "fadein", - "fadeout", - "floor", - "get-unit", - "green", - "greyscale", - "hardlight", - "hsl", - "hsla", - "hsv", - "hsva", - "hsvhue", - "hsvsaturation", - "hsvvalue", - "hue", - "if", - "image-height", - "image-size", - "image-width", - "iscolor", - "isdefined", - "isem", - "iskeyword", - "isnumber", - "ispercentage", - "ispixel", - "isruleset", - "isstring", - "isunit", - "isurl", - "length", - "lighten", - "lightness", - "luma", - "luminance", - "max", - "min", - "mix", - "mod", - "multiply", - "negation", - "overlay", - "percentage", - "pi", - "pow", - "range", - "red", - "replace", - "rgb", - "rgba", - "round", - "saturate", - "saturation", - "screen", - "shade", - "sin", - "softlight", - "spin", - "sqrt", - "svg-gradient", - "tan", - "tint", - "unit", - ], - }, - ], - "function-name-case": null, - "no-descending-specificity": null, - - "media-feature-range-notation": "prefix", - }, -}; - -const base = deepMerge( - stylelintConfigRecommended, - { ...stylelintConfigStandard, extends: {} }, -); +import { log } from "@/lint/logger.ts"; -export const lint = (entry: WalkEntry, content: string, fix: boolean) => { +export const lint = async (entry: WalkEntry, content: string, fix: boolean) => { const file = relative(REPO_ROOT, entry.path); - stylelint.lint({ - config: deepMerge(base, config), - files: entry.path, - fix, - }) + await stylelint.lint({ files: entry.path, fix }) .then(({ results }) => { results.map((result) => { result.warnings.map((warning) => { - // some cleanup for fancier logging, dims the rule name + // Some cleanup for fancier logging, dims the rule name const message = warning.text?.replace( new RegExp(`\\(?${warning.rule}\\)?`), color.dim(`(${warning.rule})`),