@eslint-recommended/eslint-config 27.0.0 → 29.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +221 -0
- package/README.md +166 -44
- package/index.d.ts +8 -0
- package/index.js +29 -19
- package/package.json +22 -20
package/README.ja.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
[English](README.md) | **日本語**
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@eslint-recommended/eslint-config)
|
|
4
|
+
[](https://github.com/eslint-recommended/eslint-config/actions/workflows/lint.yml)
|
|
5
|
+
[](https://github.com/eslint-recommended)
|
|
6
|
+
|
|
7
|
+
# @eslint-recommended/eslint-config
|
|
8
|
+
|
|
9
|
+
JavaScript向けの推奨 ESLint Flat Config
|
|
10
|
+
|
|
11
|
+
## ✨ コンセプト
|
|
12
|
+
|
|
13
|
+
- ESLint公式の[推奨ルール](https://eslint.org/docs/latest/use/configure/configuration-files#use-predefined-configurations)でJavaScriptのよくあるミスを検出します。
|
|
14
|
+
- ESLintが対応する最新のJavaScript構文を使えます。
|
|
15
|
+
- 共有プリセットには、ライブラリやフレームワークを問わず使える汎用プラグインだけを含めます。
|
|
16
|
+
- 各プラグインの推奨設定を使って、コード品質とドキュメントコメントを検査します。
|
|
17
|
+
|
|
18
|
+
## ✅ 動作要件
|
|
19
|
+
|
|
20
|
+
- [Node.js](https://nodejs.org/en) `^22.22.2 || >=24.15.0`
|
|
21
|
+
- [ESLint](https://eslint.org/) `^10.4.0`
|
|
22
|
+
|
|
23
|
+
## ⬇️ インストール
|
|
24
|
+
|
|
25
|
+
**[npm](https://docs.npmjs.com/)**
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm i -D eslint@^10.4.0 @eslint-recommended/eslint-config
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**[Yarn](https://yarnpkg.com/)**
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
yarn add -D eslint@^10.4.0 @eslint-recommended/eslint-config
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**[pnpm](https://pnpm.io/)**
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
pnpm add -D eslint@^10.4.0 @eslint-recommended/eslint-config
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## ⚙️ 設定ファイル
|
|
44
|
+
|
|
45
|
+
プロジェクトに合ったESLint設定ファイルの形式を選びます。対応する形式は[ESLintの設定ファイルガイド](https://eslint.org/docs/latest/use/configure/configuration-files)を参照してください。
|
|
46
|
+
|
|
47
|
+
### JavaScript形式の設定ファイル
|
|
48
|
+
|
|
49
|
+
#### ES modules
|
|
50
|
+
|
|
51
|
+
`eslint.config.mjs` を使用します。`package.json` に `"type": "module"` がある場合は、`eslint.config.js` も使えます。
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
import { recommended } from '@eslint-recommended/eslint-config'
|
|
55
|
+
|
|
56
|
+
export default recommended()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### CommonJS
|
|
60
|
+
|
|
61
|
+
`eslint.config.cjs` を使用します。CommonJSを使うパッケージでは、`eslint.config.js` も使えます。
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
const { recommended } = require('@eslint-recommended/eslint-config')
|
|
65
|
+
|
|
66
|
+
module.exports = recommended()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 📖 使い方
|
|
70
|
+
|
|
71
|
+
プロジェクトのルートでESLintを実行します。
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
npx eslint .
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
既定で `.js`、`.mjs`、`.cjs`、`.jsx` がlintの対象になります。
|
|
78
|
+
|
|
79
|
+
`console` や `process` など実行環境固有のグローバル変数を使う場合は、ESLintの [`languageOptions.globals`](https://eslint.org/docs/latest/use/configure/language-options#predefined-global-variables) で指定してください。
|
|
80
|
+
|
|
81
|
+
npmスクリプトとしてESLintを実行する場合は、`package.json` の `scripts` に `lint` を追加します。
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"scripts": {
|
|
86
|
+
"lint": "eslint ."
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
プロジェクトのルートでスクリプトを実行します。
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
npm run lint
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## ⚙️ オプションとカスタマイズ
|
|
98
|
+
|
|
99
|
+
`recommended()` は既定で `.js`・`.mjs`・`.cjs`・`.jsx` をlintの対象にします。以下のオプションで対象ファイルのパターンを追加できます。
|
|
100
|
+
|
|
101
|
+
### `filesJs`
|
|
102
|
+
|
|
103
|
+
JavaScriptとJSDocのルールを適用するファイルのグロブパターンを追加します。
|
|
104
|
+
|
|
105
|
+
| 型 | 既定値 |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `string[]` | `[]` |
|
|
108
|
+
|
|
109
|
+
設定例は、[HTML](example/html/eslint.config.js)と[Vue(JavaScript)](example/vue/js/eslint.config.js)を参照してください。
|
|
110
|
+
|
|
111
|
+
### ルールの上書きとファイルの除外
|
|
112
|
+
|
|
113
|
+
ルールの追加や、既存ルールの有効・無効、重大度、オプションの変更は、`recommended()` の後に設定を追加して行います。生成先のディレクトリは `globalIgnores()` で除外できます。
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
import { globalIgnores } from 'eslint/config'
|
|
117
|
+
import { recommended } from '@eslint-recommended/eslint-config'
|
|
118
|
+
|
|
119
|
+
export default [
|
|
120
|
+
globalIgnores(['dist/']),
|
|
121
|
+
...recommended(),
|
|
122
|
+
{
|
|
123
|
+
rules: {
|
|
124
|
+
'no-console': 'warn',
|
|
125
|
+
'no-empty': ['error', { allowEmptyCatch: true }]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 設定を特定のファイルに適用する
|
|
132
|
+
|
|
133
|
+
`files` と `extends` を使うと、プリセットの適用範囲をグロブパターンで絞れます。以下の例では、`src/` 配下の対象ファイルに適用します。詳しくは[ESLintの設定配列を組み合わせるガイド](https://eslint.org/docs/latest/use/configure/combine-configs#apply-a-config-array)を参照してください。
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
import { defineConfig } from 'eslint/config'
|
|
137
|
+
import { recommended } from '@eslint-recommended/eslint-config'
|
|
138
|
+
|
|
139
|
+
export default defineConfig([
|
|
140
|
+
{
|
|
141
|
+
files: ['src/**'],
|
|
142
|
+
extends: recommended()
|
|
143
|
+
}
|
|
144
|
+
])
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 他の設定と併用する
|
|
148
|
+
|
|
149
|
+
他の共有設定は、`recommended()` が返す設定と同じ Flat Config の配列に追加できます。設定が競合する場合は、後に置いた方が優先されます。
|
|
150
|
+
|
|
151
|
+
#### neostandard
|
|
152
|
+
|
|
153
|
+
[neostandard](https://github.com/neostandard/neostandard)を使うには、`npm i -D neostandard` でインストールし、`recommended()` の後に適用します。
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
import { recommended } from '@eslint-recommended/eslint-config'
|
|
157
|
+
import { neostandard } from 'neostandard'
|
|
158
|
+
|
|
159
|
+
export default [
|
|
160
|
+
...recommended(),
|
|
161
|
+
...neostandard()
|
|
162
|
+
]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
必要に応じて、次の設定を配列の末尾に追加します。
|
|
166
|
+
|
|
167
|
+
- ES2022より新しい構文を使う場合は、対象ファイルの `languageOptions.ecmaVersion` を `'latest'` に設定します。
|
|
168
|
+
- `.cjs` をCommonJSとして扱うには、そのファイルの `languageOptions.sourceType` を `'commonjs'` に設定します。
|
|
169
|
+
|
|
170
|
+
## 📂 サンプル
|
|
171
|
+
|
|
172
|
+
- [JavaScript](example/js/)
|
|
173
|
+
- [JSX](example/jsx/)
|
|
174
|
+
- [HTML内のJavaScript](example/html/)
|
|
175
|
+
- [Markdown内のJavaScriptコードブロック](example/markdown/js/)
|
|
176
|
+
- [Vue(JavaScript)](example/vue/js/)
|
|
177
|
+
- [neostandard](example/neostandard/)
|
|
178
|
+
|
|
179
|
+
開発依存をインストールし、リポジトリのルートでサンプルを実行します。
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
npm ci
|
|
183
|
+
npx eslint example/js
|
|
184
|
+
npx eslint example/jsx
|
|
185
|
+
npx eslint example/html
|
|
186
|
+
npx eslint example/markdown/js
|
|
187
|
+
npx eslint example/vue/js
|
|
188
|
+
npx eslint example/neostandard
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 🧩 使用している設定とプラグイン
|
|
192
|
+
|
|
193
|
+
- [@eslint/js](https://github.com/eslint/eslint/tree/main/packages/js) — ESLint公式のJavaScript向け推奨ルール
|
|
194
|
+
- [@eslint-community/eslint-plugin-eslint-comments](https://github.com/eslint-community/eslint-plugin-eslint-comments) — ESLintの設定ディレクティブを含むコメントの検査
|
|
195
|
+
- [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) — JavaScriptのJSDoc検査
|
|
196
|
+
|
|
197
|
+
## 🧑💻 開発
|
|
198
|
+
|
|
199
|
+
開発環境のセットアップ、検証、ドキュメントの更新方法は、[コントリビューションガイド](CONTRIBUTING.ja.md)を参照してください。
|
|
200
|
+
|
|
201
|
+
## 🏷️ バッジ
|
|
202
|
+
|
|
203
|
+
このバッジで、プロジェクトがESLint Recommendedを使っていることを示せます。
|
|
204
|
+
|
|
205
|
+
[](https://github.com/eslint-recommended)
|
|
206
|
+
|
|
207
|
+
**Markdown形式**
|
|
208
|
+
|
|
209
|
+
```md
|
|
210
|
+
[](https://github.com/eslint-recommended)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**HTML形式**
|
|
214
|
+
|
|
215
|
+
```html
|
|
216
|
+
<a href="https://github.com/eslint-recommended"><img src="https://img.shields.io/badge/eslint-recommended-%234B32C3" alt="ESLint Recommended"></a>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## 🔗 関連パッケージ
|
|
220
|
+
|
|
221
|
+
- [@eslint-recommended/eslint-config-typescript](https://www.npmjs.com/package/@eslint-recommended/eslint-config-typescript)
|
package/README.md
CHANGED
|
@@ -1,84 +1,206 @@
|
|
|
1
|
-
[
|
|
1
|
+
**English** | [日本語](README.ja.md)
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@eslint-recommended/eslint-config)
|
|
2
4
|
[](https://github.com/eslint-recommended/eslint-config/actions/workflows/lint.yml)
|
|
3
5
|
[](https://github.com/eslint-recommended)
|
|
4
6
|
|
|
5
7
|
# @eslint-recommended/eslint-config
|
|
6
8
|
|
|
7
|
-
Recommended ESLint
|
|
8
|
-
|
|
9
|
-
## Overview
|
|
9
|
+
Recommended ESLint Flat Config for JavaScript
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## ✨ Concept
|
|
12
12
|
|
|
13
|
-
- [
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- [eslint-plugin-jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc)
|
|
18
|
-
- [eslint-plugin-regexp](https://www.npmjs.com/package/eslint-plugin-regexp)
|
|
13
|
+
- Uses ESLint's [recommended rules](https://eslint.org/docs/latest/use/configure/configuration-files#use-predefined-configurations) to catch common JavaScript errors.
|
|
14
|
+
- Supports the latest JavaScript syntax available in ESLint.
|
|
15
|
+
- Includes only general-purpose plugins in the shared preset.
|
|
16
|
+
- Applies each plugin's recommended settings for code quality and documentation comments.
|
|
19
17
|
|
|
20
|
-
## Requirements
|
|
18
|
+
## ✅ Requirements
|
|
21
19
|
|
|
22
|
-
- Node.js
|
|
23
|
-
- ESLint
|
|
20
|
+
- [Node.js](https://nodejs.org/en) `^22.22.2 || >=24.15.0`
|
|
21
|
+
- [ESLint](https://eslint.org/) `^10.4.0`
|
|
24
22
|
|
|
25
|
-
## Installation
|
|
23
|
+
## ⬇️ Installation
|
|
26
24
|
|
|
27
|
-
npm
|
|
25
|
+
**[npm](https://docs.npmjs.com/)**
|
|
28
26
|
|
|
29
27
|
```sh
|
|
30
|
-
npm i -D @eslint-recommended/eslint-config
|
|
28
|
+
npm i -D eslint@^10.4.0 @eslint-recommended/eslint-config
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
Yarn
|
|
31
|
+
**[Yarn](https://yarnpkg.com/)**
|
|
34
32
|
|
|
35
33
|
```sh
|
|
36
|
-
yarn add -D @eslint-recommended/eslint-config
|
|
34
|
+
yarn add -D eslint@^10.4.0 @eslint-recommended/eslint-config
|
|
37
35
|
```
|
|
38
36
|
|
|
39
|
-
pnpm
|
|
37
|
+
**[pnpm](https://pnpm.io/)**
|
|
40
38
|
|
|
41
39
|
```sh
|
|
42
|
-
pnpm add -D @eslint-recommended/eslint-config
|
|
40
|
+
pnpm add -D eslint@^10.4.0 @eslint-recommended/eslint-config
|
|
43
41
|
```
|
|
44
42
|
|
|
45
|
-
##
|
|
43
|
+
## ⚙️ Configuration files
|
|
44
|
+
|
|
45
|
+
Choose the format of your ESLint configuration file. See the [ESLint configuration file guide](https://eslint.org/docs/latest/use/configure/configuration-files) for the available formats.
|
|
46
|
+
|
|
47
|
+
### JavaScript configuration
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
#### ES modules
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
Use `eslint.config.mjs` or `eslint.config.js` in a package with `"type": "module"`.
|
|
50
52
|
|
|
51
53
|
```javascript
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
import { recommended } from '@eslint-recommended/eslint-config'
|
|
55
|
+
|
|
56
|
+
export default recommended()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### CommonJS
|
|
60
|
+
|
|
61
|
+
Use `eslint.config.cjs` or `eslint.config.js` in a package that uses CommonJS.
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
const { recommended } = require('@eslint-recommended/eslint-config')
|
|
65
|
+
|
|
66
|
+
module.exports = recommended()
|
|
58
67
|
```
|
|
59
68
|
|
|
60
|
-
|
|
69
|
+
## 📖 Usage
|
|
70
|
+
|
|
71
|
+
Run ESLint from your project root.
|
|
61
72
|
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
- @eslint-recommended
|
|
65
|
-
# add other rulesets here if needed
|
|
73
|
+
```sh
|
|
74
|
+
npx eslint .
|
|
66
75
|
```
|
|
67
76
|
|
|
68
|
-
|
|
77
|
+
By default, the preset lints `.js`, `.mjs`, `.cjs`, and `.jsx` files.
|
|
69
78
|
|
|
70
|
-
|
|
79
|
+
Set ESLint's [`languageOptions.globals`](https://eslint.org/docs/latest/use/configure/language-options#predefined-global-variables) if your code uses runtime globals such as `console` or `process`.
|
|
80
|
+
|
|
81
|
+
To run ESLint as an npm script, add a `lint` entry to `scripts` in `package.json`.
|
|
82
|
+
|
|
83
|
+
```json
|
|
71
84
|
{
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
]
|
|
85
|
+
"scripts": {
|
|
86
|
+
"lint": "eslint ."
|
|
87
|
+
}
|
|
76
88
|
}
|
|
77
89
|
```
|
|
78
90
|
|
|
79
|
-
|
|
91
|
+
Run the script from your project root.
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
npm run lint
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## ⚙️ Options and customization
|
|
98
|
+
|
|
99
|
+
By default, `recommended()` lints `.js`, `.mjs`, `.cjs`, and `.jsx` files. Use the options below to add file patterns.
|
|
100
|
+
|
|
101
|
+
### `filesJs`
|
|
102
|
+
|
|
103
|
+
Adds glob patterns for files that should receive JavaScript and JSDoc rules.
|
|
104
|
+
|
|
105
|
+
| Type | Default |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `string[]` | `[]` |
|
|
108
|
+
|
|
109
|
+
See the configuration examples for [HTML](example/html/eslint.config.js) and [Vue with JavaScript](example/vue/js/eslint.config.js).
|
|
110
|
+
|
|
111
|
+
### Override rules and ignore files
|
|
112
|
+
|
|
113
|
+
Add a config entry after `recommended()` to enable additional rules, disable existing rules, or change their severity or options. Use `globalIgnores()` for generated directories.
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
import { globalIgnores } from 'eslint/config'
|
|
117
|
+
import { recommended } from '@eslint-recommended/eslint-config'
|
|
118
|
+
|
|
119
|
+
export default [
|
|
120
|
+
globalIgnores(['dist/']),
|
|
121
|
+
...recommended(),
|
|
122
|
+
{
|
|
123
|
+
rules: {
|
|
124
|
+
'no-console': 'warn',
|
|
125
|
+
'no-empty': ['error', { allowEmptyCatch: true }]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Apply the config to specific files
|
|
132
|
+
|
|
133
|
+
Use `files` with `extends` to restrict the preset to files that match your glob patterns. The example below applies it under `src/`. See the [ESLint guide to combining config arrays](https://eslint.org/docs/latest/use/configure/combine-configs#apply-a-config-array) for details.
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
import { defineConfig } from 'eslint/config'
|
|
137
|
+
import { recommended } from '@eslint-recommended/eslint-config'
|
|
138
|
+
|
|
139
|
+
export default defineConfig([
|
|
140
|
+
{
|
|
141
|
+
files: ['src/**'],
|
|
142
|
+
extends: recommended()
|
|
143
|
+
}
|
|
144
|
+
])
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Combine with other configs
|
|
148
|
+
|
|
149
|
+
Add other shared configs to the same Flat Config array as `recommended()`. Later entries take precedence when settings conflict.
|
|
150
|
+
|
|
151
|
+
#### neostandard
|
|
152
|
+
|
|
153
|
+
To use [neostandard](https://github.com/neostandard/neostandard), run `npm i -D neostandard` and apply it after `recommended()`.
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
import { recommended } from '@eslint-recommended/eslint-config'
|
|
157
|
+
import { neostandard } from 'neostandard'
|
|
158
|
+
|
|
159
|
+
export default [
|
|
160
|
+
...recommended(),
|
|
161
|
+
...neostandard()
|
|
162
|
+
]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Append these settings as needed.
|
|
166
|
+
|
|
167
|
+
- For syntax newer than ES2022, set `languageOptions.ecmaVersion` to `'latest'` for the relevant files.
|
|
168
|
+
- For CommonJS, set `languageOptions.sourceType` to `'commonjs'` for `.cjs` files.
|
|
169
|
+
|
|
170
|
+
## 📂 Examples
|
|
171
|
+
|
|
172
|
+
- [JavaScript](example/js/)
|
|
173
|
+
- [JSX](example/jsx/)
|
|
174
|
+
- [JavaScript in HTML](example/html/)
|
|
175
|
+
- [JavaScript code blocks in Markdown](example/markdown/js/)
|
|
176
|
+
- [Vue with JavaScript](example/vue/js/)
|
|
177
|
+
- [neostandard](example/neostandard/)
|
|
178
|
+
|
|
179
|
+
Install the repository's development dependencies and run an example from the repository root.
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
npm ci
|
|
183
|
+
npx eslint example/js
|
|
184
|
+
npx eslint example/jsx
|
|
185
|
+
npx eslint example/html
|
|
186
|
+
npx eslint example/markdown/js
|
|
187
|
+
npx eslint example/vue/js
|
|
188
|
+
npx eslint example/neostandard
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 🧩 Included configs and plugins
|
|
192
|
+
|
|
193
|
+
- [@eslint/js](https://github.com/eslint/eslint/tree/main/packages/js) — ESLint's recommended rules for JavaScript.
|
|
194
|
+
- [@eslint-community/eslint-plugin-eslint-comments](https://github.com/eslint-community/eslint-plugin-eslint-comments) — ESLint directive comment checks.
|
|
195
|
+
- [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) — JSDoc checks for JavaScript.
|
|
196
|
+
|
|
197
|
+
## 🧑💻 Development
|
|
198
|
+
|
|
199
|
+
See the [Contributing Guide](CONTRIBUTING.md) for environment setup, checks, and documentation updates.
|
|
200
|
+
|
|
201
|
+
## 🏷️ Badge
|
|
80
202
|
|
|
81
|
-
|
|
203
|
+
Use this badge to show that your project uses ESLint Recommended.
|
|
82
204
|
|
|
83
205
|
[](https://github.com/eslint-recommended)
|
|
84
206
|
|
|
@@ -94,6 +216,6 @@ HTML:
|
|
|
94
216
|
<a href="https://github.com/eslint-recommended"><img src="https://img.shields.io/badge/eslint-recommended-%234B32C3" alt="ESLint Recommended"></a>
|
|
95
217
|
```
|
|
96
218
|
|
|
97
|
-
## Related
|
|
219
|
+
## 🔗 Related packages
|
|
98
220
|
|
|
99
221
|
- [@eslint-recommended/eslint-config-typescript](https://www.npmjs.com/package/@eslint-recommended/eslint-config-typescript)
|
package/index.d.ts
ADDED
package/index.js
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import comments from '@eslint-community/eslint-plugin-eslint-comments/configs'
|
|
4
|
+
import js from '@eslint/js'
|
|
5
|
+
import { defineConfig } from 'eslint/config'
|
|
6
|
+
import jsdoc from 'eslint-plugin-jsdoc'
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
9
|
+
* @param {import('./index.d.ts').Options} [options] - Options for file matching.
|
|
10
|
+
* @returns {import('eslint').Linter.Config[]} A flat config array.
|
|
8
11
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'standard',
|
|
12
|
-
'plugin:unicorn/recommended',
|
|
13
|
-
'plugin:sonarjs/recommended',
|
|
14
|
-
'plugin:@eslint-community/eslint-comments/recommended',
|
|
15
|
-
'plugin:jsdoc/recommended',
|
|
16
|
-
'plugin:regexp/recommended'
|
|
17
|
-
],
|
|
18
|
-
rules: {
|
|
19
|
-
// Disable because it conflicts with eslint-plugin-regexp.
|
|
20
|
-
'unicorn/better-regex': 'off'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
12
|
+
export function recommended ({ filesJs = [] } = {}) {
|
|
13
|
+
const jsFiles = ['**/*.{js,mjs,cjs}', '**/*.jsx', ...filesJs]
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
return defineConfig([
|
|
16
|
+
{
|
|
17
|
+
name: '@eslint-recommended/eslint-config/base',
|
|
18
|
+
files: jsFiles,
|
|
19
|
+
extends: [
|
|
20
|
+
js.configs.recommended,
|
|
21
|
+
comments.recommended
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: '@eslint-recommended/eslint-config/jsdoc',
|
|
26
|
+
files: jsFiles,
|
|
27
|
+
extends: [jsdoc.configs['flat/recommended']]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: '@eslint-recommended/eslint-config/jsx',
|
|
31
|
+
files: ['**/*.jsx'],
|
|
32
|
+
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
|
|
33
|
+
}
|
|
34
|
+
])
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-recommended/eslint-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Recommended ESLint
|
|
3
|
+
"version": "29.0.0",
|
|
4
|
+
"description": "Recommended ESLint Flat Config for JavaScript",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"lint": "eslint
|
|
6
|
+
"lint": "eslint .",
|
|
7
7
|
"prepublishOnly": "npm run lint"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"index.js"
|
|
10
|
+
"index.js",
|
|
11
|
+
"index.d.ts"
|
|
11
12
|
],
|
|
13
|
+
"main": "index.js",
|
|
14
|
+
"types": "index.d.ts",
|
|
12
15
|
"engines": {
|
|
13
|
-
"node": ">=
|
|
16
|
+
"node": "^22.22.2 || >=24.15.0"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
|
|
20
|
+
"@eslint/js": "10.0.1",
|
|
21
|
+
"eslint-plugin-jsdoc": "^65.0.0"
|
|
14
22
|
},
|
|
15
23
|
"peerDependencies": {
|
|
16
|
-
"
|
|
17
|
-
"eslint": "^8.23.1",
|
|
18
|
-
"eslint-config-standard": "^17.0.0",
|
|
19
|
-
"eslint-plugin-jsdoc": "^49.0.0",
|
|
20
|
-
"eslint-plugin-regexp": "^2.6.0",
|
|
21
|
-
"eslint-plugin-sonarjs": "^0.25.0",
|
|
22
|
-
"eslint-plugin-unicorn": "^54.0.0"
|
|
24
|
+
"eslint": "^10.4.0"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
25
|
-
"@eslint
|
|
26
|
-
"eslint": "
|
|
27
|
-
"eslint-
|
|
28
|
-
"eslint-plugin-
|
|
29
|
-
"
|
|
30
|
-
"eslint-
|
|
31
|
-
"eslint-plugin-unicorn": "54.0.0"
|
|
27
|
+
"@eslint/markdown": "9.0.0",
|
|
28
|
+
"eslint": "10.15.0",
|
|
29
|
+
"eslint-plugin-html": "8.2.1",
|
|
30
|
+
"eslint-plugin-vue": "10.12.1",
|
|
31
|
+
"neostandard": "0.14.1",
|
|
32
|
+
"vue-eslint-parser": "10.4.2"
|
|
32
33
|
},
|
|
33
34
|
"repository": {
|
|
34
35
|
"type": "git",
|
|
@@ -44,5 +45,6 @@
|
|
|
44
45
|
"eslint-config",
|
|
45
46
|
"eslint",
|
|
46
47
|
"eslintconfig"
|
|
47
|
-
]
|
|
48
|
+
],
|
|
49
|
+
"type": "module"
|
|
48
50
|
}
|