Skip to content

Dev > Main as 1.0.0 #12

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

Merged
merged 15 commits into from
May 28, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 39 additions & 103 deletions README.ja.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# eslint-rules-default
# eslint-rules-default-jsdoc

## Language

Expand All @@ -7,7 +7,7 @@

## Overview

此のパッケージは、ESLint の全ルールを明示されたディフォルトオプションと共に提供します。
此のパッケージは、ESLint JSDoc plugin の全ルールを明示されたディフォルトオプションと共に提供します。

他の ESLint 構成リポジトリの基本ルールセットとして使用すると、すべてのルールが機能します。無効にしたいルールは、各ルールを明示的にオフにする必要があります。

Expand All @@ -29,111 +29,46 @@ ESLint v9 以降と一緒に此のパッケージをインストールします
```sh
npm install --save-dev \
eslint \
@openreachtech/eslint-rules-default
@openreachtech/eslint-rules-default-jsdoc
```

### Configuring

`eslint.config.js` ファイルに、`@openreachtech/eslint-rules-default` をインポートし、それを使用するためのすべてのルールを含めます。
`eslint.config.js` ファイルに、`@openreachtech/eslint-rules-default-jsdoc` をインポートし、それを使用するためのすべてのルールを含めます。

```js
// eslint.config.js
import ruleHash from '@openreachtech/eslint-rules-default'
import jsdocPlugin from '@openreachtech/eslint-rules-default-jsdoc'

export default [
{
...jsdocPlugin,

rules: {
...ruleHash.core.rules,
...ruleHash.disableCoreStylistic.rules, // Not required after v10.
...jsdocPlugin.rules,

indent: [
'error',
2, // 4
],
quotes: [
'jsdoc/no-multi-asterisks': [
'error',
'single', // 'double'
{
avoidEscape: true,
allowTemplateLiterals: false,
allowWhitespace: false, // true
preventAtEnd: true,
preventAtMiddleLines: true,
},
],
semi: [
'jsdoc/tag-lines': [
'error',
'never', // 'always'
'never',
{
beforeStatementContinuationChars: 'never', // 'any'
count: 1,
startLines: 1, // 0
endLines: 0,
applyToEndTag: true,
tags: {},
},
],

...
},
},
];
```

#### Advanced Configuration

此のパッケージには、幾つかのプラグインのルールセットも含まれています。

1. [@stylistic/eslint-plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin)
2. [ESLint Jest plugin](https://www.npmjs.com/package/eslint-plugin-jest)
3. [ESLint JSDoc plugin](https://www.npmjs.com/package/eslint-plugin-jsdoc)

`@stylistic/eslint-plugin` のルールセットで、現在のバージョンでは以下が含まれています。

| ルールセット | 含む |
|--|:--:|
| eslint-plugin-js | ✅ |
| eslint-plugin-ts | ❌ |
| eslint-plugin-jsx | ❌ |
| eslint-plugin-plus | ✅ |

`ruleHash.stylisticTs` と `ruleHash.stylisticJsx` は、ニーズが多ければ将来追加されます。

#### Frequently-Disabled Rules

ESLint v9 のコア・ルールセットには、stylistic 関連のルールが含まれています。

ESLint v9 で `@stylistic/eslint-plugin` を使う場合は、以下の様にしてコア・ルールセット内の stylistic 関連のルールを無効化します。

```js
// eslint.config.js
import ruleHash from '@openreachtech/eslint-rules-default'

export default [
// core rules
{
rules: {
...ruleHash.core.rules,
...ruleHash.disableCoreStylistic.rules,

indent: [
'error',
2, // 4
],

...
},
},

// @stylistic rules
{
...ruleHash.stylisticJs,

rules: [
...ruleHash.stylisticJs.rules,
...ruleHash.stylisticPlus.rules,

'@stylistic/indent-binary-ops': [
'error',
4, // 2
],

...
],
},
];
]
```

## Track of Changes with Line Comments
Expand All @@ -142,37 +77,37 @@ export default [

```js
// eslint.config.js
import ruleHash from '@openreachtech/eslint-rules-default'
import jsdocPlugin from '@openreachtech/eslint-rules-default-jsdoc'

export default [
{
...jsdocPlugin,

rules: {
...ruleHash.core.rules,
...ruleHash.disableCoreStylistic.rules,
...jsdocPlugin.rules,

indent: [
'error',
2, // 4 <--- ✅
],
quotes: [
'jsdoc/no-multi-asterisks': [
'error',
'single', // 'double' <--- ✅
{
avoidEscape: true,
allowTemplateLiterals: false,
allowWhitespace: false, // true <--- ✅
preventAtEnd: true,
preventAtMiddleLines: true,
},
],
semi: [
'jsdoc/tag-lines': [
'error',
'never', // 'always' <--- ✅
'never',
{
beforeStatementContinuationChars: 'never', // 'any' <--- ✅
count: 1,
startLines: 1, // 0 <--- ✅
endLines: 0,
applyToEndTag: true,
tags: {},
},
],
...
},
},
];
]
```

## License
Expand All @@ -190,9 +125,10 @@ GitHub Issues または Pull Request を通じてお気軽にご提案くださ
私たちはユーザーの期待に応えるよう活動しており、貢献を高く評価します。

```sh
% git clone https://github.com/openreachtech/eslint-rules-default.git
% cd eslint-rules-default
% git clone https://github.com/openreachtech/eslint-rules-default-jsdoc.git
% cd eslint-rules-default-jsdoc
% npm install
% npm run lint
% npm test
```

Expand Down
Loading
Loading