-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from hyeon-9yu/main
feat: add eslint, support umd js
- Loading branch information
Showing
13 changed files
with
227 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"shared-node-browser": true, | ||
"node": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
"plugin:prettier/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:import/errors", | ||
"plugin:import/warnings" | ||
], | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"react", | ||
"prettier", | ||
"react-hooks", | ||
"import", | ||
"jest" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"rules": { | ||
"react-hooks/exhaustive-deps": "off", | ||
"@typescript-eslint/consistent-type-imports": "error", | ||
"prettier/prettier": ["error", { "printWidth": 120 }], | ||
"eqeqeq": "error", | ||
"no-var": "error", | ||
"prefer-const": "error", | ||
"curly": ["warn", "multi-line", "consistent"], | ||
"no-console": "off", | ||
"import/no-unresolved": ["error", { "commonjs": true, "amd": true }], | ||
"import/export": "error", | ||
"@typescript-eslint/no-duplicate-imports": ["error"], | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" } | ||
], | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/no-empty-interface": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"jest/consistent-test-it": [ | ||
"error", | ||
{ "fn": "it", "withinDescribe": "it" } | ||
], | ||
"import/order": [ | ||
"error", | ||
{ | ||
"alphabetize": { "order": "asc", "caseInsensitive": true }, | ||
"groups": [ | ||
"builtin", | ||
"external", | ||
"internal", | ||
"parent", | ||
"sibling", | ||
"index", | ||
"object" | ||
], | ||
"newlines-between": "never", | ||
"pathGroups": [ | ||
{ | ||
"pattern": "react", | ||
"group": "builtin", | ||
"position": "before" | ||
} | ||
], | ||
"pathGroupsExcludedImportTypes": ["builtin"] | ||
} | ||
], | ||
"react/jsx-uses-react": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"sort-imports": [ | ||
"error", | ||
{ | ||
"ignoreDeclarationSort": true | ||
} | ||
] | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
}, | ||
"import/extensions": [".js", ".jsx", ".ts", ".tsx"], | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".js", ".jsx", ".ts", ".tsx"] | ||
}, | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json"], | ||
"paths": ["src"] | ||
}, | ||
"alias": { | ||
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json"], | ||
"map": [ | ||
["^jotai$", "./src/index.ts"], | ||
["jotai", "./src"] | ||
] | ||
} | ||
} | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["src"], | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
} | ||
}, | ||
{ | ||
"files": ["tests/**/*.tsx"], | ||
"env": { | ||
"jest/globals": true | ||
} | ||
}, | ||
{ | ||
"files": ["./*.js"], | ||
"rules": { | ||
"@typescript-eslint/no-var-requires": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
*.iml | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
coverage | ||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.tscache | ||
.DS_Store | ||
node_modules/ | ||
typings/ | ||
coverage/ | ||
test/typescript/axios.js* | ||
sauce_connect.log | ||
package-lock.json | ||
dist | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
import typescript from '@rollup/plugin-typescript'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import peerDepsExternal from 'rollup-plugin-peer-deps-external'; | ||
import typescript from "@rollup/plugin-typescript"; | ||
import commonjs from "rollup-plugin-commonjs"; | ||
import resolve from "rollup-plugin-node-resolve"; | ||
import peerDepsExternal from "rollup-plugin-peer-deps-external"; | ||
|
||
const extensions = ['.js', '.jsx', '.ts', '.tsx']; // 어떤 확장자를 처리 할 지 정함 | ||
const extensions = [".js", ".jsx", ".ts", ".tsx"]; | ||
|
||
export default { | ||
input: './src/index.ts', // 어떤 파일부터 불러올지 정함. | ||
input: "./src/index.ts", | ||
plugins: [ | ||
typescript({ target: 'es5', sourceMap: true }), | ||
peerDepsExternal() /* peerDependencies로 설치한 라이브러리들을 external 모듈로 설정 | ||
즉, 번들링된 결과에 포함시키지 않음 */, | ||
resolve({ extensions }), // node_modules 에서 모듈을 불러올 수 있게 해줌. ts/tsx 파일도 불러올 수 있게 해줌 | ||
typescript({ target: "es5", sourceMap: true }), | ||
peerDepsExternal(), | ||
resolve({ extensions }), | ||
commonjs({ | ||
include: 'node_modules/**', | ||
}), // CommonJS 형태로 만들어진 모듈도 불러와서 사용 할 수 있게 해줌. 현재 프로젝트 상황에서는 없어도 무방함 | ||
include: "node_modules/**", | ||
}), | ||
], | ||
output: [ | ||
{ | ||
sourcemap: true, | ||
file: 'dist/index.js', // 번들링한 파일을 저장 할 경로 | ||
format: 'es', // ES Module 형태로 번들링함 | ||
file: "dist/index.esm.js", | ||
format: "es", | ||
}, | ||
{ | ||
name: "react-custom-alert", | ||
sourcemap: true, | ||
file: "dist/index.js", | ||
format: "umd", | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { AlertDetail } from './type'; | ||
import type { AlertDetail } from "./type"; | ||
|
||
export const alert = (detail: AlertDetail) => { | ||
window.dispatchEvent( | ||
new CustomEvent('toastAlert', { | ||
new CustomEvent("toastAlert", { | ||
detail, | ||
}), | ||
}) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { AlertContainer } from './AlertContainer'; | ||
export { alert } from './alert'; | ||
export { AlertType, AlertDetail } from './type'; | ||
export { AlertContainer } from "./AlertContainer"; | ||
export { alert } from "./alert"; | ||
export type { AlertType, AlertDetail } from "./type"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export type AlertType = 'success' | 'warning' | 'error' | 'info'; | ||
export type AlertType = "success" | "warning" | "error" | "info"; | ||
export type AlertDetail = { message: string; type: AlertType }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": [ | ||
"src/**/*.ts", | ||
"src/**/*.js", | ||
"src/**/*.js", | ||
"src/**/*.jsx", | ||
"src/**/*.tsx", | ||
"tests/**/*.ts", | ||
"tests/**/*.js", | ||
"tests/**/*.js", | ||
"tests/**/*.jsx", | ||
"tests/**/*.tsx", | ||
] | ||
} |