@d-zero/eslint-config 5.0.0-alpha.5 → 5.0.0-alpha.51
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/LICENSE +1 -1
- package/README.md +39 -2
- package/base.js +140 -16
- package/frontend.js +12 -0
- package/package.json +21 -17
- package/typescript.js +51 -0
- package/index.js +0 -79
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
1
|
# `@d-zero/eslint-config`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
## 個別インストール
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -D @d-zero/eslint-config
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## 使い方
|
|
10
|
+
|
|
11
|
+
`.eslintrc`を作成し、[`extends`](https://eslint.org/docs/latest/use/configure/configuration-files#extending-configuration-files)機能を使って読み込みます。
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"extends": ["@d-zero/eslint-config"]
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 拡張
|
|
20
|
+
|
|
21
|
+
プロジェクトに合わせて設定を追加します。
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"extends": ["@d-zero/eslint-config"],
|
|
26
|
+
"rules": {
|
|
27
|
+
// 例: console.logを許可する
|
|
28
|
+
"no-console": 0
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## JavaScriptのみ
|
|
34
|
+
|
|
35
|
+
:warning: TypeScriptを利用**しない**場合は、`@d-zero/eslint-config`の代わりに`@d-zero/eslint-config/base`を利用します。
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"extends": ["@d-zero/eslint-config/base"]
|
|
40
|
+
}
|
|
41
|
+
```
|
package/base.js
CHANGED
|
@@ -22,10 +22,37 @@ module.exports = {
|
|
|
22
22
|
},
|
|
23
23
|
rules: {
|
|
24
24
|
// Standard
|
|
25
|
-
'no-var': 2,
|
|
26
|
-
'no-unused-vars': 0,
|
|
27
25
|
'no-console': 'warn',
|
|
28
26
|
'no-mixed-spaces-and-tabs': 0,
|
|
27
|
+
'no-restricted-syntax': [
|
|
28
|
+
2,
|
|
29
|
+
{
|
|
30
|
+
selector:
|
|
31
|
+
':matches(PropertyDefinition, MethodDefinition)[accessibility="private"]',
|
|
32
|
+
message: 'Use #private instead',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
selector:
|
|
36
|
+
':matches(PropertyDefinition, MethodDefinition)[accessibility="public"]',
|
|
37
|
+
message: 'Remove public keyword',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
selector: 'MethodDefinition[key.name=/^_/]:not([accessibility="protected"])',
|
|
41
|
+
message: 'Add protected keyword',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
selector: 'MethodDefinition:not([key.name=/^_/])[accessibility="protected"]',
|
|
45
|
+
message: 'Start with `_` if you want to use protected',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
selector:
|
|
49
|
+
"CallExpression[callee.property.name='addEventListener'][arguments.0.value='DOMContentLoaded']",
|
|
50
|
+
message:
|
|
51
|
+
"Avoid using 'DOMContentLoaded'. Use 'defer' or 'type=module' attribute instead.",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
'no-unused-vars': 0,
|
|
55
|
+
'no-var': 2,
|
|
29
56
|
'prefer-const': 2,
|
|
30
57
|
'prefer-rest-params': 2,
|
|
31
58
|
'prefer-spread': 2,
|
|
@@ -33,17 +60,21 @@ module.exports = {
|
|
|
33
60
|
// Unicorn
|
|
34
61
|
'unicorn/consistent-destructuring': 0,
|
|
35
62
|
'unicorn/consistent-function-scoping': 0,
|
|
63
|
+
'unicorn/no-anonymous-default-export': 0,
|
|
36
64
|
'unicorn/no-array-callback-reference': 0,
|
|
37
65
|
'unicorn/no-nested-ternary': 0,
|
|
38
66
|
'unicorn/no-null': 0,
|
|
67
|
+
'unicorn/no-process-exit': 0,
|
|
68
|
+
'unicorn/prefer-global-this': 0,
|
|
39
69
|
'unicorn/prefer-query-selector': 0,
|
|
70
|
+
'unicorn/prefer-string-raw': 0,
|
|
40
71
|
'unicorn/prefer-ternary': 0,
|
|
41
72
|
'unicorn/prevent-abbreviations': 0,
|
|
42
73
|
|
|
43
74
|
// import
|
|
75
|
+
'import/no-extraneous-dependencies': 2,
|
|
44
76
|
'import/no-named-as-default': 0,
|
|
45
77
|
'import/no-unresolved': 0,
|
|
46
|
-
'import/no-extraneous-dependencies': 2,
|
|
47
78
|
'import/order': [
|
|
48
79
|
2,
|
|
49
80
|
{
|
|
@@ -62,19 +93,114 @@ module.exports = {
|
|
|
62
93
|
},
|
|
63
94
|
],
|
|
64
95
|
|
|
65
|
-
//
|
|
96
|
+
// Sort Class members
|
|
66
97
|
'sort-class-members/sort-class-members': [
|
|
67
98
|
1,
|
|
68
99
|
{
|
|
69
100
|
order: [
|
|
101
|
+
'[public-properties]',
|
|
102
|
+
'[public-readonly-properties]',
|
|
103
|
+
'[public-properties-function]',
|
|
104
|
+
'[private-properties]',
|
|
105
|
+
'[private-properties-function]',
|
|
106
|
+
'[accessor-pairs]',
|
|
107
|
+
'[getters]',
|
|
108
|
+
'[setters]',
|
|
109
|
+
'constructor',
|
|
110
|
+
'[public-methods]',
|
|
111
|
+
'[private-methods]',
|
|
112
|
+
'[protedted-methods]',
|
|
70
113
|
'[static-properties]',
|
|
71
114
|
'[static-methods]',
|
|
72
|
-
'[
|
|
73
|
-
'[conventional-private-properties]',
|
|
74
|
-
'constructor',
|
|
75
|
-
'[methods]',
|
|
76
|
-
'[conventional-private-methods]',
|
|
115
|
+
'[everything-else]',
|
|
77
116
|
],
|
|
117
|
+
groups: {
|
|
118
|
+
'public-properties': [
|
|
119
|
+
{
|
|
120
|
+
type: 'property',
|
|
121
|
+
kind: 'nonAccessor',
|
|
122
|
+
static: false,
|
|
123
|
+
private: false,
|
|
124
|
+
override: false,
|
|
125
|
+
readonly: false,
|
|
126
|
+
sort: 'alphabetical',
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
'public-readonly-properties': [
|
|
130
|
+
{
|
|
131
|
+
type: 'property',
|
|
132
|
+
kind: 'nonAccessor',
|
|
133
|
+
static: false,
|
|
134
|
+
private: false,
|
|
135
|
+
override: false,
|
|
136
|
+
readonly: true,
|
|
137
|
+
sort: 'alphabetical',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
'public-properties-function': [
|
|
141
|
+
{
|
|
142
|
+
type: 'property',
|
|
143
|
+
propertyType: 'ArrowFunctionExpression',
|
|
144
|
+
kind: 'nonAccessor',
|
|
145
|
+
static: false,
|
|
146
|
+
private: false,
|
|
147
|
+
accessibility: 'public',
|
|
148
|
+
override: false,
|
|
149
|
+
sort: 'alphabetical',
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
'private-properties': [
|
|
153
|
+
{
|
|
154
|
+
type: 'property',
|
|
155
|
+
kind: 'nonAccessor',
|
|
156
|
+
static: false,
|
|
157
|
+
private: true,
|
|
158
|
+
override: false,
|
|
159
|
+
sort: 'alphabetical',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
'private-properties-function': [
|
|
163
|
+
{
|
|
164
|
+
type: 'property',
|
|
165
|
+
propertyType: 'ArrowFunctionExpression',
|
|
166
|
+
kind: 'nonAccessor',
|
|
167
|
+
static: false,
|
|
168
|
+
private: true,
|
|
169
|
+
accessibility: 'public',
|
|
170
|
+
override: false,
|
|
171
|
+
sort: 'alphabetical',
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
'public-methods': [
|
|
175
|
+
{
|
|
176
|
+
type: 'method',
|
|
177
|
+
kind: 'nonAccessor',
|
|
178
|
+
static: false,
|
|
179
|
+
private: false,
|
|
180
|
+
override: false,
|
|
181
|
+
sort: 'alphabetical',
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
'private-methods': [
|
|
185
|
+
{
|
|
186
|
+
name: '/#.+/',
|
|
187
|
+
type: 'method',
|
|
188
|
+
kind: 'nonAccessor',
|
|
189
|
+
static: false,
|
|
190
|
+
private: true,
|
|
191
|
+
override: false,
|
|
192
|
+
sort: 'alphabetical',
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
'protedted-methods': [
|
|
196
|
+
{
|
|
197
|
+
name: '/_.+/',
|
|
198
|
+
type: 'method',
|
|
199
|
+
static: false,
|
|
200
|
+
sort: 'alphabetical',
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
},
|
|
78
204
|
accessorPairPositioning: 'getThenSet',
|
|
79
205
|
},
|
|
80
206
|
],
|
|
@@ -89,13 +215,11 @@ module.exports = {
|
|
|
89
215
|
},
|
|
90
216
|
overrides: [
|
|
91
217
|
{
|
|
92
|
-
files:
|
|
93
|
-
|
|
94
|
-
'
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
files: ['*.config.{js,mjs,json,ts}', '.*rc.{js,mjs,json,ts}'],
|
|
218
|
+
files: [
|
|
219
|
+
'*.{test,spec}.{js,mjs,json}',
|
|
220
|
+
'*.config.{js,mjs,json}',
|
|
221
|
+
'.*rc.{js,mjs,json}',
|
|
222
|
+
],
|
|
99
223
|
rules: {
|
|
100
224
|
'import/no-extraneous-dependencies': 0,
|
|
101
225
|
},
|
package/frontend.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/eslint-config",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.51",
|
|
4
4
|
"description": "Configurations of ESLint",
|
|
5
5
|
"repository": "https://github.com/d-zero-dev/linters.git",
|
|
6
6
|
"author": "D-ZERO Co., Ltd.",
|
|
@@ -9,33 +9,37 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22.0.0"
|
|
14
|
+
},
|
|
12
15
|
"files": [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
16
|
+
"base.js",
|
|
17
|
+
"frontend.js",
|
|
18
|
+
"typescript.js"
|
|
15
19
|
],
|
|
16
20
|
"type": "commonjs",
|
|
17
|
-
"main": "
|
|
21
|
+
"main": "frontend.js",
|
|
18
22
|
"exports": {
|
|
19
23
|
".": {
|
|
20
|
-
"require": "./
|
|
24
|
+
"require": "./frontend.js"
|
|
21
25
|
},
|
|
22
26
|
"./base": {
|
|
23
27
|
"require": "./base.js"
|
|
28
|
+
},
|
|
29
|
+
"./node": {
|
|
30
|
+
"require": "./node.js"
|
|
24
31
|
}
|
|
25
32
|
},
|
|
26
33
|
"dependencies": {
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "
|
|
28
|
-
"@typescript-eslint/parser": "
|
|
29
|
-
"eslint": "8.
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "8.17.0",
|
|
35
|
+
"@typescript-eslint/parser": "8.17.0",
|
|
36
|
+
"eslint": "8.57.1",
|
|
30
37
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
31
|
-
"eslint-plugin-import": "2.
|
|
32
|
-
"eslint-plugin-jsdoc": "
|
|
33
|
-
"eslint-plugin-regexp": "2.
|
|
34
|
-
"eslint-plugin-sort-class-members": "1.
|
|
35
|
-
"eslint-plugin-unicorn": "
|
|
36
|
-
},
|
|
37
|
-
"peerDependencies": {
|
|
38
|
-
"@d-zero/tsconfig": ">= 5"
|
|
38
|
+
"eslint-plugin-import": "2.31.0",
|
|
39
|
+
"eslint-plugin-jsdoc": "50.5.0",
|
|
40
|
+
"eslint-plugin-regexp": "2.7.0",
|
|
41
|
+
"eslint-plugin-sort-class-members": "1.21.0",
|
|
42
|
+
"eslint-plugin-unicorn": "56.0.1"
|
|
39
43
|
},
|
|
40
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "7952b94932b3eb9a22786a399360958323921a20"
|
|
41
45
|
}
|
package/typescript.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const base = require('./base');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @type {import('eslint/lib/shared/types').ConfigData}
|
|
5
|
+
*/
|
|
6
|
+
module.exports = {
|
|
7
|
+
...base,
|
|
8
|
+
overrides: [
|
|
9
|
+
...base.overrides,
|
|
10
|
+
{
|
|
11
|
+
files: ['*.{ts,tsx}', '**/*.{ts,tsx}'],
|
|
12
|
+
extends: ['plugin:import/typescript', 'plugin:@typescript-eslint/recommended'],
|
|
13
|
+
plugins: ['@typescript-eslint', ...base.plugins],
|
|
14
|
+
parser: '@typescript-eslint/parser',
|
|
15
|
+
parserOptions: {
|
|
16
|
+
sourceType: 'module',
|
|
17
|
+
project: ['./tsconfig.json'],
|
|
18
|
+
},
|
|
19
|
+
settings: {
|
|
20
|
+
...base.settings,
|
|
21
|
+
'import/parsers': {
|
|
22
|
+
'@typescript-eslint/parser': ['.ts'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
...base.rules,
|
|
27
|
+
// @typescript-eslint
|
|
28
|
+
'@typescript-eslint/adjacent-overload-signatures': 2,
|
|
29
|
+
'@typescript-eslint/ban-ts-comment': 0,
|
|
30
|
+
'@typescript-eslint/consistent-type-imports': 1,
|
|
31
|
+
'@typescript-eslint/member-ordering': 0,
|
|
32
|
+
'@typescript-eslint/no-array-constructor': 2,
|
|
33
|
+
'@typescript-eslint/no-explicit-any': [1, { fixToUnknown: true }],
|
|
34
|
+
'@typescript-eslint/no-floating-promises': 2,
|
|
35
|
+
'@typescript-eslint/no-namespace': [2, { allowDeclarations: true }],
|
|
36
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 2,
|
|
37
|
+
'@typescript-eslint/no-unused-vars': 2,
|
|
38
|
+
'@typescript-eslint/no-var-requires': 2,
|
|
39
|
+
'@typescript-eslint/prefer-namespace-keyword': 2,
|
|
40
|
+
'@typescript-eslint/require-await': 2,
|
|
41
|
+
'@typescript-eslint/restrict-plus-operands': 0,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
files: ['*.{test,spec}.{ts,mts,tsx}'],
|
|
46
|
+
rules: {
|
|
47
|
+
'import/no-extraneous-dependencies': 0,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
package/index.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const base = require('./base');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @type {import('eslint/lib/shared/types').ConfigData}
|
|
5
|
-
*/
|
|
6
|
-
module.exports = {
|
|
7
|
-
...base,
|
|
8
|
-
overrides: [
|
|
9
|
-
{
|
|
10
|
-
files: '**/*.{ts,tsx}',
|
|
11
|
-
extends: ['plugin:import/typescript', 'plugin:@typescript-eslint/recommended'],
|
|
12
|
-
plugins: ['@typescript-eslint', ...base.plugins],
|
|
13
|
-
parser: '@typescript-eslint/parser',
|
|
14
|
-
parserOptions: {
|
|
15
|
-
sourceType: 'module',
|
|
16
|
-
project: ['./tsconfig.json'],
|
|
17
|
-
},
|
|
18
|
-
settings: {
|
|
19
|
-
...base.settings,
|
|
20
|
-
'import/parsers': {
|
|
21
|
-
'@typescript-eslint/parser': ['.ts'],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
rules: {
|
|
25
|
-
...base.rules,
|
|
26
|
-
// @typescript-eslint
|
|
27
|
-
'@typescript-eslint/no-unused-vars': 2,
|
|
28
|
-
'@typescript-eslint/no-array-constructor': 2,
|
|
29
|
-
'@typescript-eslint/adjacent-overload-signatures': 2,
|
|
30
|
-
'@typescript-eslint/no-namespace': [2, { allowDeclarations: true }],
|
|
31
|
-
'@typescript-eslint/prefer-namespace-keyword': 2,
|
|
32
|
-
'@typescript-eslint/no-var-requires': 2,
|
|
33
|
-
'@typescript-eslint/no-unnecessary-type-assertion': 2,
|
|
34
|
-
'@typescript-eslint/restrict-plus-operands': 0,
|
|
35
|
-
'@typescript-eslint/consistent-type-imports': 1,
|
|
36
|
-
'@typescript-eslint/require-await': 2,
|
|
37
|
-
'@typescript-eslint/no-floating-promises': 2,
|
|
38
|
-
'@typescript-eslint/member-ordering': [
|
|
39
|
-
'warn',
|
|
40
|
-
{
|
|
41
|
-
default: 'never',
|
|
42
|
-
classes: {
|
|
43
|
-
memberTypes: [
|
|
44
|
-
'public-static-field',
|
|
45
|
-
'protected-static-field',
|
|
46
|
-
'private-static-field',
|
|
47
|
-
'public-static-method',
|
|
48
|
-
'protected-static-method',
|
|
49
|
-
'public-static-get',
|
|
50
|
-
'protected-static-get',
|
|
51
|
-
'private-static-get',
|
|
52
|
-
'public-instance-field',
|
|
53
|
-
'protected-instance-field',
|
|
54
|
-
'private-instance-field',
|
|
55
|
-
'public-abstract-field',
|
|
56
|
-
'protected-abstract-field',
|
|
57
|
-
'public-constructor',
|
|
58
|
-
'protected-constructor',
|
|
59
|
-
'private-constructor',
|
|
60
|
-
['public-abstract-get', 'public-abstract-set'],
|
|
61
|
-
['protected-abstract-get', 'protected-abstract-set'],
|
|
62
|
-
['public-instance-get', 'public-instance-set'],
|
|
63
|
-
['protected-instance-get', 'protected-instance-set'],
|
|
64
|
-
['private-instance-get', 'private-instance-set'],
|
|
65
|
-
'public-abstract-method',
|
|
66
|
-
'protected-abstract-method',
|
|
67
|
-
'public-instance-method',
|
|
68
|
-
'protected-instance-method',
|
|
69
|
-
'private-instance-method',
|
|
70
|
-
'private-static-method',
|
|
71
|
-
],
|
|
72
|
-
order: 'alphabetically',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
};
|