@joshuaavalon/eslint-config-typescript 6.2.3 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2019 Joshua Avalon
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # @joshuaavalon/eslint-config-typescript
2
+
3
+ This is the opinionated ESLint configuration repository that used by myself.
4
+ Not support is guaranteed. Use as your own risk.
5
+
6
+ This configuration include both lint and format rules which may cause conflicts with other formatter like Prettier.
7
+
8
+ ## Getting Started
9
+
10
+ ```
11
+ npm i -D eslint @joshuaavalon/eslint-config-typescript
12
+ ```
13
+
14
+ ```js
15
+ import globals from "globals";
16
+ import typescript from "typescript-eslint";
17
+ import tsRules from "@joshuaavalon/eslint-config-typescript";
18
+
19
+ {
20
+ ...tsRules,
21
+ ignores: ["node_modules", "dist"],
22
+ files: ["**/*.ts"],
23
+ languageOptions: {
24
+ parser: typescript.parser,
25
+ parserOptions: {
26
+ project: true,
27
+ tsconfigDirName: import.meta.dirname
28
+ },
29
+ globals: {
30
+ ...globals.node,
31
+ ...globals.browser,
32
+ ...globals.nodeBuiltin
33
+ }
34
+ }
35
+ }
36
+ ```
@@ -0,0 +1,173 @@
1
+ 'use strict';
2
+
3
+ var typescript = require('typescript-eslint');
4
+ var jsRules = require('@joshuaavalon/eslint-config-javascript');
5
+ var formatRules = require('@joshuaavalon/eslint-config-javascript/stylistic');
6
+
7
+ /** @type {import("eslint").Linter.RulesRecord} */
8
+ const extensionRules = {
9
+ "default-param-last": "off",
10
+ "@typescript-eslint/default-param-last": "error",
11
+ "dot-notation": "off",
12
+ "@typescript-eslint/dot-notation": "error",
13
+ "no-array-constructor": "off",
14
+ "@typescript-eslint/no-array-constructor": "error",
15
+ "no-dupe-class-members": "off",
16
+ "@typescript-eslint/no-dupe-class-members": "error",
17
+ "no-implied-eval": "off",
18
+ "@typescript-eslint/no-implied-eval": "error",
19
+ "no-loop-func": "off",
20
+ "@typescript-eslint/no-loop-func": "error",
21
+ "no-loss-of-precision": "off",
22
+ "@typescript-eslint/no-loss-of-precision": "error",
23
+ "no-redeclare": "off",
24
+ "@typescript-eslint/no-redeclare": "error",
25
+ "no-throw-literal": "off",
26
+ "@typescript-eslint/no-throw-literal": "off",
27
+ "no-unused-expressions": "off",
28
+ "@typescript-eslint/no-unused-expressions": "error",
29
+ "no-unused-vars": "off",
30
+ "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
31
+ "no-use-before-define": "off",
32
+ "@typescript-eslint/no-use-before-define": "error",
33
+ "no-useless-constructor": "off",
34
+ "@typescript-eslint/no-useless-constructor": "error",
35
+ "require-await": "off",
36
+ "@typescript-eslint/require-await": "off",
37
+ "no-return-await": "off",
38
+ "@typescript-eslint/return-await": "error"
39
+ };
40
+
41
+ /** @type {import("eslint").Linter.RulesRecord} */
42
+ const rules = {
43
+ "no-undef": "off",
44
+ "@typescript-eslint/adjacent-overload-signatures": "error",
45
+ "@typescript-eslint/array-type": "error",
46
+ "@typescript-eslint/await-thenable": "error",
47
+ "@typescript-eslint/ban-types": "error",
48
+ "@typescript-eslint/consistent-generic-constructors": "error",
49
+ "@typescript-eslint/consistent-type-exports": "error",
50
+ "@typescript-eslint/consistent-type-imports": "error",
51
+ "@typescript-eslint/explicit-function-return-type": [
52
+ "error",
53
+ {
54
+ allowExpressions: true,
55
+ allowTypedFunctionExpressions: true,
56
+ allowHigherOrderFunctions: true,
57
+ allowDirectConstAssertionInArrowFunctions: true
58
+ }
59
+ ],
60
+ "@typescript-eslint/explicit-member-accessibility": "error",
61
+ "@typescript-eslint/explicit-module-boundary-types": "error",
62
+ "@typescript-eslint/naming-convention": [
63
+ "error",
64
+ {
65
+ format: ["camelCase"],
66
+ leadingUnderscore: "allow",
67
+ selector: "default"
68
+ },
69
+ {
70
+ format: [
71
+ "camelCase",
72
+ "UPPER_CASE",
73
+ "PascalCase"
74
+ ],
75
+ leadingUnderscore: "allow",
76
+ selector: "variable"
77
+ },
78
+ {
79
+ selector: "typeLike",
80
+ format: ["PascalCase"]
81
+ },
82
+ {
83
+ selector: "import",
84
+ format: ["camelCase", "PascalCase"]
85
+ },
86
+ {
87
+ selector: "function",
88
+ format: ["camelCase", "PascalCase"]
89
+ },
90
+ {
91
+ format: null,
92
+ modifiers: ["destructured"],
93
+ selector: "variable"
94
+ },
95
+ {
96
+ format: null,
97
+ selector: "objectLiteralProperty"
98
+ }
99
+ ],
100
+ camelcase: "off",
101
+ "@typescript-eslint/no-base-to-string": "error",
102
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
103
+ "@typescript-eslint/no-confusing-void-expression": "error",
104
+ "@typescript-eslint/no-duplicate-enum-values": "error",
105
+ "@typescript-eslint/no-duplicate-type-constituents": "error",
106
+ "@typescript-eslint/no-dynamic-delete": "error",
107
+ "@typescript-eslint/no-extra-non-null-assertion": "error",
108
+ "@typescript-eslint/no-extraneous-class": "error",
109
+ // "@typescript-eslint/no-floating-promises": "error",
110
+ "@typescript-eslint/no-for-in-array": "error",
111
+ "@typescript-eslint/no-import-type-side-effects": "error",
112
+ "@typescript-eslint/no-inferrable-types": "error",
113
+ "@typescript-eslint/no-invalid-void-type": "error",
114
+ "@typescript-eslint/no-meaningless-void-operator": "error",
115
+ "@typescript-eslint/no-misused-new": "error",
116
+ "@typescript-eslint/no-misused-promises": "error",
117
+ "@typescript-eslint/no-mixed-enums": "error",
118
+ "@typescript-eslint/no-namespace": "error",
119
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
120
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
121
+ "@typescript-eslint/no-non-null-assertion": "error",
122
+ "@typescript-eslint/no-redundant-type-constituents": "error",
123
+ "@typescript-eslint/no-require-imports": "error",
124
+ "@typescript-eslint/no-this-alias": "error",
125
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
126
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
127
+ "@typescript-eslint/no-unnecessary-type-arguments": "error",
128
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
129
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
130
+ "@typescript-eslint/no-unsafe-argument": "off",
131
+ "@typescript-eslint/no-unsafe-assignment": "off",
132
+ "@typescript-eslint/no-unsafe-call": "off",
133
+ "@typescript-eslint/no-unsafe-declaration-merging": "off",
134
+ "@typescript-eslint/no-unsafe-enum-comparison": "off",
135
+ "@typescript-eslint/no-unsafe-member-access": "off",
136
+ "@typescript-eslint/no-unsafe-return": "off",
137
+ "@typescript-eslint/no-useless-empty-export": "error",
138
+ "@typescript-eslint/no-var-requires": "error",
139
+ "@typescript-eslint/non-nullable-type-assertion-style": "error",
140
+ "@typescript-eslint/parameter-properties": "error",
141
+ "@typescript-eslint/prefer-as-const": "error",
142
+ "@typescript-eslint/prefer-enum-initializers": "error",
143
+ "@typescript-eslint/prefer-for-of": "error",
144
+ "@typescript-eslint/prefer-includes": "error",
145
+ "@typescript-eslint/prefer-literal-enum-member": "error",
146
+ "@typescript-eslint/prefer-namespace-keyword": "error",
147
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
148
+ "@typescript-eslint/prefer-optional-chain": "error",
149
+ "@typescript-eslint/prefer-readonly": "error",
150
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
151
+ "@typescript-eslint/prefer-regexp-exec": "error",
152
+ "@typescript-eslint/prefer-return-this-type": "error",
153
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
154
+ "@typescript-eslint/promise-function-async": "off",
155
+ "@typescript-eslint/restrict-plus-operands": "error",
156
+ "@typescript-eslint/sort-type-constituents": "error",
157
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
158
+ "@typescript-eslint/unbound-method": "error",
159
+ ...extensionRules,
160
+ "no-duplicate-imports": ["off"]
161
+ };
162
+
163
+ /** @type {import("eslint").Linter.FlatConfig} */
164
+ const config = {
165
+ plugins: { "@typescript-eslint": typescript.plugin },
166
+ rules: {
167
+ ...jsRules,
168
+ ...rules,
169
+ ...formatRules
170
+ }
171
+ };
172
+
173
+ module.exports = config;
@@ -0,0 +1,171 @@
1
+ import typescript from 'typescript-eslint';
2
+ import jsRules from '@joshuaavalon/eslint-config-javascript';
3
+ import formatRules from '@joshuaavalon/eslint-config-javascript/stylistic';
4
+
5
+ /** @type {import("eslint").Linter.RulesRecord} */
6
+ const extensionRules = {
7
+ "default-param-last": "off",
8
+ "@typescript-eslint/default-param-last": "error",
9
+ "dot-notation": "off",
10
+ "@typescript-eslint/dot-notation": "error",
11
+ "no-array-constructor": "off",
12
+ "@typescript-eslint/no-array-constructor": "error",
13
+ "no-dupe-class-members": "off",
14
+ "@typescript-eslint/no-dupe-class-members": "error",
15
+ "no-implied-eval": "off",
16
+ "@typescript-eslint/no-implied-eval": "error",
17
+ "no-loop-func": "off",
18
+ "@typescript-eslint/no-loop-func": "error",
19
+ "no-loss-of-precision": "off",
20
+ "@typescript-eslint/no-loss-of-precision": "error",
21
+ "no-redeclare": "off",
22
+ "@typescript-eslint/no-redeclare": "error",
23
+ "no-throw-literal": "off",
24
+ "@typescript-eslint/no-throw-literal": "off",
25
+ "no-unused-expressions": "off",
26
+ "@typescript-eslint/no-unused-expressions": "error",
27
+ "no-unused-vars": "off",
28
+ "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
29
+ "no-use-before-define": "off",
30
+ "@typescript-eslint/no-use-before-define": "error",
31
+ "no-useless-constructor": "off",
32
+ "@typescript-eslint/no-useless-constructor": "error",
33
+ "require-await": "off",
34
+ "@typescript-eslint/require-await": "off",
35
+ "no-return-await": "off",
36
+ "@typescript-eslint/return-await": "error"
37
+ };
38
+
39
+ /** @type {import("eslint").Linter.RulesRecord} */
40
+ const rules = {
41
+ "no-undef": "off",
42
+ "@typescript-eslint/adjacent-overload-signatures": "error",
43
+ "@typescript-eslint/array-type": "error",
44
+ "@typescript-eslint/await-thenable": "error",
45
+ "@typescript-eslint/ban-types": "error",
46
+ "@typescript-eslint/consistent-generic-constructors": "error",
47
+ "@typescript-eslint/consistent-type-exports": "error",
48
+ "@typescript-eslint/consistent-type-imports": "error",
49
+ "@typescript-eslint/explicit-function-return-type": [
50
+ "error",
51
+ {
52
+ allowExpressions: true,
53
+ allowTypedFunctionExpressions: true,
54
+ allowHigherOrderFunctions: true,
55
+ allowDirectConstAssertionInArrowFunctions: true
56
+ }
57
+ ],
58
+ "@typescript-eslint/explicit-member-accessibility": "error",
59
+ "@typescript-eslint/explicit-module-boundary-types": "error",
60
+ "@typescript-eslint/naming-convention": [
61
+ "error",
62
+ {
63
+ format: ["camelCase"],
64
+ leadingUnderscore: "allow",
65
+ selector: "default"
66
+ },
67
+ {
68
+ format: [
69
+ "camelCase",
70
+ "UPPER_CASE",
71
+ "PascalCase"
72
+ ],
73
+ leadingUnderscore: "allow",
74
+ selector: "variable"
75
+ },
76
+ {
77
+ selector: "typeLike",
78
+ format: ["PascalCase"]
79
+ },
80
+ {
81
+ selector: "import",
82
+ format: ["camelCase", "PascalCase"]
83
+ },
84
+ {
85
+ selector: "function",
86
+ format: ["camelCase", "PascalCase"]
87
+ },
88
+ {
89
+ format: null,
90
+ modifiers: ["destructured"],
91
+ selector: "variable"
92
+ },
93
+ {
94
+ format: null,
95
+ selector: "objectLiteralProperty"
96
+ }
97
+ ],
98
+ camelcase: "off",
99
+ "@typescript-eslint/no-base-to-string": "error",
100
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
101
+ "@typescript-eslint/no-confusing-void-expression": "error",
102
+ "@typescript-eslint/no-duplicate-enum-values": "error",
103
+ "@typescript-eslint/no-duplicate-type-constituents": "error",
104
+ "@typescript-eslint/no-dynamic-delete": "error",
105
+ "@typescript-eslint/no-extra-non-null-assertion": "error",
106
+ "@typescript-eslint/no-extraneous-class": "error",
107
+ // "@typescript-eslint/no-floating-promises": "error",
108
+ "@typescript-eslint/no-for-in-array": "error",
109
+ "@typescript-eslint/no-import-type-side-effects": "error",
110
+ "@typescript-eslint/no-inferrable-types": "error",
111
+ "@typescript-eslint/no-invalid-void-type": "error",
112
+ "@typescript-eslint/no-meaningless-void-operator": "error",
113
+ "@typescript-eslint/no-misused-new": "error",
114
+ "@typescript-eslint/no-misused-promises": "error",
115
+ "@typescript-eslint/no-mixed-enums": "error",
116
+ "@typescript-eslint/no-namespace": "error",
117
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
118
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
119
+ "@typescript-eslint/no-non-null-assertion": "error",
120
+ "@typescript-eslint/no-redundant-type-constituents": "error",
121
+ "@typescript-eslint/no-require-imports": "error",
122
+ "@typescript-eslint/no-this-alias": "error",
123
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
124
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
125
+ "@typescript-eslint/no-unnecessary-type-arguments": "error",
126
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
127
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
128
+ "@typescript-eslint/no-unsafe-argument": "off",
129
+ "@typescript-eslint/no-unsafe-assignment": "off",
130
+ "@typescript-eslint/no-unsafe-call": "off",
131
+ "@typescript-eslint/no-unsafe-declaration-merging": "off",
132
+ "@typescript-eslint/no-unsafe-enum-comparison": "off",
133
+ "@typescript-eslint/no-unsafe-member-access": "off",
134
+ "@typescript-eslint/no-unsafe-return": "off",
135
+ "@typescript-eslint/no-useless-empty-export": "error",
136
+ "@typescript-eslint/no-var-requires": "error",
137
+ "@typescript-eslint/non-nullable-type-assertion-style": "error",
138
+ "@typescript-eslint/parameter-properties": "error",
139
+ "@typescript-eslint/prefer-as-const": "error",
140
+ "@typescript-eslint/prefer-enum-initializers": "error",
141
+ "@typescript-eslint/prefer-for-of": "error",
142
+ "@typescript-eslint/prefer-includes": "error",
143
+ "@typescript-eslint/prefer-literal-enum-member": "error",
144
+ "@typescript-eslint/prefer-namespace-keyword": "error",
145
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
146
+ "@typescript-eslint/prefer-optional-chain": "error",
147
+ "@typescript-eslint/prefer-readonly": "error",
148
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
149
+ "@typescript-eslint/prefer-regexp-exec": "error",
150
+ "@typescript-eslint/prefer-return-this-type": "error",
151
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
152
+ "@typescript-eslint/promise-function-async": "off",
153
+ "@typescript-eslint/restrict-plus-operands": "error",
154
+ "@typescript-eslint/sort-type-constituents": "error",
155
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
156
+ "@typescript-eslint/unbound-method": "error",
157
+ ...extensionRules,
158
+ "no-duplicate-imports": ["off"]
159
+ };
160
+
161
+ /** @type {import("eslint").Linter.FlatConfig} */
162
+ const config = {
163
+ plugins: { "@typescript-eslint": typescript.plugin },
164
+ rules: {
165
+ ...jsRules,
166
+ ...rules,
167
+ ...formatRules
168
+ }
169
+ };
170
+
171
+ export { config as default };
package/package.json CHANGED
@@ -1,37 +1,43 @@
1
1
  {
2
2
  "name": "@joshuaavalon/eslint-config-typescript",
3
- "version": "6.2.3",
3
+ "version": "7.0.0",
4
4
  "description": "Shareable ESLint Typescript config.",
5
+ "type": "module",
6
+ "main": "dist/cjs/index.js",
7
+ "module": "dist/esm/index.js",
5
8
  "publishConfig": {
6
9
  "access": "public"
7
10
  },
8
- "main": "index.js",
9
11
  "scripts": {
10
- "release": "standard-version -t @joshuaavalon/eslint-config-typescript@"
12
+ "build": "rollup -c"
13
+ },
14
+ "exports": {
15
+ "require": "./dist/cjs/index.js",
16
+ "import": "./dist/esm/index.js"
11
17
  },
12
18
  "keywords": [
13
19
  "eslint",
14
20
  "typescript"
15
21
  ],
16
22
  "files": [
17
- "index.js"
23
+ "dist"
18
24
  ],
19
25
  "author": "Joshua Avalon",
20
26
  "license": "Apache-2.0",
21
27
  "homepage": "https://github.com/joshuaavalon/eslint-config#readme",
22
28
  "repository": {
23
29
  "type": "git",
24
- "url": "https://github.com/joshuaavalon/eslint-config.git",
30
+ "url": "git+https://github.com/joshuaavalon/eslint-config.git",
25
31
  "directory": "packages/typescript"
26
32
  },
27
33
  "bugs": {
28
34
  "url": "https://github.com/joshuaavalon/eslint-config/issues"
29
35
  },
30
36
  "dependencies": {
31
- "@typescript-eslint/eslint-plugin": "^5.36.0",
32
- "@typescript-eslint/parser": "^5.36.0",
33
- "eslint": "^8.23.0",
34
- "eslint-config-prettier": "^8.5.0",
35
- "eslint-plugin-prettier": "^4.2.1"
37
+ "@joshuaavalon/eslint-config-javascript": "^7.0.0",
38
+ "typescript-eslint": "^7.0.1"
39
+ },
40
+ "peerDependencies": {
41
+ "eslint": "^8.56.0"
36
42
  }
37
43
  }
package/index.js DELETED
@@ -1,187 +0,0 @@
1
- module.exports = {
2
- parser: "@typescript-eslint/parser",
3
- extends: [
4
- "eslint:recommended",
5
- "plugin:@typescript-eslint/recommended",
6
- "plugin:prettier/recommended"
7
- ],
8
- plugins: ["@typescript-eslint"],
9
- rules: {
10
- "array-callback-return": "error",
11
- "arrow-body-style": ["error", "as-needed"],
12
- "arrow-parens": ["error", "as-needed"],
13
- "block-scoped-var": "error",
14
- "comma-dangle": ["error", "never"],
15
- complexity: "error",
16
- "consistent-return": "error",
17
- curly: "error",
18
- "default-case-last": "error",
19
- "default-param-last": "error",
20
- "dot-location": ["error", "property"],
21
- "eol-last": ["error", "always"],
22
- eqeqeq: "error",
23
- "guard-for-in": "error",
24
- "linebreak-style": ["error", "unix"],
25
- "lines-between-class-members": [
26
- "error",
27
- "always",
28
- {
29
- exceptAfterSingleLine: true
30
- }
31
- ],
32
- "no-alert": "error",
33
- "no-caller": "error",
34
- "no-console": "off",
35
- "no-constructor-return": "error",
36
- "no-else-return": "error",
37
- "no-empty-function": "error",
38
- "no-eq-null": "error",
39
- "no-eval": "error",
40
- "no-extend-native": "error",
41
- "no-extra-bind": "error",
42
- "no-extra-label": "error",
43
- "no-floating-decimal": "error",
44
- "no-implicit-coercion": "error",
45
- "no-implied-eval": "error",
46
- "no-invalid-this": "error",
47
- "no-iterator": "error",
48
- "no-label-var": "error",
49
- "no-labels": "error",
50
- "no-lone-blocks": "error",
51
- "no-lonely-if": "error",
52
- "no-loop-func": "error",
53
- "no-multi-spaces": "error",
54
- "no-multi-str": "error",
55
- "no-new": "error",
56
- "no-new-func": "error",
57
- "no-new-wrappers": "error",
58
- "no-octal-escape": "error",
59
- "no-param-reassign": "error",
60
- "no-promise-executor-return": "error",
61
- "no-proto": "error",
62
- "no-redeclare": "off",
63
- "no-return-assign": "error",
64
- "no-script-url": "error",
65
- "no-self-assign": "error",
66
- "no-self-compare": "error",
67
- "no-sequences": "error",
68
- "no-template-curly-in-string": "error",
69
- "no-throw-literal": "error",
70
- "no-unmodified-loop-condition": "error",
71
- "no-unreachable-loop": "error",
72
- "no-unused-expressions": "off",
73
- "no-unused-vars": "off",
74
- "no-use-before-define": "off",
75
- "no-useless-backreference": "error",
76
- "no-useless-call": "error",
77
- "no-useless-concat": "error",
78
- "no-useless-return": "error",
79
- "no-void": "error",
80
- "prefer-arrow-callback": "error",
81
- "prefer-named-capture-group": "error",
82
- "prefer-promise-reject-errors": "error",
83
- "prefer-regex-literals": "error",
84
- "prettier/prettier": [
85
- "error",
86
- {
87
- arrowParens: "avoid",
88
- trailingComma: "none"
89
- }
90
- ],
91
- quotes: "off",
92
- "require-unicode-regexp": "error",
93
- "semi-style": ["error", "last"],
94
- "sort-imports": [
95
- "error",
96
- {
97
- ignoreCase: true,
98
- ignoreDeclarationSort: true
99
- }
100
- ],
101
- "vars-on-top": "error",
102
- "wrap-iife": "error",
103
- yoda: "error"
104
- },
105
- overrides: [
106
- {
107
- files: ["*.js"],
108
- rules: {
109
- "@typescript-eslint/no-var-requires": "off"
110
- }
111
- },
112
- {
113
- files: ["*.ts", "*.mts", "*.cts", "*.tsx"],
114
- rules: {
115
- "no-dupe-class-members": "off",
116
- "@typescript-eslint/explicit-member-accessibility": "error",
117
- "@typescript-eslint/array-type": "error",
118
- "@typescript-eslint/explicit-function-return-type": [
119
- "error",
120
- {
121
- allowExpressions: true,
122
- allowHigherOrderFunctions: true,
123
- allowTypedFunctionExpressions: true,
124
- allowDirectConstAssertionInArrowFunctions: true
125
- }
126
- ],
127
- "@typescript-eslint/naming-convention": [
128
- "error",
129
- {
130
- format: ["camelCase"],
131
- leadingUnderscore: "allow",
132
- selector: "default"
133
- },
134
- {
135
- format: ["camelCase", "UPPER_CASE", "PascalCase"],
136
- leadingUnderscore: "allow",
137
- selector: "variable"
138
- },
139
- {
140
- format: ["PascalCase"],
141
- selector: "typeLike"
142
- },
143
- {
144
- format: null,
145
- modifiers: ["destructured"],
146
- selector: "variable"
147
- },
148
- {
149
- format: null,
150
- selector: "objectLiteralProperty"
151
- }
152
- ],
153
- "@typescript-eslint/no-empty-interface": "off",
154
- "@typescript-eslint/no-explicit-any": "off",
155
- "@typescript-eslint/no-unused-expressions": ["error"],
156
- "@typescript-eslint/no-unused-vars": [
157
- "error",
158
- {
159
- args: "after-used",
160
- argsIgnorePattern: "^_",
161
- ignoreRestSiblings: true
162
- }
163
- ],
164
- "@typescript-eslint/no-use-before-define": [
165
- "error",
166
- {
167
- typedefs: false
168
- }
169
- ],
170
- "@typescript-eslint/quotes": [
171
- "error",
172
- "double",
173
- {
174
- avoidEscape: true
175
- }
176
- ],
177
- "@typescript-eslint/no-redeclare": [
178
- "error",
179
- { ignoreDeclarationMerge: true }
180
- ],
181
- "@typescript-eslint/consistent-type-imports": "error",
182
- "@typescript-eslint/method-signature-style": "error",
183
- "@typescript-eslint/no-useless-empty-export": "error"
184
- }
185
- }
186
- ]
187
- };