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 docs/src/_data js files #18335

Merged
merged 1 commit into from
Apr 14, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/src/_data/eslintVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
* @author Milos Djermanovic
*/

"use strict";

//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------

const eleventyFetch = require("@11ty/eleventy-fetch");
const eleventyFetch = require("@11ty/eleventy-fetch");

//-----------------------------------------------------------------------------
// Exports
Expand Down Expand Up @@ -35,7 +37,7 @@ module.exports = async function() {

foundItemForThisBranch ||= isItemForThisBranch;

const isNumberVersion = /^\d/.test(item.version); // `false` for HEAD
const isNumberVersion = /^\d/u.test(item.version); // `false` for HEAD

if (isNumberVersion) {

Expand All @@ -62,8 +64,8 @@ module.exports = async function() {
display: "",
path: "",
selected: true
})
});
}

return data;
}
};
23 changes: 14 additions & 9 deletions docs/src/_data/helpers.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
"use strict";

module.exports = {

/**
* Returns some attributes based on whether the link is active or
* a parent of an active item
*
* @param {String} itemUrl is the link in question
* @param {String} pageUrl is the page context
* @returns {String} is the attributes or empty
* @param {string} itemUrl is the link in question
* @param {string} pageUrl is the page context
* @returns {string} is the attributes or empty
*/
getLinkActiveState: function(itemUrl, pageUrl) {
let response = '';
getLinkActiveState(itemUrl, pageUrl) {
let response = "";

if (itemUrl === pageUrl) {
response = ' aria-current="page" ';
Expand All @@ -20,10 +22,13 @@ module.exports = {

return response;
},
excludeThis: function(arr, pageUrl) {
var newArray = [];
excludeThis(arr, pageUrl) {
const newArray = [];

arr.forEach(item => {
if(item.url !== pageUrl) newArray.push(item);
if (item.url !== pageUrl) {
newArray.push(item);
}
});
return newArray;
}
Expand Down
2 changes: 2 additions & 0 deletions docs/src/_data/layout.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
"use strict";

module.exports = "doc.html";
4 changes: 3 additions & 1 deletion docs/src/_data/rules_categories.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

module.exports = eleventy => {
const PATH_PREFIX = eleventy.PATH_PREFIX;

Expand All @@ -22,5 +24,5 @@ module.exports = eleventy => {
displayName: "Removed",
description: `These rules from older versions of ESLint (before the <a href="${PATH_PREFIX}use/rule-deprecation">deprecation policy</a> existed) have been replaced by newer rules:`
}
}
};
};
6 changes: 4 additions & 2 deletions docs/src/_data/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @author Nicholas C. Zakas
*/

"use strict";

//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
Expand All @@ -16,11 +18,11 @@ const yaml = require("js-yaml");
//-----------------------------------------------------------------------------

module.exports = function(eleventy) {

const siteName = eleventy.site_name;
const siteDataFile = path.resolve(__dirname, `sites/${siteName}.yml`);

fs.statSync(siteDataFile);

return yaml.load(fs.readFileSync(siteDataFile));
}
};
5 changes: 2 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ module.exports = [
ignores: [
"build/**",
"coverage/**",
"docs/*",
"!docs/*.js",
"!docs/tools/",
"docs/!(src|tools)/",
"docs/src/!(_data)",
"jsdoc/**",
"templates/**",
"tests/bench/**",
Expand Down