Skip to content

Commit

Permalink
[Editor] Update the loading icon when wait for ML to take into accoun…
Browse files Browse the repository at this point in the history
…t prefered-reduced-motion setting

 * The icon has been updated in https://bugzilla.mozilla.org/show_bug.cgi?id=1908920;
 * Add a linter to check that a svg element doesn't have fill="context-fill" attribute.
  • Loading branch information
calixteman committed Aug 30, 2024
1 parent f6216df commit d6d0e67
Show file tree
Hide file tree
Showing 5 changed files with 953 additions and 118 deletions.
21 changes: 21 additions & 0 deletions .svglintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default {
rules: {
valid: true,

custom: [
(reporter, $, ast, { filename }) => {
reporter.name = "no-svg-fill-context-fill";

const svg = $.find("svg");
const fill = svg.attr("fill");
if (fill === "context-fill") {
reporter.error(
"Fill attribute on svg element must not be set to 'context-fill'",
svg[0],
ast
);
}
},
],
},
};
28 changes: 25 additions & 3 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@ gulp.task(

gulp.task("lint", function (done) {
console.log();
console.log("### Linting JS/CSS/JSON files");
console.log("### Linting JS/CSS/JSON/SVG files");

// Ensure that we lint the Firefox specific *.jsm files too.
const esLintOptions = [
Expand Down Expand Up @@ -1930,6 +1930,12 @@ gulp.task("lint", function (done) {
prettierOptions.push("--log-level", "warn", "--check");
}

const svgLintOptions = [
"node_modules/svglint/bin/cli.js",
"**/*.svg",
"--ci",
];

const esLintProcess = startNode(esLintOptions, { stdio: "inherit" });
esLintProcess.on("close", function (esLintCode) {
if (esLintCode !== 0) {
Expand All @@ -1950,8 +1956,24 @@ gulp.task("lint", function (done) {
done(new Error("Prettier failed."));
return;
}
console.log("files checked, no errors found");
done();

const svgLintProcess = startNode(svgLintOptions, {
stdio: "pipe",
});
svgLintProcess.stdout.setEncoding("utf8");
svgLintProcess.stdout.on("data", m => {
m = m.toString().replace(/-+ Summary -+.*/ms, "");
console.log(m);
});
svgLintProcess.on("close", function (svgLintCode) {
if (svgLintCode !== 0) {
done(new Error("svglint failed."));
return;
}

console.log("files checked, no errors found");
done();
});
});
});
});
Expand Down
Loading

0 comments on commit d6d0e67

Please sign in to comment.