Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format json files in using prettier #17525

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build/
l10n/
docs/
node_modules/
external/bcmaps/
external/builder/fixtures/
external/builder/fixtures_esprima/
external/quickjs/
test/tmp/
test/pdfs/
*~/
38 changes: 18 additions & 20 deletions extensions/chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,30 @@
},
"permissions": [
"fileBrowserHandler",
"webRequest", "webRequestBlocking",
"webRequest",
"webRequestBlocking",
"<all_urls>",
"tabs",
"webNavigation",
"storage"
],
"content_scripts": [{
"matches": [
"http://*/*",
"https://*/*",
"ftp://*/*",
"file://*/*"
],
"run_at": "document_start",
"all_frames": true,
"css": ["contentstyle.css"],
"js": ["contentscript.js"]
}],
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*", "ftp://*/*", "file://*/*"],
"run_at": "document_start",
"all_frames": true,
"css": ["contentstyle.css"],
"js": ["contentscript.js"]
}
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"file_browser_handlers": [{
"id": "open-as-pdf",
"default_title": "Open with PDF Viewer",
"file_filters": [
"filesystem:*.pdf"
]
}],
"file_browser_handlers": [
{
"id": "open-as-pdf",
"default_title": "Open with PDF Viewer",
"file_filters": ["filesystem:*.pdf"]
}
],
"storage": {
"managed_schema": "preferences_schema.json"
},
Expand Down
67 changes: 10 additions & 57 deletions extensions/chromium/preferences_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
"title": "Theme",
"description": "The theme to use.\n0 = Use system theme.\n1 = Light theme.\n2 = Dark theme.",
"type": "integer",
"enum": [
0,
1,
2
],
"enum": [0, 1, 2],
"default": 2
},
"showPreviousViewOnLoad": {
Expand All @@ -21,11 +17,7 @@
"title": "View position on load",
"description": "The position in the document upon load.\n -1 = Default (uses OpenAction if available, otherwise equal to `viewOnLoad = 0`).\n 0 = The last viewed page/position.\n 1 = The initial page/position.",
"type": "integer",
"enum": [
-1,
0,
1
],
"enum": [-1, 0, 1],
"default": 0
},
"defaultZoomDelay": {
Expand All @@ -45,13 +37,7 @@
"title": "Sidebar state on load",
"description": "Controls the state of the sidebar upon load.\n -1 = Default (uses PageMode if available, otherwise the last position if available/enabled).\n 0 = Do not show sidebar.\n 1 = Show thumbnails in sidebar.\n 2 = Show document outline in sidebar.\n 3 = Show attachments in sidebar.",
"type": "integer",
"enum": [
-1,
0,
1,
2,
3
],
"enum": [-1, 0, 1, 2, 3],
"default": -1
},
"enableHandToolOnLoad": {
Expand All @@ -63,10 +49,7 @@
"title": "Cursor tool on load",
"description": "The cursor tool that is enabled upon load.\n 0 = Text selection tool.\n 1 = Hand tool.",
"type": "integer",
"enum": [
0,
1
],
"enum": [0, 1],
"default": 0
},
"pdfBugEnabled": {
Expand Down Expand Up @@ -120,23 +103,14 @@
"title": "Text layer mode",
"description": "Controls if the text layer is enabled, and the selection mode that is used.\n 0 = Disabled.\n 1 = Enabled.",
"type": "integer",
"enum": [
0,
1
],
"enum": [0, 1],
"default": 1
},
"externalLinkTarget": {
"title": "External links target window",
"description": "Controls how external links will be opened.\n 0 = default.\n 1 = replaces current window.\n 2 = new window/tab.\n 3 = parent.\n 4 = in top window.",
"type": "integer",
"enum": [
0,
1,
2,
3,
4
],
"enum": [0, 1, 2, 3, 4],
"default": 0
},
"disablePageLabels": {
Expand All @@ -156,22 +130,12 @@
},
"annotationMode": {
"type": "integer",
"enum": [
0,
1,
2,
3
],
"enum": [0, 1, 2, 3],
"default": 2
},
"annotationEditorMode": {
"type": "integer",
"enum": [
-1,
0,
3,
15
],
"enum": [-1, 0, 3, 15],
"default": 0
},
"enablePermissions": {
Expand Down Expand Up @@ -202,25 +166,14 @@
"title": "Scroll mode on load",
"description": "Controls how the viewer scrolls upon load.\n -1 = Default (uses the last position if available/enabled).\n 3 = Page scrolling.\n 0 = Vertical scrolling.\n 1 = Horizontal scrolling.\n 2 = Wrapped scrolling.",
"type": "integer",
"enum": [
-1,
0,
1,
2,
3
],
"enum": [-1, 0, 1, 2, 3],
"default": -1
},
"spreadModeOnLoad": {
"title": "Spread mode on load",
"description": "Whether the viewer should join pages into spreads upon load.\n -1 = Default (uses the last position if available/enabled).\n 0 = No spreads.\n 1 = Odd spreads.\n 2 = Even spreads.",
"type": "integer",
"enum": [
-1,
0,
1,
2
],
"enum": [-1, 0, 1, 2],
"default": -1
},
"forcePageColors": {
Expand Down
24 changes: 21 additions & 3 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,7 @@ gulp.task(

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

// Ensure that we lint the Firefox specific *.jsm files too.
const esLintOptions = [
Expand All @@ -1959,6 +1959,16 @@ gulp.task("lint", function (done) {
styleLintOptions.push("--fix");
}

const prettierOptions = [
"node_modules/prettier/bin/prettier.cjs",
calixteman marked this conversation as resolved.
Show resolved Hide resolved
"**/*.json",
];
if (process.argv.includes("--fix")) {
prettierOptions.push("--log-level", "silent", "--write");
} else {
prettierOptions.push("--log-level", "warn", "--check");
}

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

const prettierProcess = startNode(prettierOptions, { stdio: "inherit" });
prettierProcess.on("close", function (prettierCode) {
if (prettierCode !== 0) {
done(new Error("Prettier failed."));
return;
}
console.log("files checked, no errors found");
done();
});
});
});
});
Expand Down
Loading