Help us understand the problem. What is going on with this article?

AtomでTypeScriptの環境を構築する

TypeScriptのプラグインをインストール

atom-typescriptをインストール

atom-typescript
https://github.com/TypeStrong/atom-typescript

ターミナルで以下のコマンドを入力
インストールに結構時間がかかるので気長に待ってください。

$ apm install atom-typescript

プロジェクトのルートにtsconfig.jsonファイルを作成

tsconfig.jsonにjsにコンパイルする際の設定を記述します。
compileOnSaveをtrueに指定すると、保存と同時にjsファイルにコンパイルしてくれます。gulpやgruntで自動コンパイルする場合は、falseにしてください。

tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": false,
    "noLib": false,
    "preserveConstEnums": true,
    "suppressImplicitAnyIndexErrors": true
  },
  "formatCodeOptions": {
    "indentSize": 4,
    "tabSize": 4,
    "newLineCharacter": "\r\n",
    "convertTabsToSpaces": true,
    "insertSpaceAfterCommaDelimiter": true,
    "insertSpaceAfterSemicolonInForStatements": true,
    "insertSpaceBeforeAndAfterBinaryOperators": true,
    "insertSpaceAfterKeywordsInControlFlowStatements": true,
    "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
    "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
    "placeOpenBraceOnNewLineForFunctions": true,
    "placeOpenBraceOnNewLineForControlBlocks": true
  },
  "compileOnSave": true,
  "filesGlob": [
    "./**/*.ts",
    "!./node_modules/**/*.ts",
    "!./bower_components/**/*.ts",
    "!./typings/**/*.ts"
  ],
  "files": [
    "./test.ts"
  ]
}

構文チェック

Linterをインストール

Linter
https://github.com/AtomLinter/Linter

ターミナルで以下のコマンドを入力

$ apm install linter

tslintをインストール

tslint
https://github.com/palantir/tslint

ターミナルで以下のコマンドを入力

$ npm install -g tslint
$ apm install linter-tslint

プロジェクトのルートにtslint.jsonファイルを作成

tslint.jsonにtypescriptを構文チェックする各種設定を記述します。

tslint.json
{
  "rules": {
    "class-name": true,
    "curly": true,
    "eofline": false,
    "forin": true,
    "indent": [true, "spaces"],
    "label-position": true,
    "label-undefined": true,
    "max-line-length": [true, 140],
    "no-arg": true,
    "no-bitwise": true,
    "no-console": [true,
      "debug",
      "info",
      "time",
      "timeEnd",
      "trace"
    ],
    "no-construct": true,
    "no-debugger": true,
    "no-duplicate-key": true,
    "no-duplicate-variable": true,
    "no-empty": true,
    "no-eval": true,
    "no-string-literal": false,
    "no-switch-case-fall-through": true,
    "no-trailing-comma": true,
    "no-trailing-whitespace": true,
    "no-unused-expression": true,
    "no-unused-variable": true,
    "no-unreachable": true,
    "no-use-before-declare": true,
    "one-line": [true,
      "check-open-brace",
      "check-catch",
      "check-else",
      "check-whitespace"
    ],
    "quotemark": [true, "single"],
    "radix": false,
    "semicolon": true,
    "triple-equals": [true, "allow-null-check"],
    "variable-name": false,
    "whitespace": [true,
      "check-branch",
      "check-decl",
      "check-operator",
      "check-separator",
      "check-type"
    ]
  }
}
comnico
世界に誇るソーシャルメディアプロフェッショナル集団を創る
http://www.comnico.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした