Skip to content

Commit

Permalink
Merge pull request #6 from team-aliens/feature/5-typescript_rule-setting
Browse files Browse the repository at this point in the history
typescript관련 eslint rule 설정
  • Loading branch information
jikwan0327 authored Apr 20, 2023
2 parents ac2ff0f + 07a67ca commit c360966
Show file tree
Hide file tree
Showing 23 changed files with 575 additions and 18 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:eslint-plugin/recommended",
"plugin:node/recommended",
],
extends: ["eslint:recommended", "plugin:eslint-plugin/recommended", "plugin:node/recommended"],
env: {
node: true,
es6: true,
Expand Down
322 changes: 318 additions & 4 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 4 additions & 2 deletions lib/config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const rules = require("../recommended");
module.exports = {
root: true,

extends: ["airbnb-base"],
parser: "@typescript-eslint/parser",

extends: ["airbnb-base", "plugin:@typescript-eslint/recommended"],

parserOptions: {
ecmaVersion: 6,
Expand All @@ -14,7 +16,7 @@ module.exports = {
browser: true,
},

plugins: ["aliens"],
plugins: ["aliens", "@typescript-eslint"],

rules,
};
50 changes: 46 additions & 4 deletions lib/config/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,62 @@ module.exports = {

rules: {
// https://eslint.org/docs/latest/rules/no-duplicate-imports
"no-duplicate-imports": 0, //중복 모듈 가져오기 금지
"no-duplicate-imports": "error", //중복 모듈 가져오기 금지
// https://eslint.org/docs/latest/rules/no-unused-vars
"no-unused-vars": ["warn", { vars: "all", args: "all", ignoreRestSiblings: true }], //사용하지 않는 변수 허용하지 않음
// https://eslint.org/docs/latest/rules/arrow-body-style
"arrow-body-style": ["error", "as-needed"], //화살표 함수 본문 주위에 중괄호 필요 여부에 따라 결정
// https://eslint.org/docs/latest/rules/block-scoped-var
"block-scoped-var": 0, //정의된 범위 내에서 변수 사용 강제
"block-scoped-var": "error", //정의된 범위 내에서 변수 사용 강제
// https://eslint.org/docs/latest/rules/func-style
"func-style": ["error", "expression"], //화살표 함수 필수
// https://eslint.org/docs/latest/rules/no-empty
"no-empty": ["error", { allowEmptyCatch: true }], //빈 블록 문을 허용하지 않음
// https://eslint.org/docs/latest/rules/require-await
"require-await": 0, //await표현식이 없는 비동기 함수를 허용하지 않음
"require-await": "off", //await표현식이 없는 비동기 함수를 허용하지 않음
// https://eslint.org/docs/latest/rules/max-depth
"max-depth": ["error", 3], //블록 중첩 최대 3번까지
"max-depth": ["error", { max: 3 }], //블록 중첩 최대 3번까지
// https://typescript-eslint.io/rules/array-type
"array-type": "array-simple", //간단한 배열 타입 명시는 []로 union, object, function등이 들어가는 경우 Array<T>로 명시
// https://typescript-eslint.io/rules/naming-convention
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["variable", "function"],
format: ["camelCase"],
},
{
selector: ["parameter"],
format: ["snake_case"],
},
{
selector: ["interface", "class", "typeAlias"],
format: ["PascalCase"],
},
], // 네이밍 규칙
// https://typescript-eslint.io/rules/consistent-indexed-object-style
"@typescript-eslint/consistent-indexed-object-style": ["error", "index-signature"], //색인 서명만 허용
// https://typescript-eslint.io/rules/consistent-type-imports
"@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }], //형식 가져오기의 일관된 사용을 적용
// https://typescript-eslint.io/rules/explicit-function-return-type
"@typescript-eslint/explicit-function-return-type": "error", //반환 유형이 필요
// https://typescript-eslint.io/rules/explicit-module-boundary-types
"@typescript-eslint/explicit-module-boundary-types": "error", //인수 유형이 필요
// https://typescript-eslint.io/rules/no-confusing-non-null-assertion
"@typescript-eslint/no-confusing-non-null-assertion": "error", //혼동을 줄 수 있는 위치에서 null이 아닌 어설션을 허용하지 않음
// https://typescript-eslint.io/rules/no-duplicate-type-constituents
"@typescript-eslint/no-duplicate-type-constituents": "error", //중복 타입 구성 요소를 허용하지 않음
// https://typescript-eslint.io/rules/no-unsafe-return
"@typescript-eslint/no-unsafe-return": "error", //안전한 타입 반환
// https://typescript-eslint.io/rules/no-useless-empty-export
"@typescript-eslint/no-useless-empty-export": "error", //빈내보내기 금지
// https://typescript-eslint.io/rules/non-nullable-type-assertion-style
"@typescript-eslint/non-nullable-type-assertion-style": "error", //명시적 형식 캐스트에 대해 null이 아닌 어설션을 적용
// https://typescript-eslint.io/rules/no-implied-eval
"no-implied-eval": "off",
"@typescript-eslint/no-implied-eval": "error", //eval()-like 메서드 의 사용을 금지
// https://typescript-eslint.io/rules/no-redeclare
"no-redeclare": "off",
"@typescript-eslint/no-redeclare": "error", //변수 재선언 금지
},
};
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "^8.19.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-eslint-plugin": "^5.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"mocha": "^10.0.0",
"semantic-release": "^21.0.1"
"semantic-release": "^21.0.1",
"typescript": "^5.0.4"
},
"engines": {
"node": "^14.17.0 || ^16.0.0 || >= 18.0.0"
Expand Down
204 changes: 202 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,13 @@ __metadata:
languageName: node
linkType: hard

"@types/json-schema@npm:^7.0.9":
version: 7.0.11
resolution: "@types/json-schema@npm:7.0.11"
checksum: 527bddfe62db9012fccd7627794bd4c71beb77601861055d87e3ee464f2217c85fca7a4b56ae677478367bbd248dbde13553312b7d4dbc702a2f2bbf60c4018d
languageName: node
linkType: hard

"@types/json5@npm:^0.0.29":
version: 0.0.29
resolution: "@types/json5@npm:0.0.29"
Expand Down Expand Up @@ -691,6 +698,134 @@ __metadata:
languageName: node
linkType: hard

"@types/semver@npm:^7.3.12":
version: 7.3.13
resolution: "@types/semver@npm:7.3.13"
checksum: 00c0724d54757c2f4bc60b5032fe91cda6410e48689633d5f35ece8a0a66445e3e57fa1d6e07eb780f792e82ac542948ec4d0b76eb3484297b79bd18b8cf1cb0
languageName: node
linkType: hard

"@typescript-eslint/eslint-plugin@npm:^5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/eslint-plugin@npm:5.58.0"
dependencies:
"@eslint-community/regexpp": ^4.4.0
"@typescript-eslint/scope-manager": 5.58.0
"@typescript-eslint/type-utils": 5.58.0
"@typescript-eslint/utils": 5.58.0
debug: ^4.3.4
grapheme-splitter: ^1.0.4
ignore: ^5.2.0
natural-compare-lite: ^1.4.0
semver: ^7.3.7
tsutils: ^3.21.0
peerDependencies:
"@typescript-eslint/parser": ^5.0.0
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
peerDependenciesMeta:
typescript:
optional: true
checksum: e5d76d43c466ebd4b552e3307eff72ab5ae8a0c09a1d35fa13b62769ac3336df94d9281728ab5aafd2c14a0a644133583edcd708fce60a9a82df1db3ca3b8e14
languageName: node
linkType: hard

"@typescript-eslint/parser@npm:^5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/parser@npm:5.58.0"
dependencies:
"@typescript-eslint/scope-manager": 5.58.0
"@typescript-eslint/types": 5.58.0
"@typescript-eslint/typescript-estree": 5.58.0
debug: ^4.3.4
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
peerDependenciesMeta:
typescript:
optional: true
checksum: 38681da48a40132c0538579c818ceef9ba2793ab8f79236c3f64980ba1649bb87cb367cd79d37bf2982b8bfbc28f91846b8676f9bd333e8b691c9befffd8874a
languageName: node
linkType: hard

"@typescript-eslint/scope-manager@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/scope-manager@npm:5.58.0"
dependencies:
"@typescript-eslint/types": 5.58.0
"@typescript-eslint/visitor-keys": 5.58.0
checksum: f0d3df5cc3c461fe63ef89ad886b53c239cc7c1d9061d83d8a9d9c8e087e5501eac84bebff8a954728c17ccea191f235686373d54d2b8b6370af2bcf2b18e062
languageName: node
linkType: hard

"@typescript-eslint/type-utils@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/type-utils@npm:5.58.0"
dependencies:
"@typescript-eslint/typescript-estree": 5.58.0
"@typescript-eslint/utils": 5.58.0
debug: ^4.3.4
tsutils: ^3.21.0
peerDependencies:
eslint: "*"
peerDependenciesMeta:
typescript:
optional: true
checksum: 803f24daed185152bf86952d4acebb5ea18ff03db5f28750368edf76fdea46b4b0f8803ae0b61c0282b47181c9977113457b16e33d5d2cb33b13855f55c5e5b2
languageName: node
linkType: hard

"@typescript-eslint/types@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/types@npm:5.58.0"
checksum: 8622a73d73220c4a7111537825f488c0271272032a1d4e129dc722bc6e8b3ec84f64469b2ca3b8dae7da3a9c18953ce1449af51f5f757dad60835eb579ad1d2c
languageName: node
linkType: hard

"@typescript-eslint/typescript-estree@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/typescript-estree@npm:5.58.0"
dependencies:
"@typescript-eslint/types": 5.58.0
"@typescript-eslint/visitor-keys": 5.58.0
debug: ^4.3.4
globby: ^11.1.0
is-glob: ^4.0.3
semver: ^7.3.7
tsutils: ^3.21.0
peerDependenciesMeta:
typescript:
optional: true
checksum: 51b668ec858db0c040a71dff526273945cee4ba5a9b240528d503d02526685882d900cf071c6636a4d9061ed3fd4a7274f7f1a23fba55c4b48b143344b4009c7
languageName: node
linkType: hard

"@typescript-eslint/utils@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/utils@npm:5.58.0"
dependencies:
"@eslint-community/eslint-utils": ^4.2.0
"@types/json-schema": ^7.0.9
"@types/semver": ^7.3.12
"@typescript-eslint/scope-manager": 5.58.0
"@typescript-eslint/types": 5.58.0
"@typescript-eslint/typescript-estree": 5.58.0
eslint-scope: ^5.1.1
semver: ^7.3.7
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
checksum: c618ae67963ecf96b1492c09afaeb363f542f0d6780bcac4af3c26034e3b20034666b2d523aa94821df813aafb57a0b150a7d5c2224fe8257452ad1de2237a58
languageName: node
linkType: hard

"@typescript-eslint/visitor-keys@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/visitor-keys@npm:5.58.0"
dependencies:
"@typescript-eslint/types": 5.58.0
eslint-visitor-keys: ^3.3.0
checksum: ab2d1f37660559954c840429ef78bbf71834063557e3e68e435005b4987970b9356fdf217ead53f7a57f66f5488dc478062c5c44bf17053a8bf041733539b98f
languageName: node
linkType: hard

"JSONStream@npm:^1.0.4":
version: 1.3.5
resolution: "JSONStream@npm:1.3.5"
Expand Down Expand Up @@ -1533,7 +1668,7 @@ __metadata:
languageName: node
linkType: hard

"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.2, debug@npm:^4.3.3":
"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4":
version: 4.3.4
resolution: "debug@npm:4.3.4"
dependencies:
Expand Down Expand Up @@ -1885,6 +2020,8 @@ __metadata:
dependencies:
"@semantic-release/changelog": ^6.0.3
"@semantic-release/git": ^10.0.1
"@typescript-eslint/eslint-plugin": ^5.58.0
"@typescript-eslint/parser": ^5.58.0
eslint: ^8.19.0
eslint-config-airbnb-base: ^15.0.0
eslint-plugin-eslint-plugin: ^5.0.0
Expand All @@ -1893,6 +2030,7 @@ __metadata:
mocha: ^10.0.0
requireindex: ^1.2.0
semantic-release: ^21.0.1
typescript: ^5.0.4
peerDependencies:
eslint: ">=7"
eslint-config-airbnb-base: ">=15"
Expand Down Expand Up @@ -1965,6 +2103,16 @@ __metadata:
languageName: node
linkType: hard

"eslint-scope@npm:^5.1.1":
version: 5.1.1
resolution: "eslint-scope@npm:5.1.1"
dependencies:
esrecurse: ^4.3.0
estraverse: ^4.1.1
checksum: 47e4b6a3f0cc29c7feedee6c67b225a2da7e155802c6ea13bbef4ac6b9e10c66cd2dcb987867ef176292bf4e64eccc680a49e35e9e9c669f4a02bac17e86abdb
languageName: node
linkType: hard

"eslint-scope@npm:^7.1.1":
version: 7.1.1
resolution: "eslint-scope@npm:7.1.1"
Expand Down Expand Up @@ -2105,6 +2253,13 @@ __metadata:
languageName: node
linkType: hard

"estraverse@npm:^4.1.1":
version: 4.3.0
resolution: "estraverse@npm:4.3.0"
checksum: a6299491f9940bb246124a8d44b7b7a413a8336f5436f9837aaa9330209bd9ee8af7e91a654a3545aee9c54b3308e78ee360cef1d777d37cfef77d2fa33b5827
languageName: node
linkType: hard

"estraverse@npm:^5.1.0, estraverse@npm:^5.2.0, estraverse@npm:^5.3.0":
version: 5.3.0
resolution: "estraverse@npm:5.3.0"
Expand Down Expand Up @@ -2598,7 +2753,7 @@ __metadata:
languageName: node
linkType: hard

"globby@npm:^11.0.0":
"globby@npm:^11.0.0, globby@npm:^11.1.0":
version: 11.1.0
resolution: "globby@npm:11.1.0"
dependencies:
Expand Down Expand Up @@ -4124,6 +4279,13 @@ __metadata:
languageName: node
linkType: hard

"natural-compare-lite@npm:^1.4.0":
version: 1.4.0
resolution: "natural-compare-lite@npm:1.4.0"
checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225
languageName: node
linkType: hard

"natural-compare@npm:^1.4.0":
version: 1.4.0
resolution: "natural-compare@npm:1.4.0"
Expand Down Expand Up @@ -5940,6 +6102,24 @@ __metadata:
languageName: node
linkType: hard

"tslib@npm:^1.8.1":
version: 1.14.1
resolution: "tslib@npm:1.14.1"
checksum: dbe628ef87f66691d5d2959b3e41b9ca0045c3ee3c7c7b906cc1e328b39f199bb1ad9e671c39025bd56122ac57dfbf7385a94843b1cc07c60a4db74795829acd
languageName: node
linkType: hard

"tsutils@npm:^3.21.0":
version: 3.21.0
resolution: "tsutils@npm:3.21.0"
dependencies:
tslib: ^1.8.1
peerDependencies:
typescript: ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta"
checksum: 1843f4c1b2e0f975e08c4c21caa4af4f7f65a12ac1b81b3b8489366826259323feb3fc7a243123453d2d1a02314205a7634e048d4a8009921da19f99755cdc48
languageName: node
linkType: hard

"tuf-js@npm:^1.0.0":
version: 1.1.3
resolution: "tuf-js@npm:1.1.3"
Expand Down Expand Up @@ -6019,6 +6199,26 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^5.0.4":
version: 5.0.4
resolution: "typescript@npm:5.0.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 82b94da3f4604a8946da585f7d6c3025fff8410779e5bde2855ab130d05e4fd08938b9e593b6ebed165bda6ad9292b230984f10952cf82f0a0ca07bbeaa08172
languageName: node
linkType: hard

"typescript@patch:typescript@^5.0.4#~builtin<compat/typescript>":
version: 5.0.4
resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin<compat/typescript>::version=5.0.4&hash=85af82"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: bb309d320c59a26565fb3793dba550576ab861018ff3fd1b7fccabbe46ae4a35546bc45f342c0a0b6f265c801ccdf64ffd68f548f117ceb7f0eac4b805cd52a9
languageName: node
linkType: hard

"uglify-js@npm:^3.1.4":
version: 3.17.4
resolution: "uglify-js@npm:3.17.4"
Expand Down

0 comments on commit c360966

Please sign in to comment.