@geckou/eslint-config 0.2.0 → 0.3.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.md +3 -0
- package/expo.js +2 -0
- package/index.js +4 -0
- package/next.js +2 -0
- package/package.json +2 -1
- package/react.js +2 -0
- package/vue.js +11 -0
package/README.md
CHANGED
|
@@ -68,6 +68,9 @@ export default [
|
|
|
68
68
|
|
|
69
69
|
## 方針
|
|
70
70
|
|
|
71
|
+
- **ESLint 本体の推奨(`eslint:recommended`)を含む。** typescript-eslint の `recommended` は
|
|
72
|
+
これを含まないため、各プリセットで明示的に足している(`no-useless-escape` / `no-empty` /
|
|
73
|
+
`no-fallthrough` など)。`no-undef` は TypeScript が見るので `.ts` / `.tsx` / `.vue` では無効
|
|
71
74
|
- **フォーマット系のルールは持たない。** Prettier に委譲する(`eslint-config-prettier` で無効化済み)。
|
|
72
75
|
フォーマットは [`@geckou/prettier-config`](https://www.npmjs.com/package/@geckou/prettier-config) を使う
|
|
73
76
|
- 共通の値(無視するパス・共有ルール)は `rules.js` に置き、各プリセットから参照する。
|
package/expo.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import path from 'node:path'
|
|
11
11
|
import { fileURLToPath } from 'node:url'
|
|
12
12
|
|
|
13
|
+
import js from '@eslint/js'
|
|
13
14
|
import { FlatCompat } from '@eslint/eslintrc'
|
|
14
15
|
import typescriptEslint from '@typescript-eslint/eslint-plugin'
|
|
15
16
|
import tsParser from '@typescript-eslint/parser'
|
|
@@ -22,6 +23,7 @@ const compat = new FlatCompat({
|
|
|
22
23
|
|
|
23
24
|
export default [
|
|
24
25
|
{ ignores: [...commonIgnores, '.expo/**'] },
|
|
26
|
+
js.configs.recommended,
|
|
25
27
|
...compat.extends('expo', 'prettier'),
|
|
26
28
|
{
|
|
27
29
|
plugins: {
|
package/index.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// Next.js / Expo のアプリは ./next / ./expo を使う。プリセットは互いに
|
|
9
9
|
// 独立していて、重ねて使わない(同じプラグインを別々の実体で登録すると
|
|
10
10
|
// ESLint が Cannot redefine plugin で落ちるため)。
|
|
11
|
+
import js from '@eslint/js'
|
|
11
12
|
import prettier from 'eslint-config-prettier'
|
|
12
13
|
import tseslint from 'typescript-eslint'
|
|
13
14
|
|
|
@@ -15,6 +16,9 @@ import { commonIgnores, sharedRules, typescriptRules } from './rules.js'
|
|
|
15
16
|
|
|
16
17
|
export default tseslint.config(
|
|
17
18
|
{ ignores: commonIgnores },
|
|
19
|
+
// ESLint 本体の推奨(no-useless-escape / no-empty など)。typescript-eslint の
|
|
20
|
+
// recommended はこれを含まないので、明示的に足す
|
|
21
|
+
js.configs.recommended,
|
|
18
22
|
...tseslint.configs.recommended,
|
|
19
23
|
prettier,
|
|
20
24
|
{
|
package/next.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import path from 'node:path'
|
|
12
12
|
import { fileURLToPath } from 'node:url'
|
|
13
13
|
|
|
14
|
+
import js from '@eslint/js'
|
|
14
15
|
import { FlatCompat } from '@eslint/eslintrc'
|
|
15
16
|
|
|
16
17
|
import { commonIgnores, sharedRules } from './rules.js'
|
|
@@ -21,6 +22,7 @@ const compat = new FlatCompat({
|
|
|
21
22
|
|
|
22
23
|
export default [
|
|
23
24
|
{ ignores: [...commonIgnores, '.next/**', 'next-env.d.ts'] },
|
|
25
|
+
js.configs.recommended,
|
|
24
26
|
...compat.extends('next/core-web-vitals', 'next/typescript', 'prettier'),
|
|
25
27
|
{
|
|
26
28
|
rules: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geckou/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shared ESLint flat config for geckou projects (base / next / expo / vue / react)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@eslint/eslintrc": "^3.0.0",
|
|
41
|
+
"@eslint/js": "^9.0.0",
|
|
41
42
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
42
43
|
"@typescript-eslint/parser": "^8.0.0",
|
|
43
44
|
"eslint-config-expo": "~8.0.0",
|
package/react.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// Hooks のルール(依存配列の漏れ・条件付き呼び出し)はテストで拾えない
|
|
10
10
|
// ため、このプリセットの主目的はそこにある。
|
|
11
11
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
12
|
+
import js from '@eslint/js'
|
|
12
13
|
import prettier from 'eslint-config-prettier'
|
|
13
14
|
import tseslint from 'typescript-eslint'
|
|
14
15
|
|
|
@@ -16,6 +17,7 @@ import { commonIgnores, sharedRules } from './rules.js'
|
|
|
16
17
|
|
|
17
18
|
export default [
|
|
18
19
|
{ ignores: commonIgnores },
|
|
20
|
+
js.configs.recommended,
|
|
19
21
|
...tseslint.configs.recommended,
|
|
20
22
|
prettier,
|
|
21
23
|
{
|
package/vue.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// .vue / .ts の両方を検査する。React と Vue が同居するリポジトリでは
|
|
9
9
|
// ./react を配列で後ろに並べる(プラグインの実体は各プリセットで
|
|
10
10
|
// 別々に登録されるため、files で対象を分けている限り衝突しない)。
|
|
11
|
+
import js from '@eslint/js'
|
|
11
12
|
import pluginVue from 'eslint-plugin-vue'
|
|
12
13
|
import prettier from 'eslint-config-prettier'
|
|
13
14
|
import tseslint from 'typescript-eslint'
|
|
@@ -17,6 +18,7 @@ import { commonIgnores, sharedRules, vueRules } from './rules.js'
|
|
|
17
18
|
|
|
18
19
|
export default [
|
|
19
20
|
{ ignores: commonIgnores },
|
|
21
|
+
js.configs.recommended,
|
|
20
22
|
...tseslint.configs.recommended,
|
|
21
23
|
...pluginVue.configs['flat/recommended'],
|
|
22
24
|
prettier,
|
|
@@ -32,6 +34,15 @@ export default [
|
|
|
32
34
|
},
|
|
33
35
|
},
|
|
34
36
|
},
|
|
37
|
+
{
|
|
38
|
+
// .vue の script は TypeScript なので、未定義の識別子は vue-tsc が見る。
|
|
39
|
+
// typescript-eslint は .ts にしか no-undef の無効化を当てないため、
|
|
40
|
+
// ここで .vue にも当てる(当てないとブラウザのグローバルが全部 error になる)
|
|
41
|
+
files: ['**/*.vue'],
|
|
42
|
+
rules: {
|
|
43
|
+
'no-undef': 'off',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
35
46
|
{
|
|
36
47
|
rules: {
|
|
37
48
|
...sharedRules,
|