Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 프론트엔드 eslint, prettier 세팅 #117

Merged
merged 7 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmessage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <타입> : <제목> 형식으로 작성하며 제목은 최대 50글자 정도로만 입력
# <타입>: <제목> 형식으로 작성하며 제목은 최대 50글자 정도로만 입력
# 제목을 아랫줄에 작성, 제목 끝에 마침표 금지, 무엇을 했는지 명확하게 작성

################
Expand Down
16 changes: 14 additions & 2 deletions apps/web/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ const nodeConfig = path.resolve(__dirname, 'tsconfig.node.json');
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: [require.resolve('@repo/lint'), 'plugin:react-hooks/recommended'],
extends: [
require.resolve('@repo/lint'),
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:react/jsx-runtime',
],
plugins: ['react-refresh'],
settings: {
react: {
Expand All @@ -25,10 +31,16 @@ module.exports = {
},
parserOptions: {
project: [baseConfig, appConfig, nodeConfig],
ecmaFeatures: { jsx: true },
},
ignorePatterns: ['dist', '.eslintrc.cjs', 'postcss.config.js', 'tailwind.config.ts'],
ignorePatterns: ['dist', '.eslintrc.cjs', 'postcss.config.cjs', 'tailwind.config.ts'],
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'import/no-unresolved': ['error', { ignore: ['^/'] }],
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
'react/jsx-boolean-value': ['error', 'never'],
'no-multiple-empty-lines': ['error', { max: 1 }],
'import/no-duplicates': 'error',
'no-console': 'error',
},
};
6 changes: 6 additions & 0 deletions apps/web/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const rootConfig = require('../../.prettierrc.js');

module.exports = {
...rootConfig,
plugins: ['prettier-plugin-tailwindcss'],
};
3 changes: 3 additions & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@repo/shards": "workspace:*",
"@repo/types": "workspace:*",
"prettier-plugin-tailwindcss": "^0.6.8",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Expand All @@ -24,6 +25,8 @@
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"globals": "^15.11.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const config = {
module.exports = {
plugins: {
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {},
},
};

export default config;
4 changes: 4 additions & 0 deletions packages/eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: 'import', next: '*' },
],

// 분리된 규칙들 병합
...namingConfig.rules,
Expand Down
Loading