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 "max-nesting-depth": [
59 ignore: ["blockless-at-rules"],
63 "no-descending-specificity": null,
64 "no-duplicate-selectors": null,
66 "property-no-unknown": [
69 ignoreProperties: ["overflow-clip-box"],
74 * XXXgijs: we would like to enable this, but we can't right now.
75 * This is because Gecko uses a number of custom pseudoclasses,
76 * and stylelint assumes that for `:unknown-pseudoclass(foo)`,
77 * `foo` should be a known type.
78 * This is tedious but workable for things like `-moz-locale-dir` where
79 * the set of acceptable values (ltr/rtl) is small.
80 * However, for tree cells, the set of values is unlimited (ie
81 * user-defined, based on atoms sent by the JS tree view APIs).
82 * There does not appear to be a way to exempt the contents of these
83 * unknown pseudoclasses, and as a result, this rule is not
84 * usable for us. The 'type' only includes the contents of the
85 * pseudoclass, not the pseudo itself, so we can't filter based on the
87 * Ideally, we would either create an option to the builtin rule
88 * in stylelint itself, or mimic the rule but exempt these, or
89 * add parser support for our custom pseudoclasses.
91 * For now, we just disable this rule.
93 "selector-type-no-unknown": null,
95 * See above - if we enabled this rule, we'd have to allow for a number
96 * of custom elements we use, which are listed here:
97 "selector-type-no-unknown": [
100 ignore: ["custom-elements"],
102 // Modern custom element / storybooked components:
104 // moz-locale-dir trips this rule for some reason:
107 // Migrated XBL elements not part of core XUL that we use at the moment:
112 "popupnotificationcontent",
113 // Legacy XUL elements:
114 // (the commented out ones used to be a thing and aren't used in-tree anymore)
214 "toolbarpaletteitem",
241 "selector-pseudo-class-no-unknown": [
244 ignorePseudoClasses: ["popover-open"],
252 customSyntax: "postcss-scss",
253 extends: "stylelint-config-recommended-scss",
256 files: "browser/components/newtab/**",
257 customSyntax: "postcss-scss",
258 extends: "stylelint-config-standard-scss",
260 "at-rule-disallowed-list": [
261 ["debug", "warn", "error"],
263 message: "Clean up %s directives before committing",
266 "at-rule-no-vendor-prefix": null,
267 "color-function-notation": null,
268 "color-hex-case": "upper",
269 "comment-empty-line-before": [
272 except: ["first-nested"],
273 ignore: ["after-comment", "stylelint-commands"],
276 "custom-property-empty-line-before": null,
277 "custom-property-pattern": null,
278 "declaration-block-no-duplicate-properties": true,
279 "declaration-block-no-redundant-longhand-properties": null,
280 "declaration-no-important": true,
281 "function-no-unknown": [
284 ignoreFunctions: ["div"],
287 "function-url-no-scheme-relative": true,
289 "keyframes-name-pattern": null,
290 "media-feature-name-no-vendor-prefix": null,
291 "no-descending-specificity": null,
292 "no-eol-whitespace": true,
293 "no-missing-end-of-source-newline": true,
294 "number-leading-zero": "always",
295 "number-no-trailing-zeros": true,
296 "property-disallowed-list": [
297 ["margin-left", "margin-right"],
299 message: "Use margin-inline instead of %s",
302 "property-no-unknown": true,
303 "property-no-vendor-prefix": null,
304 "scss/dollar-variable-empty-line-before": null,
305 "scss/double-slash-comment-empty-line-before": [
308 except: ["first-nested"],
309 ignore: ["between-comments", "stylelint-commands", "inside-block"],
312 "selector-class-pattern": null,
313 "selector-no-vendor-prefix": null,
320 "value-keyword-case": null,
321 "value-no-vendor-prefix": null,