1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 const fs = require("fs");
10 const path = require("path");
12 function readFile(path) {
14 .readFileSync(path, { encoding: "utf-8" })
16 .filter(p => p && !p.startsWith("#"));
21 path.join(__dirname, "tools", "rewriting", "ThirdPartyPaths.txt")
23 ...readFile(path.join(__dirname, "tools", "rewriting", "Generated.txt")),
27 extends: ["stylelint-config-recommended"],
30 /* Disabled because of `-moz-element(#foo)` which gets misparsed. */
31 "color-no-invalid-hex": null,
32 "font-family-no-missing-generic-family-keyword": [
45 "function-no-unknown": [
49 "light-dark" /* Used for color-scheme dependent colors */,
50 "-moz-image-rect" /* Used for cropping images */,
51 "add" /* Used in mathml.css */,
56 "no-descending-specificity": null,
57 "no-duplicate-selectors": null,
59 "property-no-unknown": [
62 ignoreProperties: ["overflow-clip-box"],
67 * XXXgijs: we would like to enable this, but we can't right now.
68 * This is because Gecko uses a number of custom pseudoclasses,
69 * and stylelint assumes that for `:unknown-pseudoclass(foo)`,
70 * `foo` should be a known type.
71 * This is tedious but workable for things like `-moz-locale-dir` where
72 * the set of acceptable values (ltr/rtl) is small.
73 * However, for tree cells, the set of values is unlimited (ie
74 * user-defined, based on atoms sent by the JS tree view APIs).
75 * There does not appear to be a way to exempt the contents of these
76 * unknown pseudoclasses, and as a result, this rule is not
77 * usable for us. The 'type' only includes the contents of the
78 * pseudoclass, not the pseudo itself, so we can't filter based on the
80 * Ideally, we would either create an option to the builtin rule
81 * in stylelint itself, or mimic the rule but exempt these, or
82 * add parser support for our custom pseudoclasses.
84 * For now, we just disable this rule.
86 "selector-type-no-unknown": null,
88 * See above - if we enabled this rule, we'd have to allow for a number
89 * of custom elements we use, which are listed here:
90 "selector-type-no-unknown": [
93 ignore: ["custom-elements"],
95 // Modern custom element / storybooked components:
97 // moz-locale-dir trips this rule for some reason:
100 // Migrated XBL elements not part of core XUL that we use at the moment:
105 "popupnotificationcontent",
106 // Legacy XUL elements:
107 // (the commented out ones used to be a thing and aren't used in-tree anymore)
207 "toolbarpaletteitem",
234 "selector-pseudo-class-no-unknown": [
237 ignorePseudoClasses: ["popover-open"],
244 // TODO: Bug 1851544: Re-enable the rule or change the rule set-up.
246 "browser/components/newtab/content-src/aboutwelcome/aboutwelcome.scss",
247 "browser/components/newtab/content-src/asrouter/components/ModalOverlay/_ModalOverlay.scss",
248 "browser/components/newtab/content-src/asrouter/templates/SimpleBelowSearchSnippet/_SimpleBelowSearchSnippet.scss",
249 "browser/components/newtab/content-src/components/CustomizeMenu/_CustomizeMenu.scss",
250 "browser/components/newtab/content-src/components/DiscoveryStreamComponents/CardGrid/_CardGrid.scss",
251 "browser/components/newtab/content-src/components/Search/_Search.scss",
254 "media-feature-range-notation": null,
259 customSyntax: "postcss-scss",
260 extends: "stylelint-config-recommended-scss",
263 files: "browser/components/newtab/**",
264 customSyntax: "postcss-scss",
265 extends: "stylelint-config-standard-scss",
267 "at-rule-disallowed-list": [
268 ["debug", "warn", "error"],
270 message: "Clean up %s directives before committing",
273 "at-rule-no-vendor-prefix": null,
274 "color-function-notation": null,
275 "color-hex-case": "upper",
276 "comment-empty-line-before": [
279 except: ["first-nested"],
280 ignore: ["after-comment", "stylelint-commands"],
283 "custom-property-empty-line-before": null,
284 "custom-property-pattern": null,
285 "declaration-block-no-duplicate-properties": true,
286 "declaration-block-no-redundant-longhand-properties": null,
287 "declaration-no-important": true,
288 "function-no-unknown": [
291 ignoreFunctions: ["div"],
294 "function-url-no-scheme-relative": true,
296 "keyframes-name-pattern": null,
297 "max-nesting-depth": [
300 ignore: ["blockless-at-rules", "pseudo-classes"],
303 "media-feature-name-no-vendor-prefix": null,
304 "no-descending-specificity": null,
305 "no-eol-whitespace": true,
306 "no-missing-end-of-source-newline": true,
307 "number-leading-zero": "always",
308 "number-no-trailing-zeros": true,
309 "property-disallowed-list": [
310 ["margin-left", "margin-right"],
312 message: "Use margin-inline instead of %s",
315 "property-no-unknown": true,
316 "property-no-vendor-prefix": null,
317 "scss/dollar-variable-empty-line-before": null,
318 "scss/double-slash-comment-empty-line-before": [
321 except: ["first-nested"],
322 ignore: ["between-comments", "stylelint-commands", "inside-block"],
325 "selector-class-pattern": null,
326 "selector-no-vendor-prefix": null,
333 "value-keyword-case": null,
334 "value-no-vendor-prefix": null,