Skip to content

Commit 074d670

Browse files
committed
Add prettier configuration with eslint
1 parent 60e28dc commit 074d670

File tree

11 files changed

+181
-46
lines changed

11 files changed

+181
-46
lines changed

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
.vite
4+
coverage
5+
package-lock.json

CONTRIBUTING.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ If you have a feature request or want to fix a bug, feel free to:
2626

2727
Head over to the `/public/data` folder and locate the language file you need, like javascript.json or python.json
2828

29-
2. **Find the category:**
29+
2. **Find the category:**
3030

3131
Look for the categoryName where your snippet belongs.
3232

@@ -36,10 +36,7 @@ Look for the categoryName where your snippet belongs.
3636
{
3737
"title": "Name of the snippet",
3838
"description": "A short explanation of what the snippet does",
39-
"code": [
40-
"your code goes here",
41-
" this is a newline with a space"
42-
],
39+
"code": ["your code goes here", " this is a newline with a space"],
4340
"tags": ["tag1", "tag2", "tag3"],
4441
"author": "your_github_username"
4542
}
@@ -84,10 +81,7 @@ Use this format:
8481
{
8582
"title": "Name of the snippet",
8683
"description": "A short explanation of what it does",
87-
"code": [
88-
"your code goes here",
89-
" this is a newline with a space"
90-
],
84+
"code": ["your code goes here", " this is a newline with a space"],
9185
"tags": ["tag1", "tag2", "tag3"],
9286
"author": "your_github_username"
9387
}
@@ -127,7 +121,7 @@ Upload a logo for your language into the `/public/icons` folder. Make sure the f
127121

128122
5. **Double-check your work:**
129123

130-
Test on your side and confirm if it works properly.
124+
Test on your side and confirm if it works properly.
131125

132126
---
133127

@@ -137,4 +131,4 @@ Whether you’re fixing a tiny typo, writing a new snippet, or dreaming up big f
137131

138132
If you have any questions or need help, feel free to open an issue or tag me.
139133

140-
Happy coding! 💻✨
134+
Happy coding! 💻✨

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Want to help make QuickSnip even better? You can contribute by:
2222

2323
- **Improving the Code**: Fix bugs, suggest new features, or optimize the project.
2424
- **Adding New Snippets**: Share your favorite snippets to grow the database.
25-
Be sure to check out the [CONTRIBUTING.md](/CONTRIBUTING.md) file for detailed guidelines.
25+
Be sure to check out the [CONTRIBUTING.md](/CONTRIBUTING.md) file for detailed guidelines.
2626

2727
### Improving the code
2828

@@ -41,10 +41,7 @@ If you’d like to add a snippet for an **existing language** and **category**,
4141
{
4242
"title": "Name of the snippet",
4343
"description": "A short explanation of what the snippet does",
44-
"code": [
45-
"your code goes here",
46-
" this is a newline with a space"
47-
],
44+
"code": ["your code goes here", " this is a newline with a space"],
4845
"tags": ["tag1", "tag2", "tag3"],
4946
"author": "your_github_username"
5047
}
@@ -64,4 +61,4 @@ Following these guidelines helps me (and everyone else) review and merge your co
6461

6562
## License
6663

67-
QuickSnip is licensed under the [MIT License](/LICENSE). Feel free to use and share it as you like.
64+
QuickSnip is licensed under the [MIT License](/LICENSE). Feel free to use and share it as you like.

eslint.config.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import tseslint from 'typescript-eslint'
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
import tseslint from "typescript-eslint";
6+
import prettier from "eslint-plugin-prettier";
67

78
export default tseslint.config(
8-
{ ignores: ['dist'] },
9+
{ ignores: ["dist"] },
910
{
10-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
11+
extends: [
12+
js.configs.recommended,
13+
...tseslint.configs.recommended,
14+
"plugin:prettier/recommended",
15+
],
16+
files: ["**/*.{ts,tsx}"],
1217
languageOptions: {
1318
ecmaVersion: 2020,
1419
globals: globals.browser,
1520
},
1621
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
22+
"react-hooks": reactHooks,
23+
"react-refresh": reactRefresh,
24+
prettier,
1925
},
2026
rules: {
2127
...reactHooks.configs.recommended.rules,
22-
'react-refresh/only-export-components': [
23-
'warn',
28+
"react-refresh/only-export-components": [
29+
"warn",
2430
{ allowConstantExport: true },
2531
],
32+
"prettier/prettier": "error",
2633
},
27-
},
28-
)
34+
}
35+
);

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />

package-lock.json

Lines changed: 118 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"dev": "vite",
88
"build": "tsc -b && vite build",
99
"lint": "eslint .",
10+
"format": "prettier --write .",
11+
"format:check": "prettier --check .",
1012
"preview": "vite preview"
1113
},
1214
"dependencies": {
@@ -23,9 +25,12 @@
2325
"@types/react-syntax-highlighter": "^15.5.13",
2426
"@vitejs/plugin-react-swc": "^3.5.0",
2527
"eslint": "^9.11.1",
28+
"eslint-config-prettier": "^9.1.0",
29+
"eslint-plugin-prettier": "^5.2.1",
2630
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
2731
"eslint-plugin-react-refresh": "^0.4.12",
2832
"globals": "^15.9.0",
33+
"prettier": "^3.4.2",
2934
"typescript": "^5.5.3",
3035
"typescript-eslint": "^8.7.0",
3136
"vite": "^5.4.8"

public/data/javascript.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@
147147
"console.log(timeAgoOrAhead(new Date())); // just now",
148148
"console.log(timeAgoOrAhead(futureDate)); // in x years"
149149
],
150-
"tags": ["javascript", "date", "time", "relative", "future", "past", "utility"],
150+
"tags": [
151+
"javascript",
152+
"date",
153+
"time",
154+
"relative",
155+
"future",
156+
"past",
157+
"utility"
158+
],
151159
"author": "Yugveer06"
152160
}
153161
]

public/data/python.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@
6767
"flattened = list(flatten(nested_list))",
6868
"print(flattened) # Output: [1, 2, 3, 4, 5]"
6969
],
70-
"tags": ["python", "list", "flattening", "nested-lists", "depth", "utilities"],
70+
"tags": [
71+
"python",
72+
"list",
73+
"flattening",
74+
"nested-lists",
75+
"depth",
76+
"utilities"
77+
],
7178
"author": "agilarasu"
7279
},
7380
{

0 commit comments

Comments
 (0)