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

chore: lint more js files in docs #16964

Merged
merged 2 commits into from Mar 6, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions .eslintignore
@@ -1,7 +1,8 @@
/build/**
/coverage/**
/docs/**
!/docs/.eleventy.js
/docs/*
!/docs/*.js
!/docs/tools/
/jsdoc/**
/templates/**
/tests/bench/**
Expand Down
5 changes: 3 additions & 2 deletions .eslintrc.js
Expand Up @@ -83,9 +83,10 @@ module.exports = {
},
overrides: [
{
files: ["tools/*.js"],
files: ["tools/*.js", "docs/tools/*.js"],
rules: {
"no-console": "off"
"no-console": "off",
"n/no-process-exit": "off"
}
},
{
Expand Down
8 changes: 5 additions & 3 deletions docs/postcss.config.js
@@ -1,7 +1,9 @@
"use strict";

module.exports = {
plugins: [
require('autoprefixer'),
require('cssnano')
require("autoprefixer"),
require("cssnano")
],
map: false
}
};
20 changes: 14 additions & 6 deletions docs/tools/validate-links.js
@@ -1,3 +1,5 @@
"use strict";

const path = require("path");
const TapRender = require("@munter/tap-render");
const spot = require("tap-spot");
Expand All @@ -16,13 +18,19 @@ const skipPatterns = [
"/team",
"/donate",
"/docs/latest",
`src="null"`,
'src="null"'
];

const skipFilter = (report) =>
Object.values(report).some((value) =>
skipPatterns.some((pattern) => String(value).includes(pattern))
);
/**
* Filter function to mark tests as skipped.
* Tests for which this function returns `true' are not considered failed.
* @param {Object} report hyperlink's test report for a link.
* @returns {boolean} `true` if the report contains any of `skipPatterns`.
*/
function skipFilter(report) {
return Object.values(report).some(value =>
skipPatterns.some(pattern => String(value).includes(pattern)));
}

(async () => {
try {
Expand All @@ -35,7 +43,7 @@ const skipFilter = (report) =>
internalOnly: true,
pretty: true,
concurrency: 25,
skipFilter,
skipFilter
},
tapRenderInstance
);
Expand Down
8 changes: 5 additions & 3 deletions eslint.config.js
Expand Up @@ -85,7 +85,8 @@ module.exports = [
"build/**",
"coverage/**",
"docs/*",
"!docs/.eleventy.js",
"!docs/*.js",
"!docs/tools/",
"jsdoc/**",
"templates/**",
"tests/bench/**",
Expand Down Expand Up @@ -119,9 +120,10 @@ module.exports = [
}
},
{
files: ["tools/*.js"],
files: ["tools/*.js", "docs/tools/*.js"],
rules: {
"no-console": "off"
"no-console": "off",
"n/no-process-exit": "off"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion tools/fetch-docs-links.js
Expand Up @@ -99,7 +99,7 @@ async function fetchLinkMeta(url) {
console.error("Could not fetch data for", url);
console.error(ex.message);
console.error(ex.stack);
process.exit(1); // eslint-disable-line n/no-process-exit -- used in tools
process.exit(1);
}
}
}
Expand Down