@gtvmbh/eslint-config 1.1.3 → 1.1.5

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/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # Using the GTV ESLint configurations
2
2
 
3
3
  1. Run `npm i @gtvmbh/eslint-config --save-dev` to install the GTV ESLint configuration. Take note of the messages about missing peer dependencies.
4
- 2. Update or install any missing peer dependencies noted in the previous step, which may be any of: `npm i eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-jsdoc --save-dev`. If you are unsure what peer dependencies are required, run `npm view @gtvmbh/eslint-config peerDependencies`
5
- 3. Add a file named `.eslintrc.js` in the project root, setting up ESLint the use of the GTV ESLint configurations. See the `examples` folder for templates.
6
- 4. Run ESLint from the project root to see if everything works as intended:
4
+ 2. Add a file named `.eslintrc.js` in the project root, setting up ESLint the use of the GTV ESLint configurations. See the `examples` folder for templates.
5
+ 3. Run ESLint from the project root to see if everything works as intended:
7
6
  * `./node_modules/.bin/eslint -c .eslintrc.js .` for javascript projects.
8
7
  * `./node_modules/.bin/eslint -c .eslintrc.js . --ext .ts` for typescript projects.
9
- 5. Configure your IDE to use ESLint to check automatically. In VS Code it should be enough to install the ESLint extension and everything should be picked up automatically.
8
+ 4. Configure your IDE to use ESLint to check automatically. In VS Code it should be enough to install the ESLint extension and everything should be picked up automatically.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtvmbh/eslint-config",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "ESLint configurations for various project types developed by Gesellschaft für Technische Visualistik",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/angular.js CHANGED
@@ -10,7 +10,7 @@ module.exports = {
10
10
  {
11
11
  'capIsNewExceptions': [
12
12
  // exceptions for angular decorators (@Component, @Input etc), array may be extended if needed.
13
- 'Component', 'NgModule', 'ViewChild', 'Injectable', 'Input', 'Output', 'HostListener'
13
+ 'Component', 'NgModule', 'ViewChild', 'Injectable', 'Input', 'Output', 'HostListener', 'Pipe', 'Inject', 'Directive', 'HostBinding'
14
14
  ]
15
15
  }
16
16
  ]
package/src/typescript.js CHANGED
@@ -10,226 +10,236 @@ module.exports = {
10
10
  ],
11
11
  rules: {
12
12
 
13
- 'no-shadow': 'off',
14
- '@typescript-eslint/no-shadow': 'error',
15
-
13
+ "no-shadow": "off",
14
+ "@typescript-eslint/no-shadow": "error",
15
+
16
16
  // Require that member overloads be consecutive
17
17
  '@typescript-eslint/adjacent-overload-signatures': 'error',
18
-
18
+
19
19
  // Requires using either T[] or Array<T> for arrays
20
- '@typescript-eslint/array-type': ['error', {default: 'generic'}],
21
-
20
+ '@typescript-eslint/array-type': ['error', { default: 'generic' }],
21
+
22
22
  // Disallows awaiting a value that is not a Thenable
23
23
  '@typescript-eslint/await-thenable': 'error',
24
-
24
+
25
25
  // Bans // @ts-<directive> comments from being used
26
26
  '@typescript-eslint/ban-ts-comment': 'off',
27
-
27
+
28
28
  // Bans specific types from being used
29
29
  '@typescript-eslint/ban-types': 'off',
30
-
30
+
31
31
  // Ensures that literals on classes are exposed in a consistent style
32
32
  '@typescript-eslint/class-literal-property-style': ['error', 'fields'],
33
-
33
+
34
34
  // Enforces consistent usage of type assertions
35
35
  '@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'as', objectLiteralTypeAssertions: 'never' }],
36
-
36
+
37
37
  // Consistent with type definition either interface or type
38
38
  '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
39
-
39
+
40
40
  // Require explicit return types on functions and class methods
41
41
  '@typescript-eslint/explicit-function-return-type': 'error',
42
-
42
+
43
43
  // Require explicit accessibility modifiers on class properties and methods
44
44
  // is defined in overrides to allow mixed code base
45
- '@typescript-eslint/explicit-member-accessibility': 'off',
46
-
45
+ '@typescript-eslint/explicit-member-accessibility': 'off',
46
+
47
47
  // Require explicit return and argument types on exported functions' and classes' public class methods
48
48
  '@typescript-eslint/explicit-module-boundary-types': 'error',
49
-
49
+
50
50
  // Require a specific member delimiter style for interfaces and type literals
51
51
  '@typescript-eslint/member-delimiter-style': 'error',
52
-
52
+
53
53
  // Require a consistent member declaration order
54
54
  '@typescript-eslint/member-ordering': 'warn',
55
-
55
+
56
56
  // Enforces using a particular method signature syntax.
57
57
  '@typescript-eslint/method-signature-style': 'warn', //anscheinend ist 'property' besser, weesschne,
58
-
58
+
59
59
  // Enforces naming conventions for everything across a codebase
60
- '@typescript-eslint/naming-convention': 'error',
61
-
60
+
61
+ '@typescript-eslint/naming-convention': ['error', {
62
+ selector: 'default',
63
+ format: ['camelCase', 'UPPER_CASE'],
64
+ leadingUnderscore: 'forbid',
65
+ },
66
+
67
+ {
68
+ selector: 'variable',
69
+ format: ['camelCase', 'UPPER_CASE'],
70
+ leadingUnderscore: 'forbid',
71
+ },
72
+
73
+ {
74
+ selector: 'typeLike',
75
+ format: ['PascalCase'],
76
+ }],
77
+
62
78
  // Requires that .toString() is only called on objects which provide useful information when stringified
63
79
  '@typescript-eslint/no-base-to-string': 'warn',
64
-
80
+
65
81
  // Disallow the delete operator with computed key expressions
66
82
  '@typescript-eslint/no-dynamic-delete': 'error',
67
-
83
+
68
84
  // Disallow the declaration of empty interfaces
69
85
  '@typescript-eslint/no-empty-interface': 'warn',
70
-
86
+
71
87
  // Disallow usage of the any type
72
88
  '@typescript-eslint/no-explicit-any': ['error', { fixToUnknown: true, ignoreRestArgs: false }],
73
-
89
+
74
90
  // Disallow extra non-null assertion
75
91
  '@typescript-eslint/no-extra-non-null-assertion': 'error',
76
-
92
+
77
93
  // Forbids the use of classes as namespaces
78
94
  '@typescript-eslint/no-extraneous-class': 'error',
79
-
95
+
80
96
  // Requires Promise-like values to be handled appropriately
81
97
  '@typescript-eslint/no-floating-promises': 'warn',
82
-
98
+
83
99
  // Disallow iterating over an array with a for-in loop
84
100
  '@typescript-eslint/no-for-in-array': 'warn',
85
-
101
+
86
102
  // Disallow the use of eval()-like methods
87
103
  '@typescript-eslint/no-implied-eval': 'error',
88
-
104
+
89
105
  // Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean
90
106
  '@typescript-eslint/no-inferrable-types': 'error',
91
-
107
+
92
108
  // Disallows usage of void type outside of generic or return types
93
109
  '@typescript-eslint/no-invalid-void-type': 'error',
94
-
110
+
95
111
  // Enforce valid definition of new and constructor
96
112
  '@typescript-eslint/no-misused-new': 'error',
97
-
113
+
98
114
  // Avoid using promises in places not designed to handle them
99
115
  '@typescript-eslint/no-misused-promises': 'error',
100
-
116
+
101
117
  // Disallow the use of custom TypeScript modules and namespaces
102
118
  '@typescript-eslint/no-namespace': 'error',
103
-
119
+
104
120
  // Disallows using a non-null assertion after an optional chain expression
105
121
  '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
106
-
122
+
107
123
  // Disallows non-null assertions using the ! postfix operator
108
124
  '@typescript-eslint/no-non-null-assertion': 'error',
109
-
125
+
110
126
  // Disallow the use of parameter properties in class constructors
111
127
  '@typescript-eslint/no-parameter-properties': 'off',
112
-
128
+
113
129
  // Disallows invocation of require()
114
130
  '@typescript-eslint/no-require-imports': 'error',
115
-
131
+
116
132
  // Disallow aliasing this
117
133
  '@typescript-eslint/no-this-alias': 'warn',// wie beißt sich das mit that = this in eslint?,
118
-
134
+
119
135
  // Disallow throwing literals as exceptions
120
136
  '@typescript-eslint/no-throw-literal': 'error',
121
-
137
+
122
138
  // Disallow the use of type aliases
123
139
  // NOTE (astahl): only prevent simple use of literal objects instead of interfaces, e.g type MyType = { a: string }.
124
- '@typescript-eslint/no-type-alias': ['error', {
125
- allowAliases: 'always', // set to "always" will allow you to do aliasing (Defaults to "never").
126
- allowCallbacks: 'always', // set to "always" will allow you to use type aliases with callbacks (Defaults to "never")
127
- allowConditionalTypes: 'always', // set to "always" will allow you to use type aliases with conditional types (Defaults to "never")
128
- allowConstructors: 'always', // set to "always" will allow you to use type aliases with constructors (Defaults to "never")
129
- allowLiterals: 'in-unions-and-intersections', // set to "always" will allow you to use type aliases with literal objects (Defaults to "never")
130
- allowMappedTypes: 'always', // set to "always" will allow you to use type aliases as mapping tools (Defaults to "never")
131
- allowTupleTypes: 'always' // set to "always" will allow you to use type aliases with tuples (Defaults to "never")
132
- }],
133
-
140
+ '@typescript-eslint/no-type-alias': 'off',
141
+ '@typescript-eslint/consistent-type-definitions': ["error", "interface"],
142
+
143
+
134
144
  // Flags unnecessary equality comparisons against boolean literals
135
145
  '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
136
-
146
+
137
147
  // Prevents conditionals where the type is always truthy or always falsy
138
148
  '@typescript-eslint/no-unnecessary-condition': 'off',
139
-
149
+
140
150
  // Warns when a namespace qualifier is unnecessary
141
151
  '@typescript-eslint/no-unnecessary-qualifier': 'warn',
142
-
152
+
143
153
  // Enforces that type arguments will not be used if not required
144
154
  '@typescript-eslint/no-unnecessary-type-arguments': 'warn',
145
-
155
+
146
156
  // Warns if a type assertion does not change the type of an expression
147
157
  '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
148
-
158
+
149
159
  // Disallows assigning any to variables and properties
150
160
  '@typescript-eslint/no-unsafe-assignment': 'warn',
151
-
161
+
152
162
  // Disallows calling an any type value
153
163
  '@typescript-eslint/no-unsafe-call': 'warn',
154
-
164
+
155
165
  // Disallows member access on any typed variables
156
166
  '@typescript-eslint/no-unsafe-member-access': 'warn',
157
-
167
+
158
168
  // Disallows returning any from a function
159
169
  '@typescript-eslint/no-unsafe-return': 'warn',
160
-
170
+
161
171
  // Disallows the use of require statements except in import statements
162
172
  '@typescript-eslint/no-var-requires': 'error',
163
-
173
+
164
174
  // Prefer usage of as const over literal type
165
175
  '@typescript-eslint/prefer-as-const': 'warn',
166
-
176
+
167
177
  // Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated
168
178
  '@typescript-eslint/prefer-for-of': 'warn',
169
-
179
+
170
180
  // Use function types instead of interfaces with call signatures
171
181
  '@typescript-eslint/prefer-function-type': 'warn',
172
-
182
+
173
183
  // Enforce includes method over indexOf method
174
184
  '@typescript-eslint/prefer-includes': 'warn',
175
-
185
+
176
186
  // Require the use of the namespace keyword instead of the module keyword to declare custom TypeScript modules
177
187
  '@typescript-eslint/prefer-namespace-keyword': 'error',
178
-
188
+
179
189
  // Enforce the usage of the nullish coalescing operator instead of logical chaining
180
190
  '@typescript-eslint/prefer-nullish-coalescing': 'warn',
181
-
191
+
182
192
  // Prefer using concise optional chain expressions instead of chained logical ands
183
193
  '@typescript-eslint/prefer-optional-chain': 'warn',
184
-
194
+
185
195
  // Requires that private members are marked as readonly if they're never modified outside of the constructor
186
196
  '@typescript-eslint/prefer-readonly': 'warn',
187
-
197
+
188
198
  // Requires that function parameters are typed as readonly to prevent accidental mutation of inputs
189
199
  '@typescript-eslint/prefer-readonly-parameter-types': 'off',
190
-
200
+
191
201
  // Prefer using type parameter when calling Array#reduce instead of casting
192
202
  '@typescript-eslint/prefer-reduce-type-parameter': 'error',
193
-
203
+
194
204
  // Enforce that RegExp#exec is used instead of String#match if no global flag is provided
195
205
  '@typescript-eslint/prefer-regexp-exec': 'warn',
196
-
206
+
197
207
  // Enforce the use of String#startsWith and String#endsWith instead of other equivalent methods of checking substrings
198
208
  '@typescript-eslint/prefer-string-starts-ends-with': 'warn',
199
-
209
+
200
210
  // Recommends using // @ts-expect-error over // @ts-ignore
201
211
  '@typescript-eslint/prefer-ts-expect-error': 'off', // cool aber TS >= 3.9,
202
-
212
+
203
213
  // Requires any function or method that returns a Promise to be marked async
204
214
  '@typescript-eslint/promise-function-async': ['error', { checkArrowFunctions: false, checkFunctionExpressions: false }],
205
-
215
+
206
216
  // Requires Array#sort calls to always provide a compareFunction
207
217
  '@typescript-eslint/require-array-sort-compare': ['warn', { 'ignoreStringArrays': true }],
208
-
218
+
209
219
  // When adding two variables, operands must both be of type number or of type string
210
220
  '@typescript-eslint/restrict-plus-operands': 'error',
211
-
221
+
212
222
  // Enforce template literal expressions to be of string type
213
223
  '@typescript-eslint/restrict-template-expressions': 'off', // (oder warn mit allen options an),
214
-
224
+
215
225
  // Restricts the types allowed in boolean expressions
216
226
  '@typescript-eslint/strict-boolean-expressions': 'warn',
217
-
227
+
218
228
  // Exhaustiveness checking in switch with union type
219
229
  '@typescript-eslint/switch-exhaustiveness-check': 'error',
220
-
230
+
221
231
  // Sets preference level for triple slash directives versus ES6-style import declarations
222
232
  '@typescript-eslint/triple-slash-reference': ['error', { 'path': 'never', 'types': 'never', 'lib': 'never' }],
223
-
233
+
224
234
  // Require consistent spacing around type annotations
225
235
  '@typescript-eslint/type-annotation-spacing': 'error',
226
-
236
+
227
237
  // Requires type annotations to exist
228
238
  '@typescript-eslint/typedef': 'off', // compiler noImplicitAny
229
-
239
+
230
240
  // Enforces unbound methods are called with their expected scope
231
- '@typescript-eslint/unbound-method': ['warn', {'ignoreStatic': true}],
232
-
241
+ '@typescript-eslint/unbound-method': ['warn', { 'ignoreStatic': true }],
242
+
233
243
  // Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter
234
244
  '@typescript-eslint/unified-signatures': 'warn',
235
245
 
@@ -247,103 +257,103 @@ module.exports = {
247
257
  // Enforce consistent brace style for blocks
248
258
  'brace-style': 'off',
249
259
  '@typescript-eslint/brace-style': 'error',
250
-
260
+
251
261
  // Enforces consistent spacing before and after commas
252
262
  'comma-spacing': 'off',
253
263
  '@typescript-eslint/comma-spacing': ['error', { 'before': false, 'after': true }],
254
-
264
+
255
265
  // Enforce default parameters to be last
256
266
  'default-param-last': 'off',
257
267
  '@typescript-eslint/default-param-last': 'error',
258
-
268
+
259
269
  // enforce dot notation whenever possible
260
270
  'dot-notation': 'off',
261
271
  '@typescript-eslint/dot-notation': 'off',
262
-
272
+
263
273
  // Require or disallow spacing between function identifiers and their invocations
264
274
  'func-call-spacing': 'off',
265
275
  '@typescript-eslint/func-call-spacing': 'error',
266
-
276
+
267
277
  // Enforce consistent indentation
268
278
  'indent': 'off',
269
279
  '@typescript-eslint/indent': ["error", 2, { "SwitchCase": 1 }],
270
-
280
+
271
281
  // require or disallow initialization in variable declarations
272
282
  'init-declarations': 'off',
273
283
  '@typescript-eslint/init-declarations': 'off',
274
-
284
+
275
285
  // Enforce consistent spacing before and after keywords
276
286
  'keyword-spacing': 'off',
277
287
  '@typescript-eslint/keyword-spacing': 'error',
278
-
288
+
279
289
  // Require or disallow an empty line between class members
280
290
  'lines-between-class-members': 'off',
281
291
  '@typescript-eslint/lines-between-class-members': ['error', 'always', { 'exceptAfterSingleLine': true }],
282
-
292
+
283
293
  // Disallow generic Array constructors
284
294
  'no-array-constructor': 'off',
285
295
  '@typescript-eslint/no-array-constructor': 'error',
286
-
296
+
287
297
  // Disallow duplicate class members
288
298
  'no-dupe-class-members': 'off',
289
299
  '@typescript-eslint/no-dupe-class-members': 'error',
290
-
300
+
291
301
  // Disallow empty functions
292
302
  'no-empty-function': 'off',
293
303
  '@typescript-eslint/no-empty-function': 'off',
294
-
304
+
295
305
  // Disallow unnecessary parentheses
296
306
  "no-extra-parens": "off",
297
- "@typescript-eslint/no-extra-parens": ["warn", "all", { "conditionalAssign": false , "returnAssign": false, "nestedBinaryExpressions": false }],
298
-
307
+ "@typescript-eslint/no-extra-parens": ["warn", "all", { "conditionalAssign": false, "returnAssign": false, "nestedBinaryExpressions": false }],
308
+
299
309
  // Disallow unnecessary semicolons
300
310
  'no-extra-semi': 'off',
301
311
  '@typescript-eslint/no-extra-semi': 'warn',
302
-
312
+
303
313
  // disallow this keywords outside of classes or class-like objects
304
314
  'no-invalid-this': 'off',
305
315
  '@typescript-eslint/no-invalid-this': 'error',
306
-
316
+
307
317
  // Disallow magic numbers
308
318
  'no-magic-numbers': 'off',
309
319
  '@typescript-eslint/no-magic-numbers': 'off',
310
-
320
+
311
321
  // Disallow unused expressions
312
322
  'no-unused-expressions': 'off',
313
323
  '@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
314
-
324
+
315
325
  // Disallow unused variables
316
326
  'no-unused-vars': 'off',
317
327
  '@typescript-eslint/no-unused-vars': 'error',
318
-
328
+
319
329
  // Disallow the use of variables before they are defined
320
330
  'no-use-before-define': 'off',
321
331
  '@typescript-eslint/no-use-before-define': 'warn',
322
-
332
+
323
333
  // Disallow unnecessary constructors
324
334
  'no-useless-constructor': 'off',
325
335
  '@typescript-eslint/no-useless-constructor': 'warn',
326
-
336
+
327
337
  // Enforce the consistent use of either backticks, double, or single quotes
328
338
  'quotes': 'off',
329
339
  '@typescript-eslint/quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
330
-
340
+
331
341
  // Disallow async functions which have no await expression
332
342
  'require-await': 'off',
333
343
  '@typescript-eslint/require-await': 'error',
334
-
344
+
335
345
  // Enforces consistent returning of awaited values
336
346
  'no-return-await': 'off',
337
347
  '@typescript-eslint/return-await': 'warn',
338
-
348
+
339
349
  // Require or disallow semicolons instead of ASI
340
350
  'semi': 'off',
341
351
  '@typescript-eslint/semi': ['error', 'always'],
342
-
352
+
343
353
  // Enforces consistent spacing before function parenthesis
344
354
  'space-before-function-paren': 'off',
345
- '@typescript-eslint/space-before-function-paren': ['error', {'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always'}],
346
-
355
+ '@typescript-eslint/space-before-function-paren': ['error', { 'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always' }],
356
+
347
357
  },
348
358
  overrides: [
349
359
  {
package/src/vidala.js CHANGED
@@ -8,5 +8,6 @@ module.exports = {
8
8
  }],
9
9
  '@typescript-eslint/unbound-method': 'off',
10
10
  'prefer-named-capture-group': 'off',
11
+ '@typescript/default-param-last': 'warn'
11
12
  }
12
13
  };