@joshuaavalon/eslint-config-typescript 8.1.5 → 8.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,208 @@
1
+ 'use strict';
2
+
3
+ var typescript = require('typescript-eslint');
4
+ var jsConfig = require('@joshuaavalon/eslint-config-javascript');
5
+
6
+ /** @type {import("eslint").Linter.RulesRecord} */
7
+ const extensionRules = {
8
+ "default-param-last": "off",
9
+ "@typescript-eslint/default-param-last": "error",
10
+ "dot-notation": "off",
11
+ "@typescript-eslint/dot-notation": "error",
12
+ "no-array-constructor": "off",
13
+ "@typescript-eslint/no-array-constructor": "error",
14
+ "no-dupe-class-members": "off",
15
+ "@typescript-eslint/no-dupe-class-members": "error",
16
+ "no-implied-eval": "off",
17
+ "@typescript-eslint/no-implied-eval": "error",
18
+ "no-loop-func": "off",
19
+ "@typescript-eslint/no-loop-func": "error",
20
+ "no-redeclare": "off",
21
+ "@typescript-eslint/no-redeclare": "error",
22
+ "no-throw-literal": "off",
23
+ "@typescript-eslint/only-throw-error": "error",
24
+ "no-unused-expressions": "off",
25
+ "@typescript-eslint/no-unused-expressions": "error",
26
+ "no-unused-vars": "off",
27
+ "@typescript-eslint/no-unused-vars": ["error",
28
+ {
29
+ args: "all",
30
+ argsIgnorePattern: "^_",
31
+ caughtErrors: "all",
32
+ caughtErrorsIgnorePattern: "^_",
33
+ destructuredArrayIgnorePattern: "^_",
34
+ varsIgnorePattern: "^_",
35
+ ignoreRestSiblings: true
36
+ }],
37
+ "no-use-before-define": "off",
38
+ "@typescript-eslint/no-use-before-define": "error",
39
+ "no-useless-constructor": "off",
40
+ "@typescript-eslint/no-useless-constructor": "error",
41
+ "require-await": "off",
42
+ "@typescript-eslint/require-await": "off",
43
+ "no-return-await": "off",
44
+ "@typescript-eslint/return-await": ["error", "always"]
45
+ };
46
+
47
+ /** @type {import("eslint").Linter.RulesRecord} */
48
+ const rules$1 = {
49
+ "constructor-super": "off",
50
+ "no-invalid-this": "off",
51
+ "no-undef": "off",
52
+ "no-const-assign": "off",
53
+ "no-this-before-super": "off",
54
+ "no-dupe-args": "off",
55
+ "no-unreachable": "off",
56
+ "getter-return": "off",
57
+ "no-dupe-keys": "off",
58
+ "no-func-assign": "off",
59
+ "no-dupe-class-members": "off",
60
+ "no-obj-calls": "off",
61
+ "no-setter-return": "off",
62
+ "no-unsafe-negation": "off",
63
+ "no-import-assign": "off",
64
+ "@typescript-eslint/adjacent-overload-signatures": "error",
65
+ "@typescript-eslint/array-type": "error",
66
+ "@typescript-eslint/await-thenable": "error",
67
+ "@typescript-eslint/no-empty-object-type": ["error",
68
+ {
69
+ allowInterfaces: "always",
70
+ allowObjectTypes: "always"
71
+ }],
72
+ "@typescript-eslint/no-unsafe-function-type": "error",
73
+ "@typescript-eslint/no-wrapper-object-types": "error",
74
+ "@typescript-eslint/consistent-generic-constructors": "error",
75
+ "@typescript-eslint/consistent-type-exports": "error",
76
+ "@typescript-eslint/consistent-type-imports": "error",
77
+ "@typescript-eslint/explicit-function-return-type": [
78
+ "error",
79
+ {
80
+ allowExpressions: true,
81
+ allowTypedFunctionExpressions: true,
82
+ allowHigherOrderFunctions: true,
83
+ allowDirectConstAssertionInArrowFunctions: true
84
+ }
85
+ ],
86
+ "@typescript-eslint/explicit-member-accessibility": "error",
87
+ "@typescript-eslint/explicit-module-boundary-types": "error",
88
+ "@typescript-eslint/naming-convention": [
89
+ "error",
90
+ {
91
+ format: ["camelCase"],
92
+ leadingUnderscore: "allow",
93
+ selector: "default"
94
+ },
95
+ {
96
+ format: [
97
+ "camelCase",
98
+ "UPPER_CASE",
99
+ "PascalCase"
100
+ ],
101
+ leadingUnderscore: "allow",
102
+ selector: "variable"
103
+ },
104
+ {
105
+ selector: "typeLike",
106
+ format: ["PascalCase"]
107
+ },
108
+ {
109
+ selector: "import",
110
+ format: ["camelCase", "PascalCase"]
111
+ },
112
+ {
113
+ selector: "function",
114
+ format: ["camelCase", "PascalCase"]
115
+ },
116
+ {
117
+ format: null,
118
+ modifiers: ["destructured"],
119
+ selector: "variable"
120
+ },
121
+ {
122
+ format: null,
123
+ selector: "objectLiteralProperty"
124
+ }
125
+ ],
126
+ camelcase: "off",
127
+ "@typescript-eslint/no-base-to-string": "error",
128
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
129
+ "@typescript-eslint/no-confusing-void-expression": "error",
130
+ "@typescript-eslint/no-duplicate-enum-values": "error",
131
+ "@typescript-eslint/no-duplicate-type-constituents": "error",
132
+ "@typescript-eslint/no-dynamic-delete": "error",
133
+ "@typescript-eslint/no-extra-non-null-assertion": "error",
134
+ "@typescript-eslint/no-extraneous-class": "error",
135
+ // "@typescript-eslint/no-floating-promises": "error",
136
+ "@typescript-eslint/no-for-in-array": "error",
137
+ "@typescript-eslint/no-import-type-side-effects": "error",
138
+ "@typescript-eslint/no-inferrable-types": "error",
139
+ "@typescript-eslint/no-invalid-void-type": "error",
140
+ "@typescript-eslint/no-meaningless-void-operator": "error",
141
+ "@typescript-eslint/no-misused-new": "error",
142
+ "@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
143
+ "@typescript-eslint/no-mixed-enums": "error",
144
+ "@typescript-eslint/no-namespace": "error",
145
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
146
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
147
+ "@typescript-eslint/no-non-null-assertion": "error",
148
+ "@typescript-eslint/no-redundant-type-constituents": "error",
149
+ "@typescript-eslint/no-require-imports": "error",
150
+ "@typescript-eslint/no-this-alias": "error",
151
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
152
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
153
+ "@typescript-eslint/no-unnecessary-type-arguments": "error",
154
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
155
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
156
+ "@typescript-eslint/no-unsafe-argument": "off",
157
+ "@typescript-eslint/no-unsafe-assignment": "off",
158
+ "@typescript-eslint/no-unsafe-call": "off",
159
+ "@typescript-eslint/no-unsafe-declaration-merging": "off",
160
+ "@typescript-eslint/no-unsafe-enum-comparison": "off",
161
+ "@typescript-eslint/no-unsafe-member-access": "off",
162
+ "@typescript-eslint/no-unsafe-return": "off",
163
+ "@typescript-eslint/no-useless-empty-export": "error",
164
+ "@typescript-eslint/non-nullable-type-assertion-style": "error",
165
+ "@typescript-eslint/parameter-properties": "error",
166
+ "@typescript-eslint/prefer-as-const": "error",
167
+ "@typescript-eslint/prefer-enum-initializers": "error",
168
+ "@typescript-eslint/prefer-for-of": "error",
169
+ "@typescript-eslint/prefer-includes": "error",
170
+ "@typescript-eslint/prefer-literal-enum-member": "error",
171
+ "@typescript-eslint/prefer-namespace-keyword": "error",
172
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
173
+ "@typescript-eslint/prefer-optional-chain": "error",
174
+ "@typescript-eslint/prefer-readonly": "error",
175
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
176
+ "@typescript-eslint/prefer-regexp-exec": "error",
177
+ "@typescript-eslint/prefer-return-this-type": "error",
178
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
179
+ "@typescript-eslint/promise-function-async": "off",
180
+ "@typescript-eslint/restrict-plus-operands": "error",
181
+ "@typescript-eslint/sort-type-constituents": "error",
182
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
183
+ "@typescript-eslint/unbound-method": "error",
184
+ ...extensionRules,
185
+ "no-duplicate-imports": ["off"]
186
+ };
187
+
188
+ /** @type {import("@stylistic/eslint-plugin").RuleOptions} */
189
+ const rules = {
190
+ "@stylistic/type-annotation-spacing": "error",
191
+ "@stylistic/type-generic-spacing": ["error"],
192
+ "@stylistic/type-named-tuple-spacing": ["error"]
193
+ };
194
+
195
+ /** @type {import("eslint").Linter.Config} */
196
+ const config = {
197
+ plugins: {
198
+ ...jsConfig.plugins,
199
+ "@typescript-eslint": typescript.plugin
200
+ },
201
+ rules: {
202
+ ...jsConfig.rules,
203
+ ...rules$1,
204
+ ...rules
205
+ }
206
+ };
207
+
208
+ module.exports = config;
@@ -0,0 +1,206 @@
1
+ import typescript from 'typescript-eslint';
2
+ import jsConfig from '@joshuaavalon/eslint-config-javascript';
3
+
4
+ /** @type {import("eslint").Linter.RulesRecord} */
5
+ const extensionRules = {
6
+ "default-param-last": "off",
7
+ "@typescript-eslint/default-param-last": "error",
8
+ "dot-notation": "off",
9
+ "@typescript-eslint/dot-notation": "error",
10
+ "no-array-constructor": "off",
11
+ "@typescript-eslint/no-array-constructor": "error",
12
+ "no-dupe-class-members": "off",
13
+ "@typescript-eslint/no-dupe-class-members": "error",
14
+ "no-implied-eval": "off",
15
+ "@typescript-eslint/no-implied-eval": "error",
16
+ "no-loop-func": "off",
17
+ "@typescript-eslint/no-loop-func": "error",
18
+ "no-redeclare": "off",
19
+ "@typescript-eslint/no-redeclare": "error",
20
+ "no-throw-literal": "off",
21
+ "@typescript-eslint/only-throw-error": "error",
22
+ "no-unused-expressions": "off",
23
+ "@typescript-eslint/no-unused-expressions": "error",
24
+ "no-unused-vars": "off",
25
+ "@typescript-eslint/no-unused-vars": ["error",
26
+ {
27
+ args: "all",
28
+ argsIgnorePattern: "^_",
29
+ caughtErrors: "all",
30
+ caughtErrorsIgnorePattern: "^_",
31
+ destructuredArrayIgnorePattern: "^_",
32
+ varsIgnorePattern: "^_",
33
+ ignoreRestSiblings: true
34
+ }],
35
+ "no-use-before-define": "off",
36
+ "@typescript-eslint/no-use-before-define": "error",
37
+ "no-useless-constructor": "off",
38
+ "@typescript-eslint/no-useless-constructor": "error",
39
+ "require-await": "off",
40
+ "@typescript-eslint/require-await": "off",
41
+ "no-return-await": "off",
42
+ "@typescript-eslint/return-await": ["error", "always"]
43
+ };
44
+
45
+ /** @type {import("eslint").Linter.RulesRecord} */
46
+ const rules$1 = {
47
+ "constructor-super": "off",
48
+ "no-invalid-this": "off",
49
+ "no-undef": "off",
50
+ "no-const-assign": "off",
51
+ "no-this-before-super": "off",
52
+ "no-dupe-args": "off",
53
+ "no-unreachable": "off",
54
+ "getter-return": "off",
55
+ "no-dupe-keys": "off",
56
+ "no-func-assign": "off",
57
+ "no-dupe-class-members": "off",
58
+ "no-obj-calls": "off",
59
+ "no-setter-return": "off",
60
+ "no-unsafe-negation": "off",
61
+ "no-import-assign": "off",
62
+ "@typescript-eslint/adjacent-overload-signatures": "error",
63
+ "@typescript-eslint/array-type": "error",
64
+ "@typescript-eslint/await-thenable": "error",
65
+ "@typescript-eslint/no-empty-object-type": ["error",
66
+ {
67
+ allowInterfaces: "always",
68
+ allowObjectTypes: "always"
69
+ }],
70
+ "@typescript-eslint/no-unsafe-function-type": "error",
71
+ "@typescript-eslint/no-wrapper-object-types": "error",
72
+ "@typescript-eslint/consistent-generic-constructors": "error",
73
+ "@typescript-eslint/consistent-type-exports": "error",
74
+ "@typescript-eslint/consistent-type-imports": "error",
75
+ "@typescript-eslint/explicit-function-return-type": [
76
+ "error",
77
+ {
78
+ allowExpressions: true,
79
+ allowTypedFunctionExpressions: true,
80
+ allowHigherOrderFunctions: true,
81
+ allowDirectConstAssertionInArrowFunctions: true
82
+ }
83
+ ],
84
+ "@typescript-eslint/explicit-member-accessibility": "error",
85
+ "@typescript-eslint/explicit-module-boundary-types": "error",
86
+ "@typescript-eslint/naming-convention": [
87
+ "error",
88
+ {
89
+ format: ["camelCase"],
90
+ leadingUnderscore: "allow",
91
+ selector: "default"
92
+ },
93
+ {
94
+ format: [
95
+ "camelCase",
96
+ "UPPER_CASE",
97
+ "PascalCase"
98
+ ],
99
+ leadingUnderscore: "allow",
100
+ selector: "variable"
101
+ },
102
+ {
103
+ selector: "typeLike",
104
+ format: ["PascalCase"]
105
+ },
106
+ {
107
+ selector: "import",
108
+ format: ["camelCase", "PascalCase"]
109
+ },
110
+ {
111
+ selector: "function",
112
+ format: ["camelCase", "PascalCase"]
113
+ },
114
+ {
115
+ format: null,
116
+ modifiers: ["destructured"],
117
+ selector: "variable"
118
+ },
119
+ {
120
+ format: null,
121
+ selector: "objectLiteralProperty"
122
+ }
123
+ ],
124
+ camelcase: "off",
125
+ "@typescript-eslint/no-base-to-string": "error",
126
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
127
+ "@typescript-eslint/no-confusing-void-expression": "error",
128
+ "@typescript-eslint/no-duplicate-enum-values": "error",
129
+ "@typescript-eslint/no-duplicate-type-constituents": "error",
130
+ "@typescript-eslint/no-dynamic-delete": "error",
131
+ "@typescript-eslint/no-extra-non-null-assertion": "error",
132
+ "@typescript-eslint/no-extraneous-class": "error",
133
+ // "@typescript-eslint/no-floating-promises": "error",
134
+ "@typescript-eslint/no-for-in-array": "error",
135
+ "@typescript-eslint/no-import-type-side-effects": "error",
136
+ "@typescript-eslint/no-inferrable-types": "error",
137
+ "@typescript-eslint/no-invalid-void-type": "error",
138
+ "@typescript-eslint/no-meaningless-void-operator": "error",
139
+ "@typescript-eslint/no-misused-new": "error",
140
+ "@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
141
+ "@typescript-eslint/no-mixed-enums": "error",
142
+ "@typescript-eslint/no-namespace": "error",
143
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
144
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
145
+ "@typescript-eslint/no-non-null-assertion": "error",
146
+ "@typescript-eslint/no-redundant-type-constituents": "error",
147
+ "@typescript-eslint/no-require-imports": "error",
148
+ "@typescript-eslint/no-this-alias": "error",
149
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
150
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
151
+ "@typescript-eslint/no-unnecessary-type-arguments": "error",
152
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
153
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
154
+ "@typescript-eslint/no-unsafe-argument": "off",
155
+ "@typescript-eslint/no-unsafe-assignment": "off",
156
+ "@typescript-eslint/no-unsafe-call": "off",
157
+ "@typescript-eslint/no-unsafe-declaration-merging": "off",
158
+ "@typescript-eslint/no-unsafe-enum-comparison": "off",
159
+ "@typescript-eslint/no-unsafe-member-access": "off",
160
+ "@typescript-eslint/no-unsafe-return": "off",
161
+ "@typescript-eslint/no-useless-empty-export": "error",
162
+ "@typescript-eslint/non-nullable-type-assertion-style": "error",
163
+ "@typescript-eslint/parameter-properties": "error",
164
+ "@typescript-eslint/prefer-as-const": "error",
165
+ "@typescript-eslint/prefer-enum-initializers": "error",
166
+ "@typescript-eslint/prefer-for-of": "error",
167
+ "@typescript-eslint/prefer-includes": "error",
168
+ "@typescript-eslint/prefer-literal-enum-member": "error",
169
+ "@typescript-eslint/prefer-namespace-keyword": "error",
170
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
171
+ "@typescript-eslint/prefer-optional-chain": "error",
172
+ "@typescript-eslint/prefer-readonly": "error",
173
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
174
+ "@typescript-eslint/prefer-regexp-exec": "error",
175
+ "@typescript-eslint/prefer-return-this-type": "error",
176
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
177
+ "@typescript-eslint/promise-function-async": "off",
178
+ "@typescript-eslint/restrict-plus-operands": "error",
179
+ "@typescript-eslint/sort-type-constituents": "error",
180
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
181
+ "@typescript-eslint/unbound-method": "error",
182
+ ...extensionRules,
183
+ "no-duplicate-imports": ["off"]
184
+ };
185
+
186
+ /** @type {import("@stylistic/eslint-plugin").RuleOptions} */
187
+ const rules = {
188
+ "@stylistic/type-annotation-spacing": "error",
189
+ "@stylistic/type-generic-spacing": ["error"],
190
+ "@stylistic/type-named-tuple-spacing": ["error"]
191
+ };
192
+
193
+ /** @type {import("eslint").Linter.Config} */
194
+ const config = {
195
+ plugins: {
196
+ ...jsConfig.plugins,
197
+ "@typescript-eslint": typescript.plugin
198
+ },
199
+ rules: {
200
+ ...jsConfig.rules,
201
+ ...rules$1,
202
+ ...rules
203
+ }
204
+ };
205
+
206
+ export { config as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshuaavalon/eslint-config-typescript",
3
- "version": "8.1.5",
3
+ "version": "8.1.7",
4
4
  "description": "Shareable ESLint Typescript config.",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",
@@ -9,6 +9,7 @@
9
9
  "access": "public"
10
10
  },
11
11
  "scripts": {
12
+ "prepublishOnly": "npm run build",
12
13
  "build": "rollup -c"
13
14
  },
14
15
  "exports": {
@@ -34,7 +35,7 @@
34
35
  "url": "https://github.com/joshuaavalon/eslint-config/issues"
35
36
  },
36
37
  "dependencies": {
37
- "@joshuaavalon/eslint-config-javascript": "^8.1.4",
38
+ "@joshuaavalon/eslint-config-javascript": "^8.1.6",
38
39
  "typescript-eslint": "^8.3.0"
39
40
  },
40
41
  "peerDependencies": {