Skip to content

Commit 9f79f0c

Browse files
authored
Merge pull request #7463 from layer5io/chore/remove-unused-packages
Chore: Remove unused packages and fix lint warnings
2 parents 2964106 + 6bec245 commit 9f79f0c

File tree

7 files changed

+132
-3982
lines changed

7 files changed

+132
-3982
lines changed

eslint.config.js

Lines changed: 74 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ const js = require("@eslint/js");
55
const mdxParser = require("eslint-mdx");
66
const mdxPlugin = require("eslint-plugin-mdx");
77

8-
const {
9-
FlatCompat,
10-
} = require("@eslint/eslintrc");
8+
const { FlatCompat } = require("@eslint/eslintrc");
119

1210
const compat = new FlatCompat({
1311
baseDirectory: __dirname,
1412
recommendedConfig: js.configs.recommended,
15-
allConfig: js.configs.all
13+
allConfig: js.configs.all,
1614
});
1715

1816
module.exports = [
@@ -34,49 +32,58 @@ module.exports = [
3432
},
3533

3634
parser: babelParser,
37-
"ecmaVersion": 2018,
38-
"sourceType": "module",
35+
ecmaVersion: 2018,
36+
sourceType: "module",
3937

4038
parserOptions: {
41-
"ecmaFeatures": {
42-
"jsx": true,
39+
ecmaFeatures: {
40+
jsx: true,
4341
},
4442
},
4543
},
4644

47-
"settings": {
48-
"react": {
49-
"version": "detect",
45+
settings: {
46+
react: {
47+
version: "detect",
5048
},
5149
},
5250

5351
plugins: {
5452
react,
5553
},
5654

57-
"rules": {
55+
rules: {
5856
"array-bracket-spacing": ["error", "never"],
5957
"comma-style": ["error"],
6058

61-
"arrow-spacing": ["error", {
62-
"after": true,
63-
"before": true,
64-
}],
59+
"arrow-spacing": [
60+
"error",
61+
{
62+
after: true,
63+
before: true,
64+
},
65+
],
6566

6667
"block-scoped-var": "error",
6768
"block-spacing": "error",
6869
"brace-style": ["error", "1tbs"],
6970
"jsx-quotes": ["error", "prefer-double"],
7071
"keyword-spacing": "error",
7172

72-
"key-spacing": ["error", {
73-
"beforeColon": false,
74-
"afterColon": true,
75-
}],
73+
"key-spacing": [
74+
"error",
75+
{
76+
beforeColon: false,
77+
afterColon: true,
78+
},
79+
],
7680

77-
"no-unused-vars": ["warn", {
78-
"varsIgnorePattern": "React",
79-
}],
81+
"no-unused-vars": [
82+
"warn",
83+
{
84+
varsIgnorePattern: "React",
85+
},
86+
],
8087

8188
"no-trailing-spaces": "error",
8289
"object-curly-spacing": ["error", "always"],
@@ -86,43 +93,53 @@ module.exports = [
8693
"react/jsx-no-duplicate-props": [0],
8794
"react/style-prop-object": "error",
8895
"react/jsx-closing-tag-location": ["error", "line-aligned"],
89-
"react/jsx-closing-bracket-location": ["error", {
90-
"nonEmpty": "line-aligned",
91-
"selfClosing": "line-aligned",
92-
}],
93-
94-
"indent": ["error", 2, {
95-
"FunctionExpression": {
96-
"parameters": "first",
97-
},
98-
99-
"FunctionDeclaration": {
100-
"parameters": "first",
96+
"react/jsx-closing-bracket-location": [
97+
"error",
98+
{
99+
nonEmpty: "line-aligned",
100+
selfClosing: "line-aligned",
101101
},
102-
103-
"MemberExpression": 1,
104-
"SwitchCase": 1,
105-
"outerIIFEBody": 0,
106-
107-
"VariableDeclarator": {
108-
"var": 2,
109-
"let": 2,
110-
"const": 3,
102+
],
103+
104+
indent: [
105+
"error",
106+
2,
107+
{
108+
FunctionExpression: {
109+
parameters: "first",
110+
},
111+
112+
FunctionDeclaration: {
113+
parameters: "first",
114+
},
115+
116+
MemberExpression: 1,
117+
SwitchCase: 1,
118+
outerIIFEBody: 0,
119+
120+
VariableDeclarator: {
121+
var: 2,
122+
let: 2,
123+
const: 3,
124+
},
125+
126+
ignoredNodes: ["TemplateLiteral"],
111127
},
112-
113-
ignoredNodes: ["TemplateLiteral"],
114-
}],
128+
],
115129

116130
"linebreak-style": ["error", "unix"],
117-
"quotes": ["error", "double"],
118-
"semi": ["error", "always"],
119-
"strict": 0,
131+
quotes: ["error", "double"],
132+
semi: ["error", "always"],
133+
strict: 0,
120134
"valid-typeof": 0,
121135

122-
"space-unary-ops": [1, {
123-
"words": true,
124-
"nonwords": false,
125-
}],
136+
"space-unary-ops": [
137+
1,
138+
{
139+
words: true,
140+
nonwords: false,
141+
},
142+
],
126143

127144
"space-infix-ops": ["error"],
128145
},
@@ -153,6 +170,7 @@ module.exports = [
153170
{
154171
ignores: [
155172
"**/node_modules/",
173+
"**/.claude/",
156174
"**/*.test.js",
157175
"src/utils/",
158176
"**/.cache/",
@@ -172,6 +190,6 @@ module.exports = [
172190
"**/package-lock.json",
173191
"**/static/",
174192
"content-learn/**/index.mdx",
175-
]
176-
}
193+
],
194+
},
177195
];

gatsby-node.js

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ const {
1717

1818
const HEAVY_COLLECTIONS = new Set(["members", "integrations"]);
1919
const isFullSiteBuild = process.env.BUILD_FULL_SITE !== "false";
20-
const shouldIncludeCollection = (collection) => isFullSiteBuild || !HEAVY_COLLECTIONS.has(collection);
20+
const shouldIncludeCollection = (collection) =>
21+
isFullSiteBuild || !HEAVY_COLLECTIONS.has(collection);
2122

2223
const { loadRedirects } = require("./src/utils/redirects.js");
2324

2425
exports.createPages = async ({ actions, graphql, reporter }) => {
2526
const { createRedirect } = actions;
2627
const redirects = loadRedirects();
27-
redirects.forEach(redirect => createRedirect(redirect)); // Handles all hardcoded ones dynamically
28+
redirects.forEach((redirect) => createRedirect(redirect)); // Handles all hardcoded ones dynamically
2829
// Create Pages
2930
const { createPage } = actions;
3031

@@ -49,7 +50,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
4950

5051
const blogPostTemplate = path.resolve("src/templates/blog-single.js");
5152
const blogCategoryListTemplate = path.resolve(
52-
"src/templates/blog-category-list.js"
53+
"src/templates/blog-category-list.js",
5354
);
5455
const blogTagListTemplate = path.resolve("src/templates/blog-tag-list.js");
5556

@@ -61,10 +62,8 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
6162

6263
const BookPostTemplate = path.resolve("src/templates/book-single.js");
6364

64-
const ProgramPostTemplate = path.resolve("src/templates/program-single.js");
65-
6665
const MultiProgramPostTemplate = path.resolve(
67-
"src/templates/program-multiple.js"
66+
"src/templates/program-multiple.js",
6867
);
6968

7069
const CareerPostTemplate = path.resolve("src/templates/career-single.js");
@@ -79,7 +78,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
7978

8079
const resourcePostTemplate = path.resolve("src/templates/resource-single.js");
8180
const integrationTemplate = path.resolve("src/templates/integrations.js");
82-
const LitePlaceholderTemplate = path.resolve("src/templates/lite-placeholder.js");
81+
const LitePlaceholderTemplate = path.resolve(
82+
"src/templates/lite-placeholder.js",
83+
);
8384

8485
const memberBioQuery = isFullSiteBuild
8586
? `
@@ -108,7 +109,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
108109

109110
const HandbookTemplate = path.resolve("src/templates/handbook-template.js");
110111

111-
112112
const res = await graphql(`
113113
{
114114
allPosts: allMdx(filter: { frontmatter: { published: { eq: true } } }) {
@@ -241,7 +241,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
241241

242242
const handbook = res.data.handbookPages.nodes;
243243

244-
245244
const singleWorkshop = res.data.singleWorkshop.nodes;
246245
const labs = res.data.labs.nodes;
247246

@@ -414,7 +413,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
414413
});
415414
});
416415

417-
418416
programs.forEach((program) => {
419417
envCreatePage({
420418
path: `/programs/${program.frontmatter.programSlug}`,
@@ -512,7 +510,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
512510
}
513511
});
514512

515-
const components = componentsData.map((component) => component.src.replace("/", ""));
513+
const components = componentsData.map((component) =>
514+
component.src.replace("/", ""),
515+
);
516516
const createComponentPages = (createPage, components) => {
517517
const pageTypes = [
518518
{ suffix: "", file: "index.js" },
@@ -534,7 +534,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
534534
console.error(`Error creating page for "${pagePath}":`, error);
535535
}
536536
} else {
537-
console.info(`Skipping creating page "${pagePath}" - file not found: "${componentPath}"`);
537+
console.info(
538+
`Skipping creating page "${pagePath}" - file not found: "${componentPath}"`,
539+
);
538540
}
539541
});
540542
});
@@ -650,7 +652,7 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
650652
case "blog":
651653
if (node.frontmatter.published)
652654
slug = `/${collection}/${slugify(
653-
node.frontmatter.category
655+
node.frontmatter.category,
654656
)}/${slugify(node.frontmatter.title)}`;
655657
break;
656658
case "news":
@@ -661,11 +663,11 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
661663
case "kanvas-labs":
662664
slug = `/learn/${collection}/${slugify(node.frontmatter.title)}`;
663665
break;
664-
case "resources":
665-
if (node.frontmatter.published)
666-
slug = `/${collection}/${slugify(
667-
node.frontmatter.category
668-
)}/${slugify(node.frontmatter.title)}`;
666+
case "resources":
667+
if (node.frontmatter.published)
668+
slug = `/${collection}/${slugify(
669+
node.frontmatter.category,
670+
)}/${slugify(node.frontmatter.title)}`;
669671
break;
670672
case "members":
671673
if (node.frontmatter.published)
@@ -801,11 +803,16 @@ exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
801803
});
802804

803805
// Reduce memory pressure by disabling sourcemaps in dev and build
804-
if (stage === "develop" || stage === "develop-html" || stage === "build-javascript" || stage === "build-html") {
806+
if (
807+
stage === "develop" ||
808+
stage === "develop-html" ||
809+
stage === "build-javascript" ||
810+
stage === "build-html"
811+
) {
805812
const config = getConfig();
806813
config.devtool = false;
807814
const miniCssExtractPlugin = config.plugins.find(
808-
(plugin) => plugin.constructor.name === "MiniCssExtractPlugin"
815+
(plugin) => plugin.constructor.name === "MiniCssExtractPlugin",
809816
);
810817

811818
if (miniCssExtractPlugin) {
@@ -882,8 +889,6 @@ exports.createSchemaCustomization = ({ actions }) => {
882889
createTypes(typeDefs);
883890
};
884891

885-
886-
887892
exports.onPostBuild = async ({ graphql, reporter }) => {
888893
const result = await graphql(`
889894
{
@@ -912,4 +917,4 @@ exports.onPostBuild = async ({ graphql, reporter }) => {
912917
// Optionally, write the result to a file for easier inspection
913918
const outputPath = path.resolve(__dirname, "public", "query-result.json");
914919
fs.writeFileSync(outputPath, JSON.stringify(result, null, 2));
915-
};
920+
};

0 commit comments

Comments
 (0)