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