Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Japanese documents to follow original documents #1417

Merged
merged 15 commits into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 10 additions & 45 deletions docs/README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</h1>

<p align="center">
<a href="https://discord.gg/ZegqCBr"><img src="https://img.shields.io/discord/612704110008991783" alt="discord"></a>
<a href="https://travis-ci.org/standard/standard"><img src="https://img.shields.io/travis/standard/standard/master.svg" alt="travis"></a>
<a href="https://www.npmjs.com/package/standard"><img src="https://img.shields.io/npm/v/standard.svg" alt="npm version"></a>
<a href="https://www.npmjs.com/package/eslint-config-standard"><img src="https://img.shields.io/npm/dm/eslint-config-standard.svg" alt="npm downloads"></a>
Expand All @@ -29,50 +30,18 @@

このモジュールは、3つの方法であなたの(そして他の人の!)時間を節約します。:

- **設定不要** プロジェクトに一貫性のあるスタイルを適用する最も簡単な方法です。単に入れるだけ!
- **設定不要** プロジェクトのコード品質を高める最も簡単な方法です。決断はいりません。管理するための`.eslintrc`ファイルも不要です。ただこれだけで動作します。
- **コードを自動的にフォーマット** ただ`standard --fix`を実行するだけで、汚いコードや一貫性のないコードにサヨナラしましょう。
- **スタイルの問題やプログラマーのエラーを早期にキャッチ** レビュアーと作業者の間の往復をなくすことで、貴重なコードレビューの時間を節約します。

導入するために考えなければならないことも、管理するための`.eslintrc`、`.jshintrc`、`.jscsrc`ファイルも必要ありません。ただこれだけで動作します。

インストール方法:

```
npm install standard --save-dev
```
今すぐ`npx standard --fix`を実行して、試してみましょう!

### オープンソースサポーター

<a href="https://tidelift.com/subscription/pkg/npm-standard?utm_source=npm-standard&utm_medium=readme" target='_blank'><img src='https://feross.org/images/supporters/tidelift.png' width=250></a>

[Become a supporter!](https://feross.org/thanks/)

## StandardJS — ルール

- **2スペース** – インデントのため
- **文字列にはシングルクォート** – エスケープを避ける場合を除く
- **未使用の変数なし** – 多くのバグをキャッチ!
- **セミコロンなし** – [It's][1] [fine.][2] [Really!][3] (訳注: 試してみなって!マジで良いぞ!)
- [詳細][4]
- **キーワードの後にスペース** `if (condition) { ... }`
- **関数名の後にスペース** `function name (arg) { ... }`
- 常に`==`ではなく`===`を使用 – ただし`obj == null`は`null || undefined`をチェックするために許容されています
- 常にnode.jsの`err`引数をハンドル
- ファイルの先頭に`/* global */`コメントでブラウザのグローバルオブジェクトを宣言
- `open`、`length`、`event`、`name`のようなあいまいな名前のグローバルオブジェクトの誤用を防ぎます
- 例: `/* global alert, prompt */`
- 例外: `window`、`document`、`navigator`
- **そして[もっと良いこと色々][5]** – *`standard`を今すぐ試そう!*

[1]: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding
[2]: http://inimino.org/~inimino/blog/javascript_semicolons
[3]: https://www.youtube.com/watch?v=gsfbh17Ax9I
[4]: RULES-ja.md#semicolons
[5]: RULES-ja.md#javascript-standard-style

より良いアイデアを得るには、JavaScript Standard Styleで書かれた[サンプルファイル](https://github.com/expressjs/body-parser/blob/master/index.js)を見てみましょう。
または、`standard`を使用している[何千ものプロジェクト](https://raw.githubusercontent.com/standard/standard-packages/master/all.json)を参照してください!

## 目次

- クイックスタート
Expand Down Expand Up @@ -184,8 +153,6 @@ ESLint"](https://www.youtube.com/watch?v=kuHfMw8j4xk)をご覧ください。こ

<h2 id="#who-uses-javascript-standard-style">誰がJavaScript Standard Styleを使用していますか?</h2>

多くの人々!

[<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/nodejs.png>](https://nodejs.org) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/npm.png>](https://www.npmjs.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/github.png>](https://github.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/elastic.png>](https://www.elastic.co) |
|---|---|---|---|

Expand Down Expand Up @@ -475,8 +442,6 @@ $ standard --parser babel-eslint
}
```

もし`standard`がグローバルインストールされている場合(つまり`npm install standard --global`)、`npm install babel-eslint --global`で`babel-eslint`もグローバルインストールしてください。

<h2 id="can-i-use-a-javascript-language-variant-like-flow-or-typescript">FlowやTypeScriptのようなJavaScriptの代替言語を使用できますか?</h2>

`standard`は最新のECMAScriptの機能をサポートしています。しかしながら、FlowやTypeScriptは言語に新たな構文を追加するため、そのまま使用することはできません。
Expand Down Expand Up @@ -510,11 +475,9 @@ $ standard --parser babel-eslint --plugin flowtype

*注: `plugin`と`plugins`は同じです。*

もし`standard`がグローバルインストールされている場合(つまり`npm install standard --global`)、`npm install babel-eslint eslint-plugin-flowtype --global`で`babel-eslint`と`eslint-plugin-flowtype`もグローバルインストールしてください。

### TypeScript

TypeScriptを使用するには、`@typescript-eslint/parser`をパーサとして、`eslint-plugin-typescript`をプラグインとして`standard`を実行し、`*.ts`ファイルをリントするようにstandardに伝える必要があります(デフォルトではリントされないため)。
TypeScriptを使用するには、`@typescript-eslint/parser`をパーサとして、`@typescript-eslint/eslint-plugin`をプラグインとして`standard`を実行し、`**/*.ts`ファイルをリントするようにstandardに伝える必要があります(デフォルトではリントされないため)。

```bash
npm install @typescript-eslint/parser @typescript-eslint/eslint-plugin --save-dev
Expand All @@ -523,7 +486,7 @@ npm install @typescript-eslint/parser @typescript-eslint/eslint-plugin --save-de
そして、次のコマンドを実行します。:

```bash
$ standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin *.ts
$ standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin **/*.ts
```

あるいは、次の内容を`package.json`に追加してください。:
Expand All @@ -540,11 +503,9 @@ $ standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint
`package.json`にこれを追加すると、次のコマンドが実行できます。:

```bash
standard *.ts
standard **/*.ts
```

もし`standard`がグローバルインストールされている場合(つまり`npm install standard --global`)、`npm install @typescript-eslint/parser eslint-plugin-typescript --global`で`@typescript-eslint/parser`と`eslint-plugin-typescript`もグローバルインストールしてください。

<h2 id="what-about-mocha-jest-jasmine-qunit-etc">Mocha、Jest、Jasmine、QUnitなどはどうすれば?</h2>

テストファイルでmochaをサポートするには、次のコメントをテストファイルの先頭に追加します。:
Expand Down Expand Up @@ -732,6 +693,10 @@ var opts = {

多くの **[エディタープラグイン](#are-there-text-editor-plugins)** 、 **[`standard`を使用しているnpmパッケージ](https://github.com/standard/standard-packages)** のリスト、 **[`standard`のエコシステムのパッケージ](https://github.com/standard/awesome-standard)** の素晴らしいリストもあります。

<h2 id="security-policies-and-procedures">セキュリティポリシーと手続き</h2>

`standard`チームとコミュニティは、`standard`におけるすべてのバグを真摯に受け止めています。問題を報告する方法については、[security policies and procedures](https://github.com/standard/.github/blob/master/SECURITY.md)を参照してください。

<h2 id="license">ライセンス</h2>

[MIT](LICENSE). Copyright (c) [Feross Aboukhadijeh](https://feross.org).
8 changes: 6 additions & 2 deletions docs/RULES-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
eslint: [`quotes`](http://eslint.org/docs/rules/quotes)

```js
console.log('hello there')
$("<div class='box'>")
console.log('hello there') // ✓ ok
console.log("hello there") // ✗ avoid
console.log(`hello there`) // ✗ avoid

$("<div class='box'>") // ✓ ok
console.log(`hello ${name}`) // ✓ ok
```

* **未使用の変数は定義しない。**
Expand Down