Skip to content

Commit

Permalink
chore: lint more js files in docs (#16964)
Browse files Browse the repository at this point in the history
* chore: lint more js files in docs

* removed unused disable directive
  • Loading branch information
mdjermanovic committed Mar 6, 2023
1 parent 3398431 commit 75acdd2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 17 deletions.
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

0 comments on commit 75acdd2

Please sign in to comment.