Skip to content

Commit

Permalink
Merge pull request #57 from KUIT-Space/feat#eslint
Browse files Browse the repository at this point in the history
Feat#eslint
  • Loading branch information
Turtle-Hwan authored Aug 4, 2024
2 parents b5ab5bb + 173cb72 commit e1178c8
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 44 deletions.
49 changes: 39 additions & 10 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,46 @@ module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
"plugin:react/recommended", // ๋ฆฌ์•กํŠธ ์ถ”์ฒœ ๋ฃฐ์…‹
"eslint:recommended",
"plugin:@typescript-eslint/recommended", // ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ์ถ”์ฒœ ๋ฃฐ์…‹
"plugin:react-hooks/recommended",
"plugin:prettier/recommended", // eslint์˜ ํฌ๋งคํŒ… ๊ธฐ๋Šฅ์„ prettier๋กœ ์‚ฌ์šฉํ•จ. ํ•ญ์ƒ ๋งˆ์ง€๋ง‰์— ์„ธํŒ… ๋˜์–ด์•ผ ํ•จ. (eslint-plugin-prettier)
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh", "simple-import-sort"],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"simple-import-sort/imports": [
"warn",
{
groups: [
// Packages `react` related packages come first.
["^react", "^@?\\w"],
// Internal packages.
["^(@|components)(/.*|$)"],
// Side effect imports.
["^\\u0000"],
// Parent imports. Put `..` last.
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Other relative imports. Put same-folder imports and `.` last.
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Style imports.
["^.+\\.?(css)$"],
],
},
],
"prettier/prettier": [
"warn",
{
"endOfLine": "auto"
}
],
"react/react-in-jsx-scope": "off",
},
parserOptions: {
sourceType: "module",
ecmaVersion: "latest",
},
}
};
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"singleQuote": false,
"endOfLine": "auto",
"parser": "typescript",
"semi": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all",
"printWidth": 100
}
}
29 changes: 22 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
{
// vscode
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.fixAll": "never",
"source.fixAll.eslint": "explicit",
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.tabSize": 2,
"files.insertFinalNewline": true,

// ESLint
// ref: https://github.com/microsoft/vscode-eslint
// plugin: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
"eslint.codeActionsOnSave.mode": "problems",
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],

"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
}
// "editor.defaultFormatter": "esbenp.prettier-vscode",
// "[javascript]": {
// "editor.defaultFormatter": "esbenp.prettier-vscode"
// },
}
103 changes: 99 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint--fix": "eslint --fix . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
Expand All @@ -31,10 +32,12 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-react-refresh": "^0.4.7",
"prettier": "^3.3.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.3.3",
"typescript": "^5.2.2",
"vite": "^5.3.1",
"vite-tsconfig-paths": "^4.3.2"
Expand Down
3 changes: 2 additions & 1 deletion src/pages/ChatPage/ChatCreatePage/ChatCreatePage.styled.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Input } from "@/components/Input";
import styled from "styled-components";

import SearchIcon from "@/assets/ChatPage/icon_search.svg";
import { BottomBtn } from "@/components/BottomBtn";
import { Input } from "@/components/Input";

export const ChatroomAddImgBtn = styled.label<{ $backgroundImage: string | null | undefined }>`
display: flex;
Expand Down
14 changes: 8 additions & 6 deletions src/pages/ChatPage/ChatCreatePage/ChatCreatePage.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import TopBarText, { LeftEnum } from "@/components/TopBarText";
import { useEffect, useState } from "react";
import { choseongIncludes, hangulIncludes } from "es-hangul";

import ChatroomImg from "@/assets/ChatPage/btn_chatroom_img.svg";
import CheckBox from "@/components/CheckBox";
import { Input } from "@/components/Input";
import TopBarText, { LeftEnum } from "@/components/TopBarText";

import {
ChatCreateBottomBtn,
ChatCreateContainer,
ChatroomAddImgBtn,
ChatroomName,
InviteInput,
Member,
ChatCreateBottomBtn,
} from "./ChatCreatePage.styled";
import { Input } from "@/components/Input";
import { useEffect, useState } from "react";
import { hangulIncludes, choseongIncludes } from "es-hangul";
import CheckBox from "@/components/CheckBox";

interface member {
userId: number;
Expand Down
6 changes: 4 additions & 2 deletions src/pages/ChatPage/ChatPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import TopBarText, { LeftEnum } from "@/components/TopBarText";
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { ChatListContainer, ChatContainer } from "./ChatPage.styled";

import TopBarText, { LeftEnum } from "@/components/TopBarText";

import { AddChatBtn } from "./ChatAddBtn.styled";
import { ChatContainer, ChatListContainer } from "./ChatPage.styled";

const ChatPage = () => {
const navigate = useNavigate();
Expand Down
24 changes: 12 additions & 12 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import react from "@vitejs/plugin-react-swc";
import * as path from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import vitePluginSvgr from "vite-plugin-svgr";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), vitePluginSvgr()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
build: {
rollupOptions: {
external: ["react", "react-dom", "styled-components"],
},
},
plugins: [react(), vitePluginSvgr()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
build: {
rollupOptions: {
external: ["react", "react-dom", "styled-components"],
},
},
});

0 comments on commit e1178c8

Please sign in to comment.