Skip to content

Commit 2d51a7f

Browse files
authored
Merge branch 'main' into main
2 parents d1309a1 + fee26c7 commit 2d51a7f

File tree

12 files changed

+215
-32
lines changed

12 files changed

+215
-32
lines changed

eslint.config.js

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { fixupPluginRules } from "@eslint/compat";
22
import { FlatCompat } from "@eslint/eslintrc";
33
import js from "@eslint/js";
44
import globals from "globals";
5-
import reactPlugin from 'eslint-plugin-react';
5+
import reactPlugin from "eslint-plugin-react";
66
import reactHooks from "eslint-plugin-react-hooks";
77
import reactRefresh from "eslint-plugin-react-refresh";
88
import tseslint from "typescript-eslint";
@@ -49,46 +49,55 @@ export default tseslint.config(
4949
alwaysTryTypes: true,
5050
},
5151
},
52+
react: {
53+
version: "detect",
54+
},
5255
},
5356
rules: {
5457
...reactHooks.configs.recommended.rules,
5558
"@typescript-eslint/no-empty-object-type": "off",
56-
"@typescript-eslint/no-unused-vars": ["error", {
57-
"argsIgnorePattern": "^_",
58-
"varsIgnorePattern": "^_",
59-
"caughtErrorsIgnorePattern": "^_"
60-
}],
61-
"import/order": ["error", {
62-
"groups": [
63-
"builtin",
64-
"external",
65-
"internal",
66-
["parent", "sibling"],
67-
"index",
68-
"object",
69-
"type",
70-
"unknown"
71-
],
72-
"pathGroups": [
73-
{
74-
"pattern": "@*",
75-
"group": "internal",
76-
"position": "after"
77-
}
78-
],
79-
"pathGroupsExcludedImportTypes": ["builtin", "internal"],
80-
"newlines-between": "always",
81-
"alphabetize": {
82-
"order": "asc",
83-
"caseInsensitive": true
84-
}
85-
}],
59+
"@typescript-eslint/no-unused-vars": [
60+
"error",
61+
{
62+
argsIgnorePattern: "^_",
63+
varsIgnorePattern: "^_",
64+
caughtErrorsIgnorePattern: "^_",
65+
},
66+
],
67+
"import/order": [
68+
"error",
69+
{
70+
groups: [
71+
"builtin",
72+
"external",
73+
"internal",
74+
["parent", "sibling"],
75+
"index",
76+
"object",
77+
"type",
78+
"unknown",
79+
],
80+
pathGroups: [
81+
{
82+
pattern: "@*",
83+
group: "internal",
84+
position: "after",
85+
},
86+
],
87+
pathGroupsExcludedImportTypes: ["builtin", "internal"],
88+
"newlines-between": "always",
89+
alphabetize: {
90+
order: "asc",
91+
caseInsensitive: true,
92+
},
93+
},
94+
],
8695
"react/react-in-jsx-scope": "off",
8796
"react-refresh/only-export-components": [
8897
"warn",
8998
{ allowConstantExport: true },
9099
],
91-
"semi": ["error", "always"],
100+
semi: ["error", "always"],
92101
},
93102
}
94103
);

public/consolidated/_index.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"lang": "HTML",
2424
"icon": "/icons/html.svg"
2525
},
26+
{
27+
"lang": "JAVA",
28+
"icon": "/icons/java.svg"
29+
},
2630
{
2731
"lang": "JAVASCRIPT",
2832
"icon": "/icons/javascript.svg"
@@ -38,5 +42,9 @@
3842
{
3943
"lang": "SCSS",
4044
"icon": "/icons/scss.svg"
45+
},
46+
{
47+
"lang": "TYPESCRIPT",
48+
"icon": "/icons/typescript.svg"
4149
}
4250
]

public/consolidated/java.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[
2+
{
3+
"categoryName": "Basics",
4+
"snippets": [
5+
{
6+
"title": "Hello-World",
7+
"description": "Prints Hello world in the console",
8+
"author": "SarvariHarshitha",
9+
"tags": [
10+
"java",
11+
"console",
12+
"printing"
13+
],
14+
"contributors": [],
15+
"code": "// This is the main class of the Java program\npublic class Main {\n // The main method is the entry point of the program\n public static void main(String args[]) {\n // This statement prints \"Hello, World!\" to the console\n System.out.println(\"Hello, World!\");\n }\n}\n\n"
16+
}
17+
]
18+
}
19+
]

public/consolidated/python.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,32 @@
101101
{
102102
"categoryName": "Error Handling",
103103
"snippets": [
104+
{
105+
"title": "Create Custom Exception Type",
106+
"description": "Create a Custom Exception Type that can be called with raise.",
107+
"author": "mrcool7387",
108+
"tags": [
109+
"python",
110+
"error-creation",
111+
"organisation",
112+
"utility"
113+
],
114+
"contributors": [],
115+
"code": "class ExceptionName(BaseException):\n def __init__(message: str):\n super().__init__(message)\n\n# Usage\na: int = 1\n\nif a > 0:\n raise ExceptionName('Error Message')\n"
116+
},
117+
{
118+
"title": "Handle File Not Found Error",
119+
"description": "Attempts to open a file and handles the case where the file does not exist.",
120+
"author": "axorax",
121+
"tags": [
122+
"python",
123+
"error-handling",
124+
"file",
125+
"utility"
126+
],
127+
"contributors": [],
128+
"code": "def read_file_safe(filepath):\n try:\n with open(filepath, 'r') as file:\n return file.read()\n except FileNotFoundError:\n return \"File not found!\"\n\n# Usage:\nprint(read_file_safe('nonexistent.txt')) # Output: 'File not found!'\n"
129+
},
104130
{
105131
"title": "Retry Function Execution on Exception",
106132
"description": "Retries a function execution a specified number of times if it raises an exception.",

public/consolidated/typescript.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[
2+
{
3+
"categoryName": "Helper Types",
4+
"snippets": [
5+
{
6+
"title": "Exclusive Types",
7+
"description": "Allows to have a type which conforms to either/or.",
8+
"author": "px-d",
9+
"tags": [
10+
"typescript",
11+
"helper-types",
12+
"typedefinition"
13+
],
14+
"contributors": [],
15+
"code": "type Exclusive<T, U = T> = T | U extends Record<string, unknown>\n ?\n | ({ [P in Exclude<keyof T, keyof U>]?: never } & U)\n | ({ [P in Exclude<keyof U, keyof T>]?: never } & T)\n : T | U;\n\n\n// Usage:\ntype A = { name: string; email?: string; provider?: string };\ntype B = { name: string; phone?: string; country?: string };\n\ntype EitherOr = Exclusive<A, B>;\n\nconst w: EitherOr = { name: \"John\", email: \"j@d.c\" }; // ✅\nconst x: EitherOr = { name: \"John\", phone: \"+123 456\" }; // ✅\nconst y: EitherOr = { name: \"John\", email: \"\", phone: \"\" }; // ⛔️\nconst z: EitherOr = { name: \"John\", phne: \"\", provider: \"\" }; // ⛔️\n"
16+
}
17+
]
18+
}
19+
]

public/icons/java.svg

Lines changed: 12 additions & 0 deletions
Loading

public/icons/typescript.svg

Lines changed: 8 additions & 0 deletions
Loading

snippets/java/basics/hello-world.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Hello-World
3+
description: Prints Hello world in the console
4+
author: SarvariHarshitha
5+
tags: java, console, printing
6+
---
7+
8+
```java
9+
// This is the main class of the Java program
10+
public class Main {
11+
// The main method is the entry point of the program
12+
public static void main(String args[]) {
13+
// This statement prints "Hello, World!" to the console
14+
System.out.println("Hello, World!");
15+
}
16+
}
17+
18+
```

0 commit comments

Comments
 (0)