Skip to content

Commit 9048e21

Browse files
authored
chore: lint docs/src/_data js files (#18335)
1 parent 4820790 commit 9048e21

6 files changed

Lines changed: 31 additions & 19 deletions

File tree

‎docs/src/_data/eslintVersions.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
* @author Milos Djermanovic
44
*/
55

6+
"use strict";
7+
68
//-----------------------------------------------------------------------------
79
// Requirements
810
//-----------------------------------------------------------------------------
911

10-
const eleventyFetch = require("@11ty/eleventy-fetch");
12+
const eleventyFetch = require("@11ty/eleventy-fetch");
1113

1214
//-----------------------------------------------------------------------------
1315
// Exports
@@ -35,7 +37,7 @@ module.exports = async function() {
3537

3638
foundItemForThisBranch ||= isItemForThisBranch;
3739

38-
const isNumberVersion = /^\d/.test(item.version); // `false` for HEAD
40+
const isNumberVersion = /^\d/u.test(item.version); // `false` for HEAD
3941

4042
if (isNumberVersion) {
4143

@@ -62,8 +64,8 @@ module.exports = async function() {
6264
display: "",
6365
path: "",
6466
selected: true
65-
})
67+
});
6668
}
6769

6870
return data;
69-
}
71+
};

‎docs/src/_data/helpers.js‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
"use strict";
2+
13
module.exports = {
4+
25
/**
36
* Returns some attributes based on whether the link is active or
47
* a parent of an active item
5-
*
6-
* @param {String} itemUrl is the link in question
7-
* @param {String} pageUrl is the page context
8-
* @returns {String} is the attributes or empty
8+
* @param {string} itemUrl is the link in question
9+
* @param {string} pageUrl is the page context
10+
* @returns {string} is the attributes or empty
911
*/
10-
getLinkActiveState: function(itemUrl, pageUrl) {
11-
let response = '';
12+
getLinkActiveState(itemUrl, pageUrl) {
13+
let response = "";
1214

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

2123
return response;
2224
},
23-
excludeThis: function(arr, pageUrl) {
24-
var newArray = [];
25+
excludeThis(arr, pageUrl) {
26+
const newArray = [];
27+
2528
arr.forEach(item => {
26-
if(item.url !== pageUrl) newArray.push(item);
29+
if (item.url !== pageUrl) {
30+
newArray.push(item);
31+
}
2732
});
2833
return newArray;
2934
}

‎docs/src/_data/layout.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
"use strict";
2+
13
module.exports = "doc.html";

‎docs/src/_data/rules_categories.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
module.exports = eleventy => {
24
const PATH_PREFIX = eleventy.PATH_PREFIX;
35

@@ -22,5 +24,5 @@ module.exports = eleventy => {
2224
displayName: "Removed",
2325
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:`
2426
}
25-
}
27+
};
2628
};

‎docs/src/_data/site.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* @author Nicholas C. Zakas
44
*/
55

6+
"use strict";
7+
68
//-----------------------------------------------------------------------------
79
// Requirements
810
//-----------------------------------------------------------------------------
@@ -16,11 +18,11 @@ const yaml = require("js-yaml");
1618
//-----------------------------------------------------------------------------
1719

1820
module.exports = function(eleventy) {
19-
21+
2022
const siteName = eleventy.site_name;
2123
const siteDataFile = path.resolve(__dirname, `sites/${siteName}.yml`);
2224

2325
fs.statSync(siteDataFile);
2426

2527
return yaml.load(fs.readFileSync(siteDataFile));
26-
}
28+
};

‎eslint.config.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ module.exports = [
7979
ignores: [
8080
"build/**",
8181
"coverage/**",
82-
"docs/*",
83-
"!docs/*.js",
84-
"!docs/tools/",
82+
"docs/!(src|tools)/",
83+
"docs/src/!(_data)",
8584
"jsdoc/**",
8685
"templates/**",
8786
"tests/bench/**",

0 commit comments

Comments
 (0)