@gtvmbh/eslint-config 1.1.3 → 1.1.4

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.4",
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,235 @@ 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
+ '@typescript-eslint/naming-convention': ['error', [{
61
+ selector: 'default',
62
+ format: ['camelCase', 'UPPER_CASE'],
63
+ leadingUnderscore: 'forbid',
64
+ },
65
+
66
+ {
67
+ selector: 'variable',
68
+ format: ['camelCase', 'UPPER_CASE'],
69
+ leadingUnderscore: 'forbid',
70
+ },
71
+
72
+ {
73
+ selector: 'typeLike',
74
+ format: ['PascalCase'],
75
+ }]],
76
+
62
77
  // Requires that .toString() is only called on objects which provide useful information when stringified
63
78
  '@typescript-eslint/no-base-to-string': 'warn',
64
-
79
+
65
80
  // Disallow the delete operator with computed key expressions
66
81
  '@typescript-eslint/no-dynamic-delete': 'error',
67
-
82
+
68
83
  // Disallow the declaration of empty interfaces
69
84
  '@typescript-eslint/no-empty-interface': 'warn',
70
-
85
+
71
86
  // Disallow usage of the any type
72
87
  '@typescript-eslint/no-explicit-any': ['error', { fixToUnknown: true, ignoreRestArgs: false }],
73
-
88
+
74
89
  // Disallow extra non-null assertion
75
90
  '@typescript-eslint/no-extra-non-null-assertion': 'error',
76
-
91
+
77
92
  // Forbids the use of classes as namespaces
78
93
  '@typescript-eslint/no-extraneous-class': 'error',
79
-
94
+
80
95
  // Requires Promise-like values to be handled appropriately
81
96
  '@typescript-eslint/no-floating-promises': 'warn',
82
-
97
+
83
98
  // Disallow iterating over an array with a for-in loop
84
99
  '@typescript-eslint/no-for-in-array': 'warn',
85
-
100
+
86
101
  // Disallow the use of eval()-like methods
87
102
  '@typescript-eslint/no-implied-eval': 'error',
88
-
103
+
89
104
  // Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean
90
105
  '@typescript-eslint/no-inferrable-types': 'error',
91
-
106
+
92
107
  // Disallows usage of void type outside of generic or return types
93
108
  '@typescript-eslint/no-invalid-void-type': 'error',
94
-
109
+
95
110
  // Enforce valid definition of new and constructor
96
111
  '@typescript-eslint/no-misused-new': 'error',
97
-
112
+
98
113
  // Avoid using promises in places not designed to handle them
99
114
  '@typescript-eslint/no-misused-promises': 'error',
100
-
115
+
101
116
  // Disallow the use of custom TypeScript modules and namespaces
102
117
  '@typescript-eslint/no-namespace': 'error',
103
-
118
+
104
119
  // Disallows using a non-null assertion after an optional chain expression
105
120
  '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
106
-
121
+
107
122
  // Disallows non-null assertions using the ! postfix operator
108
123
  '@typescript-eslint/no-non-null-assertion': 'error',
109
-
124
+
110
125
  // Disallow the use of parameter properties in class constructors
111
126
  '@typescript-eslint/no-parameter-properties': 'off',
112
-
127
+
113
128
  // Disallows invocation of require()
114
129
  '@typescript-eslint/no-require-imports': 'error',
115
-
130
+
116
131
  // Disallow aliasing this
117
132
  '@typescript-eslint/no-this-alias': 'warn',// wie beißt sich das mit that = this in eslint?,
118
-
133
+
119
134
  // Disallow throwing literals as exceptions
120
135
  '@typescript-eslint/no-throw-literal': 'error',
121
-
136
+
122
137
  // Disallow the use of type aliases
123
138
  // 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
-
139
+ '@typescript-eslint/no-type-alias': 'off',
140
+ '@typescript-eslint/consistent-type-definitions': ["error", "interface"],
141
+
142
+
134
143
  // Flags unnecessary equality comparisons against boolean literals
135
144
  '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
136
-
145
+
137
146
  // Prevents conditionals where the type is always truthy or always falsy
138
147
  '@typescript-eslint/no-unnecessary-condition': 'off',
139
-
148
+
140
149
  // Warns when a namespace qualifier is unnecessary
141
150
  '@typescript-eslint/no-unnecessary-qualifier': 'warn',
142
-
151
+
143
152
  // Enforces that type arguments will not be used if not required
144
153
  '@typescript-eslint/no-unnecessary-type-arguments': 'warn',
145
-
154
+
146
155
  // Warns if a type assertion does not change the type of an expression
147
156
  '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
148
-
157
+
149
158
  // Disallows assigning any to variables and properties
150
159
  '@typescript-eslint/no-unsafe-assignment': 'warn',
151
-
160
+
152
161
  // Disallows calling an any type value
153
162
  '@typescript-eslint/no-unsafe-call': 'warn',
154
-
163
+
155
164
  // Disallows member access on any typed variables
156
165
  '@typescript-eslint/no-unsafe-member-access': 'warn',
157
-
166
+
158
167
  // Disallows returning any from a function
159
168
  '@typescript-eslint/no-unsafe-return': 'warn',
160
-
169
+
161
170
  // Disallows the use of require statements except in import statements
162
171
  '@typescript-eslint/no-var-requires': 'error',
163
-
172
+
164
173
  // Prefer usage of as const over literal type
165
174
  '@typescript-eslint/prefer-as-const': 'warn',
166
-
175
+
167
176
  // Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated
168
177
  '@typescript-eslint/prefer-for-of': 'warn',
169
-
178
+
170
179
  // Use function types instead of interfaces with call signatures
171
180
  '@typescript-eslint/prefer-function-type': 'warn',
172
-
181
+
173
182
  // Enforce includes method over indexOf method
174
183
  '@typescript-eslint/prefer-includes': 'warn',
175
-
184
+
176
185
  // Require the use of the namespace keyword instead of the module keyword to declare custom TypeScript modules
177
186
  '@typescript-eslint/prefer-namespace-keyword': 'error',
178
-
187
+
179
188
  // Enforce the usage of the nullish coalescing operator instead of logical chaining
180
189
  '@typescript-eslint/prefer-nullish-coalescing': 'warn',
181
-
190
+
182
191
  // Prefer using concise optional chain expressions instead of chained logical ands
183
192
  '@typescript-eslint/prefer-optional-chain': 'warn',
184
-
193
+
185
194
  // Requires that private members are marked as readonly if they're never modified outside of the constructor
186
195
  '@typescript-eslint/prefer-readonly': 'warn',
187
-
196
+
188
197
  // Requires that function parameters are typed as readonly to prevent accidental mutation of inputs
189
198
  '@typescript-eslint/prefer-readonly-parameter-types': 'off',
190
-
199
+
191
200
  // Prefer using type parameter when calling Array#reduce instead of casting
192
201
  '@typescript-eslint/prefer-reduce-type-parameter': 'error',
193
-
202
+
194
203
  // Enforce that RegExp#exec is used instead of String#match if no global flag is provided
195
204
  '@typescript-eslint/prefer-regexp-exec': 'warn',
196
-
205
+
197
206
  // Enforce the use of String#startsWith and String#endsWith instead of other equivalent methods of checking substrings
198
207
  '@typescript-eslint/prefer-string-starts-ends-with': 'warn',
199
-
208
+
200
209
  // Recommends using // @ts-expect-error over // @ts-ignore
201
210
  '@typescript-eslint/prefer-ts-expect-error': 'off', // cool aber TS >= 3.9,
202
-
211
+
203
212
  // Requires any function or method that returns a Promise to be marked async
204
213
  '@typescript-eslint/promise-function-async': ['error', { checkArrowFunctions: false, checkFunctionExpressions: false }],
205
-
214
+
206
215
  // Requires Array#sort calls to always provide a compareFunction
207
216
  '@typescript-eslint/require-array-sort-compare': ['warn', { 'ignoreStringArrays': true }],
208
-
217
+
209
218
  // When adding two variables, operands must both be of type number or of type string
210
219
  '@typescript-eslint/restrict-plus-operands': 'error',
211
-
220
+
212
221
  // Enforce template literal expressions to be of string type
213
222
  '@typescript-eslint/restrict-template-expressions': 'off', // (oder warn mit allen options an),
214
-
223
+
215
224
  // Restricts the types allowed in boolean expressions
216
225
  '@typescript-eslint/strict-boolean-expressions': 'warn',
217
-
226
+
218
227
  // Exhaustiveness checking in switch with union type
219
228
  '@typescript-eslint/switch-exhaustiveness-check': 'error',
220
-
229
+
221
230
  // Sets preference level for triple slash directives versus ES6-style import declarations
222
231
  '@typescript-eslint/triple-slash-reference': ['error', { 'path': 'never', 'types': 'never', 'lib': 'never' }],
223
-
232
+
224
233
  // Require consistent spacing around type annotations
225
234
  '@typescript-eslint/type-annotation-spacing': 'error',
226
-
235
+
227
236
  // Requires type annotations to exist
228
237
  '@typescript-eslint/typedef': 'off', // compiler noImplicitAny
229
-
238
+
230
239
  // Enforces unbound methods are called with their expected scope
231
- '@typescript-eslint/unbound-method': ['warn', {'ignoreStatic': true}],
232
-
240
+ '@typescript-eslint/unbound-method': ['warn', { 'ignoreStatic': true }],
241
+
233
242
  // Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter
234
243
  '@typescript-eslint/unified-signatures': 'warn',
235
244
 
@@ -247,103 +256,103 @@ module.exports = {
247
256
  // Enforce consistent brace style for blocks
248
257
  'brace-style': 'off',
249
258
  '@typescript-eslint/brace-style': 'error',
250
-
259
+
251
260
  // Enforces consistent spacing before and after commas
252
261
  'comma-spacing': 'off',
253
262
  '@typescript-eslint/comma-spacing': ['error', { 'before': false, 'after': true }],
254
-
263
+
255
264
  // Enforce default parameters to be last
256
265
  'default-param-last': 'off',
257
266
  '@typescript-eslint/default-param-last': 'error',
258
-
267
+
259
268
  // enforce dot notation whenever possible
260
269
  'dot-notation': 'off',
261
270
  '@typescript-eslint/dot-notation': 'off',
262
-
271
+
263
272
  // Require or disallow spacing between function identifiers and their invocations
264
273
  'func-call-spacing': 'off',
265
274
  '@typescript-eslint/func-call-spacing': 'error',
266
-
275
+
267
276
  // Enforce consistent indentation
268
277
  'indent': 'off',
269
278
  '@typescript-eslint/indent': ["error", 2, { "SwitchCase": 1 }],
270
-
279
+
271
280
  // require or disallow initialization in variable declarations
272
281
  'init-declarations': 'off',
273
282
  '@typescript-eslint/init-declarations': 'off',
274
-
283
+
275
284
  // Enforce consistent spacing before and after keywords
276
285
  'keyword-spacing': 'off',
277
286
  '@typescript-eslint/keyword-spacing': 'error',
278
-
287
+
279
288
  // Require or disallow an empty line between class members
280
289
  'lines-between-class-members': 'off',
281
290
  '@typescript-eslint/lines-between-class-members': ['error', 'always', { 'exceptAfterSingleLine': true }],
282
-
291
+
283
292
  // Disallow generic Array constructors
284
293
  'no-array-constructor': 'off',
285
294
  '@typescript-eslint/no-array-constructor': 'error',
286
-
295
+
287
296
  // Disallow duplicate class members
288
297
  'no-dupe-class-members': 'off',
289
298
  '@typescript-eslint/no-dupe-class-members': 'error',
290
-
299
+
291
300
  // Disallow empty functions
292
301
  'no-empty-function': 'off',
293
302
  '@typescript-eslint/no-empty-function': 'off',
294
-
303
+
295
304
  // Disallow unnecessary parentheses
296
305
  "no-extra-parens": "off",
297
- "@typescript-eslint/no-extra-parens": ["warn", "all", { "conditionalAssign": false , "returnAssign": false, "nestedBinaryExpressions": false }],
298
-
306
+ "@typescript-eslint/no-extra-parens": ["warn", "all", { "conditionalAssign": false, "returnAssign": false, "nestedBinaryExpressions": false }],
307
+
299
308
  // Disallow unnecessary semicolons
300
309
  'no-extra-semi': 'off',
301
310
  '@typescript-eslint/no-extra-semi': 'warn',
302
-
311
+
303
312
  // disallow this keywords outside of classes or class-like objects
304
313
  'no-invalid-this': 'off',
305
314
  '@typescript-eslint/no-invalid-this': 'error',
306
-
315
+
307
316
  // Disallow magic numbers
308
317
  'no-magic-numbers': 'off',
309
318
  '@typescript-eslint/no-magic-numbers': 'off',
310
-
319
+
311
320
  // Disallow unused expressions
312
321
  'no-unused-expressions': 'off',
313
322
  '@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
314
-
323
+
315
324
  // Disallow unused variables
316
325
  'no-unused-vars': 'off',
317
326
  '@typescript-eslint/no-unused-vars': 'error',
318
-
327
+
319
328
  // Disallow the use of variables before they are defined
320
329
  'no-use-before-define': 'off',
321
330
  '@typescript-eslint/no-use-before-define': 'warn',
322
-
331
+
323
332
  // Disallow unnecessary constructors
324
333
  'no-useless-constructor': 'off',
325
334
  '@typescript-eslint/no-useless-constructor': 'warn',
326
-
335
+
327
336
  // Enforce the consistent use of either backticks, double, or single quotes
328
337
  'quotes': 'off',
329
338
  '@typescript-eslint/quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
330
-
339
+
331
340
  // Disallow async functions which have no await expression
332
341
  'require-await': 'off',
333
342
  '@typescript-eslint/require-await': 'error',
334
-
343
+
335
344
  // Enforces consistent returning of awaited values
336
345
  'no-return-await': 'off',
337
346
  '@typescript-eslint/return-await': 'warn',
338
-
347
+
339
348
  // Require or disallow semicolons instead of ASI
340
349
  'semi': 'off',
341
350
  '@typescript-eslint/semi': ['error', 'always'],
342
-
351
+
343
352
  // Enforces consistent spacing before function parenthesis
344
353
  'space-before-function-paren': 'off',
345
- '@typescript-eslint/space-before-function-paren': ['error', {'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always'}],
346
-
354
+ '@typescript-eslint/space-before-function-paren': ['error', { 'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always' }],
355
+
347
356
  },
348
357
  overrides: [
349
358
  {
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
  };