tslint.json
ꡬμ±:
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"public-static-field",
"protected-static-field",
"public-static-method",
"protected-static-method"
]
}
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-unused-variable": true,
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
}
}
λ΄κ° μ νν 무μμ μλͺ»νκ³ μμ΅λκΉ?
μλ 맀κ°λ³μλ‘ tslint
λ₯Ό μ€νν λ:
tslint --type-check --project tsconfig.json src/**/*.ts
μλ κ²½κ³ κ° λνλ©λλ€.
Could not find implementations for the following rules specified in the configuration:
Warning: The 'no-unused-variable' rule requires type checking
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.
tslint
λ¬Έμμ λ°λ₯΄λ©΄ μ ν κ²μ¬λ₯Ό μννκΈ° μν΄ νμν κ²μ --type-check --project tsconfig.json
μ λ¬νλ κ²λΏμ΄μ§λ§ μλνμ§ μλ κ² κ°μ΅λλ€.
λ¬Έμ ν νλ¦Ώμ μμ±ν΄ μ£ΌμΈμ. tslint.jsonμ μ΄λ»κ² μκ²Όλμ?
λλ μ§μ μκ³ κ°μ νλ‘μ νΈλ₯Ό μλνκ³ μ μλν©λλ€. μμμΌμ λ€μ ν μ€νΈνκΈ° μν΄ μΆκ·Όν λκΉμ§ μ΄κ²μ μ΄μ΄λ κ²μ λλ€. λ΄ λ Έλ λͺ¨λμ λ€μ μ€μΉν΄μΌ ν μλ μμ΅λλ€.
λν λ¬Έμ ν νλ¦Ώμ μ¬μ©νλλ‘ μ λ°μ΄νΈνμ΅λλ€.
tslintκ° μ
λ°μ΄νΈλ ν(v4 -> v5), --type-check
, --project
μΈμ μμ΄ --type-check
no-unused-variable
λ₯Ό μ¬μ©ν μ μμ΅λλ€.
μ΄ μ΅μ μ μ λ°μ΄νΈ ν μΈμ κ²°κ³Όκ° λμ¬ λκΉμ§ μ¬μ©νκΈ° μ΄λ ΅κ³ μκ°μ΄ μ€λ 걸리μ§λ§ μ€μνκ³ κ°μ₯ λ§μ΄ μ¬μ©λλ Linting μ΅μ μ λλ€. μμ μΈμ μμ΄ μ΄ μ΅μ μ μ¬μ©ν μ μλ λ°©λ²μ΄ μμ΅λκΉ?
tslintκ° μ λ°μ΄νΈλ ν(v4 -> v5μΌ μ μμ) --type-check, --project μΈμ μμ΄λ no-unused-variableμ μ¬μ©ν μ μμ΅λλ€.
tslint --type-check --project tsconfig.json src/**/*.ts
λ‘ --projectλ₯Ό μ λ¬νκ³ μμ΅λλ€.
μ§ μ»΄ν¨ν°μμλ μ΄ λ¬Έμ κ° λ°μνμ§ μμ§λ§ μ§μ₯ μ»΄ν¨ν°μμλ λ¬Έμ κ° λ°μν©λλ€.
@everedifice κ·μΉ ꡬνμ λ²κ·Έκ° μμκ³ κ±°μ μ¬μ©λμ§ μμΌλ©°(https://github.com/palantir/tslint/issues/1481) κΆκ·Ήμ μΌλ‘ μ»΄νμΌλ¬μ no-unused-variable ꡬνμ μμνμ¬ μ μ§νκΈ°λ‘ κ²°μ νμ΅λλ€. (μ΄κ²μ λλΆλΆμ λ²κ·Έλ₯Ό ν΄κ²°νμ΅λλ€). μ΄ λ¦¬ν¬μ§ν 리μλ μ΄μ λν λ§μ ν λ‘ μ€λ λκ° μμΌλ©°, λλΆλΆμ μ£Όμ λ³κ²½ μ¬νμ λ§λ PRκ³Ό μ°κ²°λμ΄ μμ΅λλ€( https://github.com/palantir/tslint/pull/2235.
@mastrauckas λ νκ²½μ μ°¨μ΄μ μ λν μμΈν μ 보 μμ΄λ μ λ§ λμμ΄ λ μ μμ΅λλ€.
@adidahiya μ΄μ ―λ°€μλ macOSμΈ μΈ λ²μ§Έ μ»΄ν¨ν°μμ μ΄κ²μ μ»μμ΅λλ€. μ§μ μλ μ»΄ν¨ν°μμ λ€μ μλνμ¬ μ¬μ ν λ°μνλμ§ νμΈνκ² μ΅λλ€.
μΌλ°μ μΌλ‘:
μ»΄ν¨ν° 1: Windows 10μ΄ μμ ν μ΅μ μνμ΄λ©° νμ¬λ‘μλ error
λ°μ§ μμ΅λλ€.
μ»΄ν¨ν° 2: macOSκ° μμ ν μ
λ°μ΄νΈλμκ³ error
λ©λλ€.
μ»΄ν¨ν° 3: Windows 7μ΄ μμ ν μ
λ°μ΄νΈλμκ³ error
λ©λλ€.
@everedifice λͺ κ°μ§ μΆκ° κΈ°λ₯μ΄ μμ§λ§ --project --type-check
λ₯Ό μ¬μ©ν νμ μμ΄ λλΆλΆ no-unused-variable
μ κ°μ no-unused
λΌλ μ κ·μΉμ μ¬μ©νμ¬ tslint-consistent-codestyle
μ μ λ²μ μ κ²μνμ΅λλ€ --project --type-check
.
κ΄μ¬μ΄ μλ κ²½μ° μ¬κΈ°μμ λ¬Έμλ₯Ό μ°Ύμ μ μμ΅λλ€. https://github.com/ajafff/tslint-consistent-codestyle/blob/master/docs/no-unused.md
λ¬Έμ κ° μλ€κ³ μκ°νλ μ»΄ν¨ν°κ° κ²°κ΅ λ¬Έμ κ° λ°μν κ²μΌλ‘ 보μ λλ€. λ²κ·ΈμΈκ°μ?
μ΄ λ¬Έμ μ λν΄ μλ‘μ΄ κ²μ΄ μμ΅λκΉ?
κ°μ λ¬Έμ κ° μμ΅λλ€.
λμΌν λ¬Έμ μ΄μ§λ§ 'κ²½κ³ : 'μ¬μ©νμ§ μλ λ³μ μμ' κ·μΉμλ μ ν μ λ³΄κ° νμν©λλ€.'
λ° 'κ²½κ³ : 'no-use-before-declare' κ·μΉμλ μ ν μ λ³΄κ° νμν©λλ€.' ('μ 보'μ μ€νκ° λ²μ 5.5.0κ³Ό 5.7.0 μ¬μ΄μμ μμ λ κ²μ λ³Ό μ μμ§λ§ λ³κ²½λ κ²μ μ΄κ²λΏμ
λλ€). μ λ typescript λ²μ 2.4.1λ‘ μ€ννκ³ μμ΅λλ€. κ·Έ λ¬Έμ μ λν μμμ΄ μμ΅λκΉ?
μ¬κΈ°μλ κ°μ λ¬Έμ
μ΄ λ¬Έμ κ° ν΄κ²°λμκ±°λ κ²½κ³ νμλ₯Ό μ€μ§νκΈ° μν μμ μμ μ¬νμ΄ μμ΅λκΉ?
λλ κ·Έκ²μ΄ κ³ μ³μ‘λ€κ³ μκ°νμ§ μλλ€. λ¬Έμ λ‘ λ°μλ€μλ€κ³ μκ°νμ§λ μμ΅λλ€.
μꡬ μμ , tslint.json λμ tsconfig.jsonμμ no-unused-variable
λ₯Ό μ¬μ©ν©λλ€. μ»΄νμΌλ¬κ° λμΌν κΈ°λ₯μ μ 곡ν μ μλ€λ©΄ λ¦°ν°λ‘ μ΄λ₯Ό μννλ κ²μ μλ―Έκ° μμ΅λλ€.
@AnimaMundi λ λμΌν κΈ°λ₯μ μ 곡νμ§λ§ CI νλ‘μΈμ€μ μΌλΆλ‘ tslintλ₯Ό μ€νν λ λΉλκ° μλλΌ ν μ€νΈ μ€μ νλκ·Έλ₯Ό μ§μ ν΄μΌ ν©λλ€. μ»΄νμΌλ¬κ° λΉλ μ μ΄ μμ μ μννκΈ° λλ¬Έμ μ΄κ²μ 무μ/μ κ±°ν΄μΌ νλ€λ λ° λμνμ§ μμ΅λλ€.
@haswalt λΉλ λ¨κ³κ° μλλΌ linting λ¨κ³μμ νλκ·Έλ₯Ό μ§μ ν΄μΌ νλ μ΄μ κ° μμ΅λλ€. μ΄μ¨λ , λΉμ μ΄ μ μκ² λμνλ λ§λ κ·Έκ²μ μ€μνμ§ μμ΅λλ€. λλ μ΄ νλ‘μ νΈμ κ°λ°κ³Ό μ무 κ΄λ ¨μ΄ μμ΅λλ€. λ°©κΈ λκ΅°κ°κ° μμ νλ‘κ·Έλ¨μ μ°Ύκ³ μ 곡νλ κ²μ 보μμ΅λλ€.
@AnimaMundi μ μμ μ¬νκ³Ό μ μ¬νκ² noUnusedLocals
λ° noUnusedParameters
νμ΅λλ€. λ΄ "λ¬Έμ " μ°½μ μ€λ₯κ° νμλ©λλ€.
@AnimaMundi @haswalt @keego Lint κ·μΉκ³Ό μ¬μ©νμ§ μλ varμ λν μ»΄νμΌλ¬ κ²μ¬μ μ₯μ μ λ€λ₯Έ TSLint μ€λ λ(https://github.com/palantir/tslint/issues/1481 λ° μ°κ²°λ μ€λ λ)μμ κ΄λ²μνκ² λ Όμλμμ΅λλ€. μ΄ λ¬Έμ λ μ€μ λ‘ κ·Έκ²μ μν μ₯μκ° μλλλ€.
@adidahiya λ΄ μ견μ λ¦°ν° κ·μΉκ³Ό μ»΄νμΌλ¬ κ²μ¬μ μ₯μ μ λν λ Όνμ μ 곡νμ§ μκ³ μ΄ λ¬Έμ μ λν μμ μ¬νμ 곡μ νκΈ° μν κ²μΌ λΏμ λλ€.
μ»΄νμΌλ¬μ 맑기λ κ²μ κ°μ μΌμ νμ§ μμ΅λλ€. μ»΄νμΌλ¬μλ FAILμ΄λΌλ λ¨ νλμ μ΅μ
λ§ μμ΅λλ€.
tslint
μ΄λ₯Ό μ²λ¦¬νλ μ΄μ λ μ’
μ’
κ²½κ³ κ° λμ΄μΌ νκΈ° λλ¬Έμ
λλ€(λ
Ήμ λ¬Όκ²°μ λ λΉ¨κ°μ λ¬Όκ²°μ ).
tslint λ¬Έμ λ ββκ²½κ³ λ‘ νμλ μ μμ λΏλ§ μλλΌ μΌνμ±μΌλ‘ 무μν μλ μμ΅λλ€. λ°λ©΄μ typescript μ»΄νμΌ μ€λ₯λ
μ΄λ¬ν μ μ μ΄λ―Έ λͺ¨λ ν΄μ μ²λ¦¬λμμ΅λλ€(λ΄ λ§μ§λ§ μ£Όμ λ° μ°κ²°λ μ€λ λ μ°Έμ‘°). νμ¬ no-unused-variable
λ₯Ό TSLint κ·μΉμΌλ‘ μ¬μ©νλ κ²μ λ§μ μ μλ κ²μ μμ΅λλ€. μ΄ νμ λκΈμ΄ 무μμ λ¬μ±νλ €κ³ νλμ§ μ λͺ¨λ₯΄κ² μ΅λλ€.
@mastrauckas μ΄ κ·μΉμ μ¬μ ν λ¬Έμ κ° μμ΅λκΉ? --type-check
νλκ·Έλ λ μ΄μ μ¬μ©λμ§ μμ§λ§ μ ν κ²μ¬ κΈ°λ° κ·μΉμ μ¬μ©νλ €λ©΄ --project
κ° νμν©λλ€.
μ μ³λκ³ : TS 2.6 μμλ // @ts-ignore
λ₯Ό μ¬μ©νμ¬ μ»΄νμΌλ¬ μ€λ₯λ₯Ό μ΅μ ν μ μμ΅λλ€.
@adidahiya λλ μ΄κ²μ μ»΄νμΌλ¬ κ·μΉμ΄ μλ 보νΈλΌκΈ° κ·μΉμΌλ‘ μ¬μ©ν μ΄μ κ° μλ€κ³ μ£Όμ₯νλ μμ μ£Όμμ μλ΅νμ λΏμ λλ€.
νμ§λ§ λΉμ λ§μ΄ λ§μμ. κ΄λ ¨ λ¬Έμ λ tslint μμ²΄κ° μλ vscode νμ₯μ μλ€λ κ²μ λλ€. tbh μ΄ μ£Όμ μ λν΄ λ무 λ§μ λ¬Έμ κ° μμ΄μ μλνμ§ μλ μ΄μ μ μμΉλ₯Ό μ νν νμ νλ λ° μκ°μ΄ κ±Έλ Έμ΅λλ€.
νμ μ£Όμ μ κ°μ¬ν©λλ€. 2.6μΌλ‘ μ ννλ μ¦μ μ»΄νμΌλ¬ μ€μ μ μ¬μ©νλλ‘ λ€μ μ ννκ² μ΅λλ€.
μ΄κ²μ μ£Όμ₯νλ μ¬λλ€μ μν λ λ€λ₯Έ μμ μ λ¦°νΈ κ·μΉμ΄ λμ΄μλ μ λλ€λ κ²μ λλ€. λ¦°νΈ κ²½κ³ λ μμ ν μ μμΌλ©° μ΄κ²μ΄ μ΄μ λν μ£Όμ ν보μ λλ€.
μ΅μ 1.19 VS Code The 'no-unused-variable' rule requires type information
μμ λμΌν κ²½κ³ κ° νμλ©λλ€(μλ μ°Έμ‘°). λ΄ κ΅¬μ±μ λλ½λ κ²μ΄ μμ΅λκΉ?
{
"extends": "tslint:recommended",
"rules": {
"linebreak-style": [true, "LF"],
"quotemark": [true, "single", "avoid-escape", "avoid-template"],
"no-console": false,
"no-unused-expression": false,
"ordered-imports": false,
"member-access": [true, "no-public"],
"object-literal-sort-keys": false,
"curly": [true, "ignore-same-line"],
"semicolon": [true, "never"],
"no-var-requires": false,
"no-unused-variable": true
}
}
VSCode 1.19 μΆκ° μ 보λ₯Ό 보면 μ΄ κ·μΉκ³Ό λ€λ₯Έ κ·μΉμ κ²½κ³ λ‘ μ²λ¦¬νλ μλ‘μ΄ κΈ°λ₯μ΄ μμ΅λλ€.
μ°λ¦¬μκ² μ΄κ²μ λ€μμ μλ―Έν©λλ€.
"no-unused-variable"
μμ tslint.json
"noUnusedLocals"
μ°λ¦¬μ tsconfig.json
λ€λ₯Έ κ·μΉμ λ μλ₯Ό μν μ°μ΅μΌλ‘ λ¨κ²¨λ‘λλ€ ;-)
tslintλ μ΄ νμ₯μ΄κ³ tsconfigλ VSCode κΈ°λ³Έ μ 곡 λμμ λλ€.
VS 1.19μμ μ΄λ―Έ λ³΄κ³ ν κ² κ°κΈ° λλ¬Έμ no-unused-variable
λ₯Ό μ κ±°νκΈ°λ‘ κ²°μ νμ΅λλ€.
VSCodeκ° μ΄κ²κ³Ό κ΄λ ¨μ΄ μλμ§ μ΄ν΄νμ§ λͺ»ν©λλ€. VSCodeλ§ μ΄λ₯Ό κ²½κ³ λ‘ μ·¨κΈνλ κ²λ§μΌλ‘λ μΆ©λΆνμ§ μμ΅λλ€. μΉν© κ°λ° μλ² κ°μ λΉλκ° κ·Έλ‘ μΈν΄ μ€ν¨νμ§ μλλ‘ ν΄μΌ ν©λλ€. no-unused-variable
νΉμ νΈμ§μμ μκ΄μμ΄
?
@pelotom , μ¬λ¬ μ¬λλ€μ΄ VSCode TSLint νμ₯μμ μ¬κΈ°λ‘ 리λλ μ λμμ΅λλ€(μ: https://github.com/Microsoft/vscode-tslint/issues/219).
μ§κΈκΉμ§ TSλ μΌλΆ λ¬Έμ λ₯Ό κ²½κ³ (λ Ήμ λ¬Όκ²°μ )λ‘ νμν μ μμμ§λ§ λ¦°νΈ(ESlint, TSLint)λ νμν μ μμμ΅λλ€. κ·Έλμ μ°λ¦¬λ TSlintκ° μ¬μ©νμ§ μλ λ³μλ₯Ό κ²½κ³ λ‘ λ³΄κ³ νμ§ μλ μ΄μ λ₯Ό λ¬»κ³ μμμ΅λλ€. νμ§λ§ 1.19λΆν° VSCodeμ TSλ μ΄λ¬ν κ²½κ³ λ₯Ό μμ±ν μ μμΌλ©° μ°λ¦¬λ μ΄ λ¬Έμ μμ μ² νν©λλ€ π
λΆλͺ ν λ§μλ리μλ©΄, μ λ VSCodeλ₯Ό μ¬μ©νλ©° μ΄λ¬ν κ²½κ³ κ° νΈμ§κΈ°μμ κ°μ‘° νμλλ κ²μ λ³΄κ³ μΆμ§λ§ VSCodeμ μ€μ μ λλ¨Έμ§ λΆλΆμ μν₯μ λ―ΈμΉμ§ μκΈ° λλ¬Έμ μ»΄νμΌλ¬ μ€λ₯μ μ¬κ°λλ₯Ό _ꡬμ±_νλ μλͺ»λ κ³μΈ΅μ²λΌ 보μ λλ€. λꡬ 체μΈ.
λλ Tomμ λ§μ λμνλ©°, μλν°μ λΉλ/CI μ μ°¨κ° λͺ¨λ μ μ ν μ§μμ λ°μ μ μλ κ³³μμ μ루μ μ μ°Ύμ μ μκΈ°λ₯Ό λ°λλλ€. μ§κΈκΉμ§ μ°λ¦¬λ κ°λ ₯ν λ°λ°(μ λΉν κ²μ²λΌ 보μ)μ 보μκ³ μΌλΆ(μ λ₯Ό ν¬ν¨νμ¬)λ μ€μ μ루μ μ λν ν¬λ§μ μ μ§νλ©΄μ μ€λ μ°λ¦¬κ° ν μ μλ κ²μ μ·¨ν κ²μ λλ€.
VSCode 1.19 μΆκ° μ 보λ₯Ό 보면 μ΄ κ·μΉκ³Ό λ€λ₯Έ κ·μΉμ κ²½κ³ λ‘ μ²λ¦¬νλ μλ‘μ΄ κΈ°λ₯μ΄ μμ΅λλ€.
@rnemec "readme" λμ "λ¦΄λ¦¬μ€ λ ΈνΈ"λ₯Ό μμ±νλ €κ³ νλ κ²
VS Codeλ μ΄μ TypeScript μ½λ μ€νμΌ λ¬Έμ λ₯Ό μ€λ₯ λμ κ²½κ³ λ‘ νμν©λλ€. μ΄κ²μ λ€μμ μ μ©λ©λλ€:
λ³μκ° μ μΈλμμ§λ§ μ¬μ©λμ§ μμ
μμ±μ΄ μ μΈλμμ§λ§ κ°μ μ½μ§ μμ΅λλ€.
μ°κ²°ν μ μλ μ½λκ° κ°μ§λμμ΅λλ€.
λ―Έμ¬μ© λΌλ²¨
μ€μμΉμ μΌμ΄μ€λ₯Ό ν΅ν΄ λμ΄μ§
λͺ¨λ μ½λ κ²½λ‘κ° κ°μ λ°ννλ κ²μ μλλλ€.
μ΄λ₯Ό κ²½κ³ λ‘ μ²λ¦¬νλ κ²μ TSLintμ κ°μ λ€λ₯Έ λꡬμ μΌμΉν©λλ€. μ΄κ²μ λͺ λ Ήμ€μμ tscλ₯Ό μ€νν λ μ¬μ ν μ€λ₯λ‘ νμλ©λλ€."typescript.reportStyleChecksAsWarnings": falseλ₯Ό μ€μ νμ¬ μ΄ λμμ λΉνμ±νν μ μμ΅λλ€.
λ°λΌμ μ΄κ²μ μμ μ루μ
μ΄λ©° VSCodeλ₯Ό μ¬μ©ν λλ§ μλν©λλ€. tsc
μ§μ μ¬μ©νλ λ€λ₯Έ λΉλ λꡬλ κ²½κ³ κ° λ¨μ μλ κ²½μ° μ½λλ₯Ό μ»΄νμΌνμ§ μμ΅λλ€. Atomμ μ¬μ©νλ λλ£κ° μμΌλ―λ‘ λ΄κ° λ³κ²½νκ³ κ²½κ³ μ€ νλλ₯Ό 무μνλ©΄ μ½λλ₯Ό μ»΄νμΌν μ μμ΅λλ€. μ€λ₯Έμͺ½?
λλ μ΄κ²μ΄ μ΄λ»κ² ν΄κ²°λλμ§ μ μ΄ν΄νμ§ λͺ»νλ€. μ»΄νμΌλ¬κ° μ¬μ ν μ€λ₯λ‘ μ²λ¦¬νλ κ²½μ° μ΄λ¬ν νλͺ©μ κ²½κ³ λ‘ νμνλ κ²μ΄ μ΄λ»κ² μ μ©ν©λκΉ?
κ·Έλ¦¬κ³ λ΄κ° μ¬λ°λ₯΄κ² μ΄ν΄νλ€λ©΄ μ₯κΈ°μ μΈ ν΄κ²°μ±
μ tsc
μμ λμΌν λμμ μ μ©νλ νλκ·Έλ₯Ό μΆκ°νκ±°λ(κ²½κ³ μ ν¨κ» μ»΄νμΌλλλ‘) μ΄λ¬ν μ»΄νμΌλ¬ κ²μ¬λ₯Ό μμ ν μ κ±°νλ κ²μ
λλ€.
--- νΈμ§νλ€ ---
μ΄μ λκΈμ λ€ μ½μ§λ μμμ΅λλ€. @pelotom μ μ΄λ―Έ κ°μ
κ°λ° λͺ¨λμ CI λͺ¨λμμ λ¦°νΈ κ²μ¬μ μ¬κ°λκ° λ€λ₯΄λλ‘ νλ €λ©΄ extends
κ° λ€λ₯Έ νλμΈ μ¬λ¬ tslint.json ꡬμ±μ μ¬μ©νμ¬ μ΄ μμ
μ μνν μ μμ΅λλ€. #2569λ defaultSeverity
κ΅¬μ± λΌμΈ νλλ§μΌλ‘ μ¬κ°λλ₯Ό μ νν μ μλλ‘ μ¬κΈ°μ UXκ° μνΈνλλ‘ μμ ν΄μΌ ν©λλ€. νμ¬ μ§ν μ€μ
λλ€.
@adidahiya λ
Όμλκ³ μλ κ²μ tsc
μ noUnusedLocals
μ¬μ©νμ¬ tsc
no-unused-variable
λ¦°νΈ κ·μΉμ λν _λ체_λΌκ³ ν©λλ€.
@pelotom λ§μ΅λλ€. νμ§λ§ tsc
λ μμ§ μ΄λ¬ν μν¬νλ‘λ₯Ό μ§μνμ§ μλ κ² κ°μ΅λλ€. λ κ°μ tsconfig.json
νμΌμ΄ μμ μ μμΌλ©°, μ¬κΈ°μ νλλ λ€λ₯Έ νλλ₯Ό νμ₯νκ³ κ° "λΉ μΉλͺ
μ " μ»΄νμΌλ¬ κ²μ¬(μ΄ κ²½μ° noUnusedLocals
, noUnusedParameters
)λ₯Ό κ°λ³μ μΌλ‘ λΉνμ±νν©λλ€. ' νΈμ§κΈ°μμ μνλ₯Ό κ²½κ³ λ‘ λ³Ό μ μμ΅λλ€.
@adidahiya μ, κ·Έλ κΈ° λλ¬Έμ νμ¬ μ ν¨ν λ체νμ΄ μλλλ€. κ·Έλ¦¬κ³ noUnusedLocals
μ΄ Lint κ·μΉμ²λΌ μλνλλ‘ λ λ§μ λ
Έλ ₯μ ν¬μνλ κ²λ³΄λ€ VSCodeμμ μ λλ‘ μλνλλ‘ λ§λ no-unused-variable
noUnusedLocals
λ₯Ό ν¨μ¬ λ λ³΄κ³ μΆμ΅λλ€. IMO μ»΄νμΌλ¬κ° μ²μλΆν° μ΄λ° μ’
λ₯μ κ²μ¬μ λν μμ κΆμ κ°μ Έμ€λ €κ³ ν κ²μ μ€μμμ΅λλ€.
κ·Έλ¦¬κ³ noUnusedLocalsκ° λ¦°νΈ κ·μΉμ²λΌ μλνλλ‘ λ λ§μ λ Έλ ₯μ ν¬μνλ κ²λ³΄λ€ VSCodeμμ μ λλ‘ μλνλλ‘ λ§λ no-unused-variableμ ν¨μ¬ λ λ³΄κ³ μΆμ΅λλ€.
λ§λ λ§μ΄λ€. μ λ μ΄ νλ‘μ νΈκ° https://github.com/angelozerr/tslint-language-serviceλ₯Ό λͺ©νλ‘ νλ€κ³ λ―Ώμ΅λλ€
λ΄κ° λ무 빨리 λ§νλ€. ν΄λΉ νλ¬κ·ΈμΈμ΄ μ μ©νλλ‘ https://github.com/palantir/tslint/issues/2649 μμ μ°¨λ¨λμμ΅λλ€. λμ ν΄λΉ λ¬Έμ λ₯Ό μΆμ νμμμ€.
@adidahiya λ€, κ½€ μ€λ«λμ μΆμ ν΄μμ΅λλ€.
μ΄κ²μ λν μμμ΄ μμ΅λκΉ? λ μ΄μ μ¬μ©λμ§ μμ΅λκΉ?
@philip-firstorderλ₯Ό μ¬μ©νμ¬ μ΄ λ¬Έμ λ₯Ό ν΄κ²°νμ΅λλ€. --project tsconfig.json
tslint -c tslint.json --project tsconfig.json src/**/*.ts
no-unused-variableμ μ΄μ λ μ΄μ μ¬μ©λμ§ μμ΅λλ€. #3918 λ° #3919λ₯Ό μ°Έμ‘°νμΈμ.
π€ μμ! π TSLintλ λ μ΄μ μ¬μ©λμ§ μμΌλ©° π typescript-eslintλ‘ μ ν ν΄μΌ
π μ΄ μ΄μλ λ μ΄μμ λΆνμν ν λ‘ μ λ°©μ§νκΈ° μν΄ μ κ·Έκ³ μμ΅λλ€. κ°μ¬ν©λλ€! π
κ°μ₯ μ μ©ν λκΈ
VSCode 1.19 μΆκ° μ 보λ₯Ό 보면 μ΄ κ·μΉκ³Ό λ€λ₯Έ κ·μΉμ κ²½κ³ λ‘ μ²λ¦¬νλ μλ‘μ΄ κΈ°λ₯μ΄ μμ΅λλ€.
μ°λ¦¬μκ² μ΄κ²μ λ€μμ μλ―Έν©λλ€.
"no-unused-variable"
μμtslint.json
"noUnusedLocals"
μ°λ¦¬μtsconfig.json
λ€λ₯Έ κ·μΉμ λ μλ₯Ό μν μ°μ΅μΌλ‘ λ¨κ²¨λ‘λλ€ ;-)
tslintλ μ΄ νμ₯μ΄κ³ tsconfigλ VSCode κΈ°λ³Έ μ 곡 λμμ λλ€.