Skip to content

Commit b86d224

Browse files
committed
Added prettier and eslint
Signed-off-by: Noorain Panjwani <[email protected]>
1 parent ed00011 commit b86d224

8 files changed

+1904
-405
lines changed

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"arrowParens": "avoid",
5+
"tabWidth": 2,
6+
"plugins": ["prettier-plugin-tailwindcss"]
7+
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default tseslint.config({
2222
tsconfigRootDir: import.meta.dirname,
2323
},
2424
},
25-
})
25+
});
2626
```
2727

2828
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
@@ -31,7 +31,7 @@ export default tseslint.config({
3131

3232
```js
3333
// eslint.config.js
34-
import react from 'eslint-plugin-react'
34+
import react from 'eslint-plugin-react';
3535

3636
export default tseslint.config({
3737
// Set the react version
@@ -45,5 +45,5 @@ export default tseslint.config({
4545
...react.configs.recommended.rules,
4646
...react.configs['jsx-runtime'].rules,
4747
},
48-
})
48+
});
4949
```

eslint.config.js

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
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 eslint from '@eslint/js';
2+
import stylisticTs from '@stylistic/eslint-plugin-ts';
3+
import eslintConfigPrettier from 'eslint-config-prettier';
4+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
5+
import tseslint from 'typescript-eslint';
66

7-
export default tseslint.config(
8-
{ ignores: ['dist'] },
9-
{
10-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
12-
languageOptions: {
13-
ecmaVersion: 2020,
14-
globals: globals.browser,
15-
},
16-
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
19-
},
20-
rules: {
21-
...reactHooks.configs.recommended.rules,
22-
'react-refresh/only-export-components': [
23-
'warn',
24-
{ allowConstantExport: true },
25-
],
26-
},
7+
export default tseslint.config({
8+
ignores: ['dist/**', 'node_modules/**'],
9+
extends: [
10+
eslint.configs.recommended,
11+
...tseslint.configs.recommended,
12+
eslintConfigPrettier,
13+
],
14+
plugins: {
15+
'simple-import-sort': simpleImportSort,
16+
'@stylistic/ts': stylisticTs,
2717
},
28-
)
18+
rules: {
19+
indent: ['error', 2, { SwitchCase: 1 }],
20+
'@stylistic/ts/semi': ['error', 'always'],
21+
'@stylistic/ts/quotes': ['error', 'single'],
22+
'@typescript-eslint/no-unused-vars': [
23+
'error',
24+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
25+
],
26+
'simple-import-sort/imports': 'error',
27+
'simple-import-sort/exports': 'error',
28+
},
29+
});

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,30 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc -b && vite build",
9-
"lint": "eslint .",
10-
"preview": "vite preview"
9+
"lint": "eslint . && prettier --check .",
10+
"preview": "vite preview",
11+
"prettier": "prettier",
12+
"eslint": "eslint"
1113
},
1214
"dependencies": {
1315
"react": "^18.3.1",
1416
"react-dom": "^18.3.1"
1517
},
1618
"devDependencies": {
1719
"@eslint/js": "^9.15.0",
20+
"@stylistic/eslint-plugin-ts": "^2.12.1",
1821
"@types/react": "^18.3.12",
1922
"@types/react-dom": "^18.3.1",
2023
"@vitejs/plugin-react-swc": "^3.5.0",
2124
"eslint": "^9.15.0",
25+
"eslint-config-prettier": "^9.1.0",
2226
"eslint-plugin-react-hooks": "^5.0.0",
2327
"eslint-plugin-react-refresh": "^0.4.14",
28+
"eslint-plugin-simple-import-sort": "^12.1.1",
2429
"globals": "^15.12.0",
30+
"prettier": "^3.4.2",
31+
"prettier-plugin-tailwindcss": "^0.6.9",
32+
"tailwindcss": "^3.4.16",
2533
"typescript": "~5.6.2",
2634
"typescript-eslint": "^8.15.0",
2735
"vite": "^6.0.1"

0 commit comments

Comments
 (0)