@lenne.tech/eslint-config-ts 0.0.2

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.
Files changed (2) hide show
  1. package/index.js +280 -0
  2. package/package.json +35 -0
package/index.js ADDED
@@ -0,0 +1,280 @@
1
+ console.log("Linting TypeScript...");
2
+
3
+ module.exports = {
4
+ extends: [
5
+ "plugin:import/typescript",
6
+ "plugin:@typescript-eslint/recommended",
7
+ "plugin:import/recommended",
8
+ "plugin:eslint-comments/recommended",
9
+ "plugin:jsonc/recommended-with-jsonc",
10
+ "plugin:yml/standard",
11
+ "plugin:markdown/recommended",
12
+ ],
13
+ plugins: ["no-only-tests", "unused-imports"],
14
+ settings: {
15
+ "import/resolver": {
16
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
17
+ },
18
+ },
19
+ rules: {
20
+ "import/named": "off",
21
+
22
+ // TS
23
+ "@typescript-eslint/ban-ts-comment": [
24
+ "error",
25
+ { "ts-ignore": "allow-with-description" },
26
+ ],
27
+ "@typescript-eslint/member-delimiter-style": [
28
+ "error",
29
+ { multiline: { delimiter: "none" } },
30
+ ],
31
+ "@typescript-eslint/type-annotation-spacing": ["error", {}],
32
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
33
+ "@typescript-eslint/prefer-ts-expect-error": "error",
34
+ "@typescript-eslint/no-require-imports": "error",
35
+ // Override JS
36
+ "no-useless-constructor": "off",
37
+ "no-invalid-this": "off",
38
+ "@typescript-eslint/no-invalid-this": "error",
39
+ "no-redeclare": "off",
40
+ "@typescript-eslint/no-redeclare": "error",
41
+ "no-use-before-define": "off",
42
+ "@typescript-eslint/no-use-before-define": [
43
+ "error",
44
+ { functions: false, classes: false, variables: true },
45
+ ],
46
+ "brace-style": "off",
47
+ "@typescript-eslint/brace-style": [
48
+ "error",
49
+ "stroustrup",
50
+ { allowSingleLine: true },
51
+ ],
52
+ "comma-dangle": "off",
53
+ "@typescript-eslint/comma-dangle": ["error", "always-multiline"],
54
+ "object-curly-spacing": "off",
55
+ "@typescript-eslint/object-curly-spacing": ["error", "always"],
56
+ "@typescript-eslint/semi": ["error", "always"],
57
+ quotes: "off",
58
+ "@typescript-eslint/quotes": ["error", "single"],
59
+ "space-before-blocks": "off",
60
+ "@typescript-eslint/space-before-blocks": ["error", "always"],
61
+ "space-before-function-paren": "off",
62
+ "@typescript-eslint/space-before-function-paren": [
63
+ "error",
64
+ {
65
+ anonymous: "always",
66
+ named: "never",
67
+ asyncArrow: "always",
68
+ },
69
+ ],
70
+ "space-infix-ops": "off",
71
+ "@typescript-eslint/space-infix-ops": "error",
72
+ "keyword-spacing": "off",
73
+ "@typescript-eslint/keyword-spacing": [
74
+ "error",
75
+ { before: true, after: true },
76
+ ],
77
+ "comma-spacing": "off",
78
+ "@typescript-eslint/comma-spacing": [
79
+ "error",
80
+ { before: false, after: true },
81
+ ],
82
+ "no-extra-parens": "off",
83
+ "@typescript-eslint/no-extra-parens": ["error", "functions"],
84
+ "no-dupe-class-members": "off",
85
+ "@typescript-eslint/no-dupe-class-members": "error",
86
+ "no-loss-of-precision": "off",
87
+ "@typescript-eslint/no-loss-of-precision": "error",
88
+ "lines-between-class-members": "off",
89
+ "@typescript-eslint/lines-between-class-members": [
90
+ "error",
91
+ "always",
92
+ { exceptAfterSingleLine: true },
93
+ ],
94
+
95
+ // off
96
+ "@typescript-eslint/consistent-indexed-object-style": "off",
97
+ "@typescript-eslint/naming-convention": "off",
98
+ "@typescript-eslint/explicit-function-return-type": "off",
99
+ "@typescript-eslint/explicit-member-accessibility": "off",
100
+ "@typescript-eslint/no-explicit-any": "off",
101
+ "@typescript-eslint/parameter-properties": "off",
102
+ "@typescript-eslint/no-empty-interface": "off",
103
+ "@typescript-eslint/ban-ts-ignore": "off",
104
+ "@typescript-eslint/no-empty-function": "off",
105
+ "@typescript-eslint/no-non-null-assertion": "off",
106
+ "@typescript-eslint/explicit-module-boundary-types": "off",
107
+ "@typescript-eslint/ban-types": "off",
108
+ "@typescript-eslint/triple-slash-reference": "off",
109
+ // handled by unused-imports/no-unused-imports
110
+ "@typescript-eslint/no-unused-vars": "off",
111
+
112
+ /**
113
+ * Basic
114
+ */
115
+
116
+ // import
117
+ "import/order": "error",
118
+ "import/first": "error",
119
+ "import/no-mutable-exports": "error",
120
+ "import/no-unresolved": "off",
121
+ "import/no-absolute-path": "off",
122
+ "import/newline-after-import": [
123
+ "error",
124
+ { count: 1, considerComments: true },
125
+ ],
126
+
127
+ // Common
128
+ semi: ["error", "always"],
129
+ curly: ["error", "multi-or-nest", "consistent"],
130
+ quotes: ["error", "single"],
131
+ "quote-props": ["error", "consistent-as-needed"],
132
+
133
+ "unused-imports/no-unused-imports": "error",
134
+ "unused-imports/no-unused-vars": [
135
+ "warn",
136
+ {
137
+ vars: "all",
138
+ varsIgnorePattern: "^_",
139
+ args: "after-used",
140
+ argsIgnorePattern: "\\b(type|of|returns)\\b", // Arguments containing the words "type", "of", or "returns" will be ignored --> nest-server
141
+ },
142
+ ],
143
+
144
+ "no-param-reassign": "off",
145
+ "array-bracket-spacing": ["error", "never"],
146
+ "block-spacing": ["error", "always"],
147
+ camelcase: "off",
148
+ "comma-style": ["error", "last"],
149
+ "no-constant-condition": "warn",
150
+ "no-debugger": "error",
151
+ "no-console": ["error", { allow: ["info", "warn", "error"] }],
152
+ "no-cond-assign": ["error", "always"],
153
+ "func-call-spacing": "off",
154
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
155
+ "no-restricted-syntax": [
156
+ "error",
157
+ "DebuggerStatement",
158
+ "LabeledStatement",
159
+ "WithStatement",
160
+ ],
161
+ "no-return-await": "off",
162
+ "no-restricted-globals": [
163
+ "error",
164
+ { name: "global", message: "Use `globalThis` instead." },
165
+ { name: "self", message: "Use `globalThis` instead." },
166
+ ],
167
+ "no-restricted-properties": [
168
+ "error",
169
+ {
170
+ property: "__proto__",
171
+ message:
172
+ "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
173
+ },
174
+ {
175
+ property: "__defineGetter__",
176
+ message: "Use `Object.defineProperty` instead.",
177
+ },
178
+ {
179
+ property: "__defineSetter__",
180
+ message: "Use `Object.defineProperty` instead.",
181
+ },
182
+ {
183
+ property: "__lookupGetter__",
184
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
185
+ },
186
+ {
187
+ property: "__lookupSetter__",
188
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
189
+ },
190
+ ],
191
+
192
+ // es6
193
+ "no-var": "error",
194
+ "prefer-const": [
195
+ "error",
196
+ {
197
+ destructuring: "all",
198
+ ignoreReadBeforeAssign: true,
199
+ },
200
+ ],
201
+ "prefer-arrow-callback": [
202
+ "error",
203
+ {
204
+ allowNamedFunctions: false,
205
+ allowUnboundThis: true,
206
+ },
207
+ ],
208
+ "object-shorthand": [
209
+ "error",
210
+ "always",
211
+ {
212
+ ignoreConstructors: false,
213
+ avoidQuotes: true,
214
+ },
215
+ ],
216
+ "prefer-exponentiation-operator": "error",
217
+ "prefer-rest-params": "error",
218
+ "prefer-spread": "error",
219
+ "prefer-template": "error",
220
+ "template-curly-spacing": "error",
221
+ "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
222
+ "generator-star-spacing": "off",
223
+ "spaced-comment": [
224
+ "error",
225
+ "always",
226
+ {
227
+ line: {
228
+ markers: ["/"],
229
+ exceptions: ["/", "#"],
230
+ },
231
+ block: {
232
+ markers: ["!"],
233
+ exceptions: ["*"],
234
+ balanced: true,
235
+ },
236
+ },
237
+ ],
238
+
239
+ // best-practice
240
+ "array-callback-return": "error",
241
+ "block-scoped-var": "error",
242
+ "consistent-return": "off",
243
+ complexity: "off",
244
+ eqeqeq: ["error", "smart"],
245
+ "no-alert": "warn",
246
+ "no-case-declarations": "error",
247
+ "no-multi-spaces": "error",
248
+ "no-multi-str": "error",
249
+ "no-with": "error",
250
+ "no-void": "error",
251
+ "no-useless-escape": "off",
252
+ "vars-on-top": "error",
253
+ "require-await": "off",
254
+ "no-return-assign": "off",
255
+ "operator-linebreak": ["error", "before"],
256
+ "max-statements-per-line": ["error", { max: 1 }],
257
+
258
+ // node
259
+ "n/no-callback-literal": "off",
260
+ "eslint-comments/disable-enable-pair": "off",
261
+ "import/no-named-as-default-member": "off",
262
+ "import/no-named-as-default": "off",
263
+ "import/namespace": "off",
264
+
265
+ "sort-imports": [
266
+ "error",
267
+ {
268
+ ignoreCase: false,
269
+ ignoreDeclarationSort: true,
270
+ ignoreMemberSort: false,
271
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
272
+ allowSeparatedGroups: false,
273
+ },
274
+ ],
275
+
276
+ // yml
277
+ "yml/quotes": ["error", { prefer: "single", avoidEscape: false }],
278
+ "yml/no-empty-document": "off",
279
+ },
280
+ };
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@lenne.tech/eslint-config-ts",
3
+ "version": "0.0.2",
4
+ "description": "ESLint config of lenne.Tech for TypeScript",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "eslint-config-ts"
8
+ ],
9
+ "main": "index.js",
10
+ "files": [
11
+ "index.js"
12
+ ],
13
+ "scripts": {
14
+ "watch": "watch 'yalc push --private'"
15
+ },
16
+ "peerDependencies": {
17
+ "eslint": ">=7.4.0"
18
+ },
19
+ "dependencies": {
20
+ "eslint-plugin-no-only-tests": "3.1.0",
21
+ "eslint-plugin-import": "2.27.5",
22
+ "eslint-plugin-jsonc": "2.8.0",
23
+ "eslint-plugin-eslint-comments": "3.2.0",
24
+ "eslint-plugin-unused-imports": "2.0.0",
25
+ "eslint-plugin-yml": "1.7.0",
26
+ "eslint-plugin-markdown": "3.0.0",
27
+ "@typescript-eslint/eslint-plugin": "5.57.0",
28
+ "@typescript-eslint/parser": "5.57.0",
29
+ "eslint-config-prettier": "8.8.0"
30
+ },
31
+ "devDependencies": {
32
+ "eslint": "8.41.0",
33
+ "watch": "1.0.2"
34
+ }
35
+ }