Skip to content

Commit

Permalink
feat: template react 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kang-heewon committed Jan 28, 2024
1 parent 66e5136 commit f66d6c9
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 7 deletions.
5 changes: 5 additions & 0 deletions libs/shared/utils-eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"version": "0.0.0",
"private": true,
"main": ".eslintrc.js",
"exports": {
".": "./.eslintrc.js",
"./react": "./react.js"
},
"dependencies": {},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "6.18.1",
Expand All @@ -12,6 +16,7 @@
"eslint-plugin-import": "2.29.1",
"eslint-plugin-package-json": "0.7.0",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react-hooks": "4.6.0",
"jsonc-eslint-parser": "2.4.0",
"prettier": "3.2.2"
}
Expand Down
82 changes: 82 additions & 0 deletions libs/shared/utils-eslint-config/react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
module.exports = {
root: true,
extends: ['plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'turbo'],
plugins: ['prettier', 'import', 'react'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'react-hooks/exhaustive-deps': [
'warn',
{
enableDangerousAutofixThisMayCauseInfiniteLoops: true,
},
],
'prettier/prettier': [
'error',
{
trailingComma: 'es5',
singleQuote: true,
printWidth: 120,
arrowParens: 'avoid',
endOfLine: 'auto',
},
],
'import/extensions': ['off'],
'import/no-cycle': ['error'],
'import/no-extraneous-dependencies': ['off'],
'import/no-named-as-default': ['off'],
'import/no-relative-packages': ['off'],
'import/no-self-import': ['error'],
'import/order': [
'error',
{
groups: ['internal', 'external', 'builtin', 'parent', 'sibling'],
pathGroups: [
{
pattern: '@*/**',
group: 'internal',
position: 'before',
},
{
pattern: '@*/**',
group: 'external',
position: 'after',
},
],
pathGroupsExcludedImportTypes: [],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'import/prefer-default-export': ['off'],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'no-type-imports',
},
],
'turbo/no-undeclared-env-vars': ['warn'],
},
overrides: [
{
files: ['package.json'],
parser: 'jsonc-eslint-parser',
plugins: ['package-json'],
rules: {
'package-json/sort-collections': 'error',
},
},
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
};
2 changes: 1 addition & 1 deletion template/.eslintrc.json → template/node/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"root": true,
"extends": "@heewon.dev/eslint-config"
}
}
9 changes: 4 additions & 5 deletions template/package.json → template/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
"main": "./src/index.ts",
"types": "./src/index.ts",
"scripts": {
"typecheck": "tsc --noEmit",
"lint": "eslint **/*.ts*"
},
"dependencies": {
"lint": "eslint **/*.ts*",
"test": "echo 1",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@heewon.dev/eslint-config": "workspace:*",
"@heewon.dev/utils-tsconfig": "workspace:*"
}
}
}
2 changes: 1 addition & 1 deletion template/tsconfig.json → template/node/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@heewon.dev/utils-tsconfig/tsconfig.node.json",
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules"],
}
4 changes: 4 additions & 0 deletions template/react/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": "@heewon.dev/eslint-config/react"
}
18 changes: 18 additions & 0 deletions template/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@aa/aaa",
"version": "0.0.0",
"type": "commonjs",
"main": "./src/index.ts",
"types": "./src/index.ts",
"scripts": {
"lint": "eslint **/*.ts*",
"test": "echo 1",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@heewon.dev/eslint-config": "workspace:*",
"@heewon.dev/utils-tsconfig": "workspace:*",
"@types/react": "*",
"@types/react-dom": "*"
}
}
5 changes: 5 additions & 0 deletions template/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@heewon.dev/utils-tsconfig/tsconfig.react.json",
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]
}

0 comments on commit f66d6c9

Please sign in to comment.