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 "-moz-image-rect" /* Used for cropping images */,
50 "add" /* Used in mathml.css */,
55 "no-descending-specificity": null,
56 "no-duplicate-selectors": null,
58 "property-no-unknown": [
61 ignoreProperties: ["overflow-clip-box"],
66 * XXXgijs: we would like to enable this, but we can't right now.
67 * This is because Gecko uses a number of custom pseudoclasses,
68 * and stylelint assumes that for `:unknown-pseudoclass(foo)`,
69 * `foo` should be a known type.
70 * This is tedious but workable for things like `-moz-locale-dir` where
71 * the set of acceptable values (ltr/rtl) is small.
72 * However, for tree cells, the set of values is unlimited (ie
73 * user-defined, based on atoms sent by the JS tree view APIs).
74 * There does not appear to be a way to exempt the contents of these
75 * unknown pseudoclasses, and as a result, this rule is not
76 * usable for us. The 'type' only includes the contents of the
77 * pseudoclass, not the pseudo itself, so we can't filter based on the
79 * Ideally, we would either create an option to the builtin rule
80 * in stylelint itself, or mimic the rule but exempt these, or
81 * add parser support for our custom pseudoclasses.
83 * For now, we just disable this rule.
85 "selector-type-no-unknown": null,
87 * See above - if we enabled this rule, we'd have to allow for a number
88 * of custom elements we use, which are listed here:
89 "selector-type-no-unknown": [
92 ignore: ["custom-elements"],
94 // Modern custom element / storybooked components:
96 // moz-locale-dir trips this rule for some reason:
99 // Migrated XBL elements not part of core XUL that we use at the moment:
104 "popupnotificationcontent",
105 // Legacy XUL elements:
106 // (the commented out ones used to be a thing and aren't used in-tree anymore)
206 "toolbarpaletteitem",
233 "selector-pseudo-class-no-unknown": [
236 ignorePseudoClasses: ["popover-open"],
244 customSyntax: "postcss-scss",
245 extends: "stylelint-config-recommended-scss",
248 files: "browser/components/newtab/**",
249 customSyntax: "postcss-scss",
250 extends: "stylelint-config-standard-scss",
252 "at-rule-disallowed-list": [
253 ["debug", "warn", "error"],
255 message: "Clean up %s directives before committing",
258 "at-rule-no-vendor-prefix": null,
259 "color-function-notation": null,
260 "color-hex-case": "upper",
261 "comment-empty-line-before": [
264 except: ["first-nested"],
265 ignore: ["after-comment", "stylelint-commands"],
268 "custom-property-empty-line-before": null,
269 "custom-property-pattern": null,
270 "declaration-block-no-duplicate-properties": true,
271 "declaration-block-no-redundant-longhand-properties": null,
272 "declaration-no-important": true,
273 "function-no-unknown": [
276 ignoreFunctions: ["div"],
279 "function-url-no-scheme-relative": true,
281 "keyframes-name-pattern": null,
282 "max-nesting-depth": [
285 ignore: ["blockless-at-rules", "pseudo-classes"],
288 "media-feature-name-no-vendor-prefix": null,
289 "no-descending-specificity": null,
290 "no-eol-whitespace": true,
291 "no-missing-end-of-source-newline": true,
292 "number-leading-zero": "always",
293 "number-no-trailing-zeros": true,
294 "property-disallowed-list": [
295 ["margin-left", "margin-right"],
297 message: "Use margin-inline instead of %s",
300 "property-no-unknown": true,
301 "property-no-vendor-prefix": null,
302 "scss/dollar-variable-empty-line-before": null,
303 "scss/double-slash-comment-empty-line-before": [
306 except: ["first-nested"],
307 ignore: ["between-comments", "stylelint-commands", "inside-block"],
310 "selector-class-pattern": null,
311 "selector-no-vendor-prefix": null,
318 "value-keyword-case": null,
319 "value-no-vendor-prefix": null,