@cenk1cenk2/eslint-config 2.7.59 → 3.0.0

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/typescript.js CHANGED
@@ -1,336 +1,258 @@
1
- /** @type {import("eslint").Linter.Config} */
2
- module.exports = {
3
- extends: [ './index' ],
4
- overrides: [
5
- {
6
- files: [ '*.ts', '*.tsx' ],
7
- plugins: [ '@typescript-eslint' ],
8
- extends: [ 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended' ],
9
- parserOptions: {},
10
- rules: {
11
- // this is a bit buggy at the moment
12
- '@typescript-eslint/explicit-module-boundary-types': 'off',
13
- '@typescript-eslint/explicit-function-return-type': [
14
- 'error',
15
- {
16
- allowExpressions: false,
17
- allowTypedFunctionExpressions: true,
18
- allowHigherOrderFunctions: true,
19
- allowDirectConstAssertionInArrowFunctions: true,
20
- allowConciseArrowFunctionExpressionsStartingWithVoid: false
21
- }
22
- ],
23
- '@typescript-eslint/no-unused-vars': 'error',
24
- '@typescript-eslint/ban-ts-ignore': 'off',
25
- '@typescript-eslint/explicit-member-accessibility': [
26
- 'error',
27
- {
28
- accessibility: 'explicit',
29
- overrides: {
30
- accessors: 'off',
31
- constructors: 'no-public',
32
- methods: 'explicit',
33
- properties: 'off',
34
- parameterProperties: 'off'
35
- }
36
- }
37
- ],
38
- '@typescript-eslint/interface-name-prefix': 'off',
39
- '@typescript-eslint/member-delimiter-style': [
40
- 'error',
41
- {
42
- multiline: {
43
- delimiter: 'none',
44
- requireLast: true
45
- },
46
- singleline: {
47
- delimiter: 'comma',
48
- requireLast: false
49
- }
50
- }
51
- ],
52
- '@typescript-eslint/no-var-requires': 'off',
53
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
54
- '@typescript-eslint/brace-style': [
55
- 'error',
56
- '1tbs',
57
- {
58
- allowSingleLine: true
1
+ import StylisticPlugin from '@stylistic/eslint-plugin'
2
+ import TypescriptEslintPlugin from '@typescript-eslint/eslint-plugin'
3
+
4
+ import base from './base.js'
5
+
6
+ /** @type {import("eslint").Linter.Config[]} */
7
+ export default [
8
+ ...base,
9
+ {
10
+ files: ['*.ts', '*.tsx'],
11
+ plugins: {
12
+ 'stylestic': StylisticPlugin,
13
+ '@typescript-eslint': TypescriptEslintPlugin
14
+ },
15
+ extends: ['plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended'],
16
+ parserOptions: {},
17
+ rules: {
18
+ // this is a bit buggy at the moment
19
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
20
+ '@typescript-eslint/explicit-function-return-type': [
21
+ 'error',
22
+ {
23
+ allowExpressions: false,
24
+ allowTypedFunctionExpressions: true,
25
+ allowHigherOrderFunctions: true,
26
+ allowDirectConstAssertionInArrowFunctions: true,
27
+ allowConciseArrowFunctionExpressionsStartingWithVoid: false
28
+ }
29
+ ],
30
+ '@typescript-eslint/no-unused-vars': 'error',
31
+ '@typescript-eslint/explicit-member-accessibility': [
32
+ 'error',
33
+ {
34
+ accessibility: 'explicit',
35
+ overrides: {
36
+ accessors: 'off',
37
+ constructors: 'no-public',
38
+ methods: 'explicit',
39
+ properties: 'off',
40
+ parameterProperties: 'off'
59
41
  }
60
- ],
61
- '@typescript-eslint/member-ordering': [
62
- 'warn',
63
- {
64
- default: [
65
- // Index signature
66
- 'signature',
42
+ }
43
+ ],
44
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
45
+ '@typescript-eslint/member-ordering': [
46
+ 'warn',
47
+ {
48
+ default: [
49
+ // Index signature
50
+ 'signature',
67
51
 
68
- // Fields
69
- 'public-static-field',
70
- 'protected-static-field',
71
- 'private-static-field',
52
+ // Fields
53
+ 'public-static-field',
54
+ 'protected-static-field',
55
+ 'private-static-field',
72
56
 
73
- 'public-instance-field',
74
- 'public-decorated-field',
75
- 'protected-instance-field',
76
- 'protected-decorated-field',
77
- 'private-instance-field',
78
- 'private-decorated-field',
57
+ 'public-instance-field',
58
+ 'public-decorated-field',
59
+ 'protected-instance-field',
60
+ 'protected-decorated-field',
61
+ 'private-instance-field',
62
+ 'private-decorated-field',
79
63
 
80
- 'public-abstract-field',
81
- 'protected-abstract-field',
64
+ 'public-abstract-field',
65
+ 'protected-abstract-field',
82
66
 
83
- 'public-field',
84
- 'protected-field',
85
- 'private-field',
67
+ 'public-field',
68
+ 'protected-field',
69
+ 'private-field',
86
70
 
87
- 'static-field',
88
- 'instance-field',
89
- 'abstract-field',
71
+ 'static-field',
72
+ 'instance-field',
73
+ 'abstract-field',
90
74
 
91
- 'decorated-field',
75
+ 'decorated-field',
92
76
 
93
- 'field',
77
+ 'field',
94
78
 
95
- // Constructors
96
- 'public-constructor',
97
- 'protected-constructor',
98
- 'private-constructor',
79
+ // Constructors
80
+ 'public-constructor',
81
+ 'protected-constructor',
82
+ 'private-constructor',
99
83
 
100
- 'constructor',
84
+ 'constructor',
101
85
 
102
- // Getters
103
- // 'public-static-get',
104
- // 'protected-static-get',
105
- // 'private-static-get',
106
- //
107
- // 'public-instance-get',
108
- // 'public-decorated-get',
109
- // 'protected-instance-get',
110
- // 'protected-decorated-get',
111
- // 'private-instance-get',
112
- // 'private-decorated-get',
113
- //
114
- // 'public-abstract-get',
115
- // 'protected-abstract-get',
116
- // 'private-abstract-get',
117
- //
118
- // 'public-get',
119
- // 'protected-get',
120
- // 'private-get',
121
- //
122
- // 'static-get',
123
- // 'instance-get',
124
- // 'abstract-get',
125
- //
126
- // 'decorated-get',
86
+ // Getters
87
+ // 'public-static-get',
88
+ // 'protected-static-get',
89
+ // 'private-static-get',
90
+ //
91
+ // 'public-instance-get',
92
+ // 'public-decorated-get',
93
+ // 'protected-instance-get',
94
+ // 'protected-decorated-get',
95
+ // 'private-instance-get',
96
+ // 'private-decorated-get',
97
+ //
98
+ // 'public-abstract-get',
99
+ // 'protected-abstract-get',
100
+ // 'private-abstract-get',
101
+ //
102
+ // 'public-get',
103
+ // 'protected-get',
104
+ // 'private-get',
105
+ //
106
+ // 'static-get',
107
+ // 'instance-get',
108
+ // 'abstract-get',
109
+ //
110
+ // 'decorated-get',
127
111
 
128
- // 'get',
112
+ // 'get',
129
113
 
130
- // Setters
131
- // 'public-static-set',
132
- // 'protected-static-set',
133
- // 'private-static-set',
134
- //
135
- // 'public-instance-set',
136
- // 'public-decorated-set',
137
- // 'protected-instance-set',
138
- // 'protected-decorated-set',
139
- // 'private-instance-set',
140
- // 'private-decorated-set',
141
- //
142
- // 'public-abstract-set',
143
- // 'protected-abstract-set',
144
- // 'private-abstract-set',
145
- //
146
- // 'public-set',
147
- // 'protected-set',
148
- // 'private-set',
149
- //
150
- // 'static-set',
151
- // 'instance-set',
152
- // 'abstract-set',
153
- //
154
- // 'decorated-set',
114
+ // Setters
115
+ // 'public-static-set',
116
+ // 'protected-static-set',
117
+ // 'private-static-set',
118
+ //
119
+ // 'public-instance-set',
120
+ // 'public-decorated-set',
121
+ // 'protected-instance-set',
122
+ // 'protected-decorated-set',
123
+ // 'private-instance-set',
124
+ // 'private-decorated-set',
125
+ //
126
+ // 'public-abstract-set',
127
+ // 'protected-abstract-set',
128
+ // 'private-abstract-set',
129
+ //
130
+ // 'public-set',
131
+ // 'protected-set',
132
+ // 'private-set',
133
+ //
134
+ // 'static-set',
135
+ // 'instance-set',
136
+ // 'abstract-set',
137
+ //
138
+ // 'decorated-set',
155
139
 
156
- // 'set',
140
+ // 'set',
157
141
 
158
- // Methods
159
- // 'public-static-method',
160
- // 'protected-static-method',
161
- // 'private-static-method',
162
- //
163
- // 'public-instance-method',
164
- // 'protected-instance-method',
165
- // 'private-instance-method',
166
- 'static-method',
142
+ // Methods
143
+ // 'public-static-method',
144
+ // 'protected-static-method',
145
+ // 'private-static-method',
146
+ //
147
+ // 'public-instance-method',
148
+ // 'protected-instance-method',
149
+ // 'private-instance-method',
150
+ 'static-method',
167
151
 
168
- 'public-method',
169
- // 'public-decorated-method',
170
- 'protected-method',
171
- // 'protected-decorated-method',
172
- 'private-method',
173
- // 'private-decorated-method',
152
+ 'public-method',
153
+ // 'public-decorated-method',
154
+ 'protected-method',
155
+ // 'protected-decorated-method',
156
+ 'private-method',
157
+ // 'private-decorated-method',
174
158
 
175
- 'public-abstract-method',
176
- 'protected-abstract-method',
159
+ 'public-abstract-method',
160
+ 'protected-abstract-method',
177
161
 
178
- // 'instance-method',
179
- // 'decorated-method',
180
- 'abstract-method',
162
+ // 'instance-method',
163
+ // 'decorated-method',
164
+ 'abstract-method',
181
165
 
182
- 'method'
183
- ]
184
- }
185
- ],
186
- '@typescript-eslint/no-explicit-any': 'off',
187
- camelcase: 'off',
188
- '@typescript-eslint/naming-convention': [
189
- 'error',
190
- {
191
- selector: 'default',
192
- format: [ 'camelCase', 'PascalCase' ]
193
- },
166
+ 'method'
167
+ ]
168
+ }
169
+ ],
170
+ '@typescript-eslint/no-explicit-any': 'off',
171
+ camelcase: 'off',
172
+ '@typescript-eslint/naming-convention': [
173
+ 'error',
174
+ {
175
+ selector: 'default',
176
+ format: ['camelCase', 'PascalCase']
177
+ },
194
178
 
195
- {
196
- selector: 'variable',
197
- modifiers: [ 'const' ],
198
- format: [ 'camelCase', 'UPPER_CASE', 'PascalCase' ]
199
- },
179
+ {
180
+ selector: 'variable',
181
+ modifiers: ['const'],
182
+ format: ['camelCase', 'UPPER_CASE', 'PascalCase']
183
+ },
200
184
 
201
- {
202
- selector: 'variable',
203
- format: [ 'camelCase' ]
204
- },
185
+ {
186
+ selector: 'variable',
187
+ format: ['camelCase']
188
+ },
205
189
 
206
- {
207
- selector: 'function',
208
- format: [ 'camelCase', 'PascalCase' ]
209
- },
190
+ {
191
+ selector: 'function',
192
+ format: ['camelCase', 'PascalCase']
193
+ },
210
194
 
211
- {
212
- selector: 'parameter',
213
- format: [ 'camelCase', 'PascalCase' ],
214
- modifiers: [ 'unused' ],
215
- leadingUnderscore: 'require'
216
- },
195
+ {
196
+ selector: 'parameter',
197
+ format: ['camelCase', 'PascalCase'],
198
+ modifiers: ['unused'],
199
+ leadingUnderscore: 'require'
200
+ },
217
201
 
218
- {
219
- selector: 'parameter',
220
- format: [ 'camelCase', 'PascalCase' ]
221
- },
202
+ {
203
+ selector: 'parameter',
204
+ format: ['camelCase', 'PascalCase']
205
+ },
222
206
 
223
- {
224
- selector: 'property',
225
- format: [ 'camelCase', 'UPPER_CASE', 'snake_case' ]
226
- },
207
+ {
208
+ selector: 'property',
209
+ format: ['camelCase', 'UPPER_CASE', 'snake_case']
210
+ },
227
211
 
228
- {
229
- selector: 'memberLike',
230
- modifiers: [ 'private' ],
231
- format: [ 'camelCase' ]
232
- },
212
+ {
213
+ selector: 'memberLike',
214
+ modifiers: ['private'],
215
+ format: ['camelCase']
216
+ },
233
217
 
234
- {
235
- selector: 'enumMember',
236
- format: [ 'UPPER_CASE', 'camelCase' ]
237
- },
218
+ {
219
+ selector: 'enumMember',
220
+ format: ['UPPER_CASE', 'camelCase']
221
+ },
238
222
 
239
- {
240
- selector: 'typeLike',
241
- format: [ 'PascalCase' ]
242
- }
243
- ],
244
- '@typescript-eslint/no-parameter-properties': 'off',
245
- 'func-call-spacing': 'off',
246
- '@typescript-eslint/func-call-spacing': [ 'error' ],
247
- '@typescript-eslint/prefer-for-of': 'warn',
248
- '@typescript-eslint/prefer-function-type': 'error',
249
- 'space-before-function-paren': 'off',
250
- '@typescript-eslint/space-before-function-paren': [ 'error' ],
251
- 'no-extra-parens': 'off',
252
- '@typescript-eslint/no-extra-parens': [ 'error' ],
253
- '@typescript-eslint/comma-spacing': [
254
- 'error',
255
- {
256
- before: false,
257
- after: true
258
- }
259
- ],
260
- '@typescript-eslint/indent': [
261
- 'error',
262
- 2,
263
- {
264
- ignoreComments: false
265
- }
266
- ],
267
- '@typescript-eslint/quotes': [ 'error', 'single' ],
268
- '@typescript-eslint/semi': [ 'error', 'never' ],
269
- '@typescript-eslint/unified-signatures': 'error',
270
- '@typescript-eslint/no-use-before-define': 'off',
271
- '@typescript-eslint/array-type': [ 'error', { default: 'array' } ],
272
- '@typescript-eslint/consistent-indexed-object-style': [ 'error', 'record' ],
273
- '@typescript-eslint/consistent-type-assertions': [ 'error', { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' } ],
274
- '@typescript-eslint/consistent-type-definitions': [ 'error', 'interface' ],
275
- '@typescript-eslint/method-signature-style': [ 'error', 'property' ],
276
- '@typescript-eslint/no-empty-interface': [
277
- 'error',
278
- {
279
- allowSingleExtends: true
280
- }
281
- ],
282
- '@typescript-eslint/no-extra-non-null-assertion': [ 'error' ],
283
- '@typescript-eslint/no-extraneous-class': [
284
- 'error',
285
- {
286
- allowConstructorOnly: true,
287
- allowEmpty: false,
288
- allowStaticOnly: true,
289
- allowWithDecorator: true
290
- }
291
- ],
292
- '@typescript-eslint/no-inferrable-types': 'error',
293
- '@typescript-eslint/no-misused-new': 'error',
294
- '@typescript-eslint/prefer-enum-initializers': 'error',
295
- 'keyword-spacing': 'off',
296
- '@typescript-eslint/keyword-spacing': [ 'error' ],
297
- 'lines-between-class-members': 'off',
298
- '@typescript-eslint/lines-between-class-members': [ 'off' ],
299
- 'padding-line-between-statements': 'off',
300
- '@typescript-eslint/padding-line-between-statements': [
301
- 'error',
302
- {
303
- blankLine: 'always',
304
- prev: '*',
305
- next: 'return'
306
- },
307
- {
308
- blankLine: 'always',
309
- prev: [ 'const', 'let', 'var' ],
310
- next: '*'
311
- },
312
- {
313
- blankLine: 'any',
314
- prev: [ 'const', 'let', 'var' ],
315
- next: [ 'const', 'let', 'var' ]
316
- },
317
- {
318
- blankLine: 'always',
319
- prev: [ 'case', 'default' ],
320
- next: '*'
321
- },
322
- {
323
- blankLine: 'always',
324
- prev: '*',
325
- next: [ 'interface', 'type' ]
326
- },
327
- {
328
- blankLine: 'always',
329
- prev: '*',
330
- next: [ 'function', 'if', 'try', 'break', 'class', 'for', 'while', 'do' ]
331
- }
332
- ]
333
- }
223
+ {
224
+ selector: 'typeLike',
225
+ format: ['PascalCase']
226
+ }
227
+ ],
228
+ '@typescript-eslint/prefer-for-of': 'warn',
229
+ '@typescript-eslint/prefer-function-type': 'error',
230
+ '@typescript-eslint/unified-signatures': 'error',
231
+ '@typescript-eslint/no-use-before-define': 'off',
232
+ '@typescript-eslint/array-type': ['error', { default: 'array' } ],
233
+ '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
234
+ '@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' } ],
235
+ '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
236
+ '@typescript-eslint/method-signature-style': ['error', 'property'],
237
+ '@typescript-eslint/no-empty-object-type': [
238
+ 'error',
239
+ {
240
+ allowInterfaces: 'with-single-extends'
241
+ }
242
+ ],
243
+ '@typescript-eslint/no-extra-non-null-assertion': ['error'],
244
+ '@typescript-eslint/no-extraneous-class': [
245
+ 'error',
246
+ {
247
+ allowConstructorOnly: true,
248
+ allowEmpty: false,
249
+ allowStaticOnly: true,
250
+ allowWithDecorator: true
251
+ }
252
+ ],
253
+ '@typescript-eslint/no-inferrable-types': 'error',
254
+ '@typescript-eslint/no-misused-new': 'error',
255
+ '@typescript-eslint/prefer-enum-initializers': 'error'
334
256
  }
335
- ]
336
- }
257
+ }
258
+ ]
package/utils.js CHANGED
@@ -1,15 +1,14 @@
1
- const { loadTsConfig } = require('load-tsconfig')
2
-
3
- const { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS } = require('./constants')
1
+ import { loadTsConfig } from 'load-tsconfig'
2
+ import ImportPlugin from 'eslint-plugin-import'
4
3
 
5
4
  /**
6
- * @param {{ paths?: string[] tsconfig?: string, tsconfigDir?: string}} options
5
+ * @param {{ paths?: string[], tsconfig?: string, tsconfigDir?: string}} options
7
6
  * @returns {import("eslint").Linter.Config['rules']}
8
7
  */
9
- function generateImportGroups (options) {
10
- const defaults = [ '@cenk1cenk2', '@cenk1cenk2-*' ]
8
+ export function generateImportGroups(options) {
9
+ const defaults = ['@cenk1cenk2', '@cenk1cenk2-*']
11
10
 
12
- options.paths = Array.isArray(options.paths) ? [ ...options.paths, ...defaults ] : defaults
11
+ options.paths = Array.isArray(options.paths) ? [...options.paths, ...defaults] : defaults
13
12
 
14
13
  /** @type {string[]} */
15
14
  let tsConfigPaths = []
@@ -55,10 +54,10 @@ function generateImportGroups (options) {
55
54
  ]
56
55
  }, [])
57
56
  ],
58
- pathGroupsExcludedImportTypes: [ 'builtin' ],
57
+ pathGroupsExcludedImportTypes: ['builtin'],
59
58
  groups: [
60
- [ 'builtin', 'external' ],
61
- [ 'index', 'parent', 'sibling' ]
59
+ ['builtin', 'external'],
60
+ ['index', 'parent', 'sibling']
62
61
  ],
63
62
  'newlines-between': 'always',
64
63
  alphabetize: {
@@ -71,17 +70,16 @@ function generateImportGroups (options) {
71
70
  }
72
71
 
73
72
  /**
74
- * @param {{ paths?: string[] tsconfig?: string, tsconfigDir?: string}} options
75
- * @returns {import("eslint").Linter.ConfigOverride}
73
+ * @param {{ paths?: string[], tsconfig?: string, tsconfigDir?: string}} options
74
+ * @returns {import("eslint").Linter.Config[]}
76
75
  */
77
- function generateImportGroupsWithOverride (options) {
76
+ export function generateImportGroupsWithOverride(options) {
78
77
  return [
79
78
  {
80
- files: ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS,
81
- plugins: [ 'import' ],
79
+ plugins: {
80
+ import: ImportPlugin
81
+ },
82
82
  rules: generateImportGroups(options)
83
83
  }
84
84
  ]
85
85
  }
86
-
87
- module.exports = { generateImportGroups, generateImportGroupsWithOverride }
package/vue-typescript.js CHANGED
@@ -1,11 +1,8 @@
1
- /** @type {import("eslint").Linter.Config} */
2
- module.exports = {
3
- extends: [ './index', './typescript' ],
4
- overrides: [
5
- {
6
- files: [ '*.vue' ],
7
- extends: [ './index', '@nuxtjs/eslint-config-typescript/index' ],
8
- rules: {}
9
- }
10
- ]
11
- }
1
+ /** @type {import("eslint").Linter.Config[]} */
2
+ export default [
3
+ {
4
+ files: ['*.vue'],
5
+ extends: ['./index', '@nuxtjs/eslint-config-typescript/index'],
6
+ rules: {}
7
+ }
8
+ ]