@cenk1cenk2/eslint-config 1.0.8 → 2.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/.prettierrc.js CHANGED
@@ -1,6 +1,10 @@
1
+ /** @type {import("prettier").Config} */
1
2
  module.exports = {
2
3
  printWidth: 179,
3
4
  tabWidth: 2,
5
+ useTabs: false,
6
+ quoteProps: 'as-needed',
7
+ vueIndentScriptAndStyle: true,
4
8
  semi: false,
5
9
  singleQuote: true,
6
10
  trailingComma: 'none',
package/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ # [2.0.0](https://github.com/cenk1cenk2/eslint-config/compare/v1.0.11...v2.0.0) (2022-01-30)
2
+
3
+
4
+ ### Performance Improvements
5
+
6
+ * add new rules ([59c4714](https://github.com/cenk1cenk2/eslint-config/commit/59c47148c074652f6edb401af3c3df69d963cc9c))
7
+ * change lots of options ([797a915](https://github.com/cenk1cenk2/eslint-config/commit/797a915576e982ac4bc3a858a196ddcd45d343f9))
8
+
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ * should introduce some breaking changes for many projects
13
+ * may not work with older repositories
14
+
15
+ ## [1.0.11](https://github.com/cenk1cenk2/eslint-config/compare/v1.0.10...v1.0.11) (2022-01-09)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **deps:** update all slow ring [@weekly](https://github.com/weekly) ([17e2473](https://github.com/cenk1cenk2/eslint-config/commit/17e24734836f0fd7b6c112f2a1027e55efe24101))
21
+
22
+ ## [1.0.10](https://github.com/cenk1cenk2/eslint-config/compare/v1.0.9...v1.0.10) (2022-01-04)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **deps:** update dependency eslint-plugin-import to ^2.25.4 ([7eec94a](https://github.com/cenk1cenk2/eslint-config/commit/7eec94a4f7a44de23d1ff3b0702a24ac55aac5e9))
28
+
29
+ ## [1.0.9](https://github.com/cenk1cenk2/eslint-config/compare/v1.0.8...v1.0.9) (2021-11-21)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * **deps:** update all slow ring [@weekly](https://github.com/weekly) ([32afb04](https://github.com/cenk1cenk2/eslint-config/commit/32afb04e05c0c725d8688f87b06afed6155da9d5))
35
+
1
36
  ## [1.0.8](https://github.com/cenk1cenk2/eslint-config/compare/v1.0.7...v1.0.8) (2021-11-10)
2
37
 
3
38
 
package/README.md CHANGED
@@ -4,47 +4,25 @@
4
4
 
5
5
  <!-- toc -->
6
6
 
7
+ - [Supported Functionality](#supported-functionality)
7
8
  - [Extend Typescript Import Path Order](#extend-typescript-import-path-order)
8
- - [moer headers](#moer-headers)
9
- - [for test](#for-test)
10
9
 
11
10
  <!-- tocstop -->
12
11
 
13
12
  ## Supported Functionality
14
13
 
15
- ```
16
- default -> javascript
17
- react-typescript
18
- typescript
19
- ```
14
+ - JavaScript
15
+ - TypeScript
16
+ - Imports
17
+ - Vue
18
+ - React
19
+ - Next
20
+ - Nuxt
20
21
 
21
22
  ## Extend Typescript Import Path Order
22
23
 
23
24
  ```javascript
24
25
  module.exports = {
25
- extends: ['@cenk1cenk2/eslint-config/typescript'],
26
- rules: {
27
- 'import/order': [
28
- 'error',
29
- {
30
- pathGroups: [
31
- {
32
- pattern: '@root/**',
33
- group: 'parent'
34
- }
35
- ],
36
- pathGroupsExcludedImportTypes: ['builtin'],
37
- groups: [
38
- ['builtin', 'external'],
39
- ['index', 'parent', 'sibling']
40
- ],
41
- 'newlines-between': 'always',
42
- alphabetize: {
43
- order: 'asc',
44
- caseInsensitive: true
45
- }
46
- }
47
- ]
48
- }
26
+ extends: ['@cenk1cenk2/eslint-config']
49
27
  }
50
28
  ```
package/import.js ADDED
@@ -0,0 +1,44 @@
1
+ /** @type {import("eslint").Linter.Config} */
2
+ module.exports = {
3
+ plugins: [ 'import' ],
4
+ rules: {
5
+ 'sort-imports': 'off',
6
+ 'import/first': 'error',
7
+ 'import/newline-after-import': 'error',
8
+ 'import/no-duplicates': 'error',
9
+ 'import/order': [
10
+ 'error',
11
+ {
12
+ pathGroups: [
13
+ {
14
+ pattern: '@{cenk1cenk2,cenk1cenk2-*}/**',
15
+ group: 'index'
16
+ },
17
+ {
18
+ pattern: '@{src,interfaces,utils,constants,commands}/**',
19
+ group: 'index'
20
+ },
21
+ {
22
+ pattern: '@{src,interfaces,utils,constants,commands}',
23
+ group: 'index'
24
+ }
25
+ ],
26
+ pathGroupsExcludedImportTypes: [ 'builtin' ],
27
+ groups: [
28
+ [ 'builtin', 'external' ],
29
+ [ 'index', 'parent', 'sibling' ]
30
+ ],
31
+ 'newlines-between': 'always',
32
+ alphabetize: {
33
+ order: 'asc',
34
+ caseInsensitive: true
35
+ }
36
+ }
37
+ ],
38
+ 'import/export': 'error',
39
+ 'import/exports-last': 'error',
40
+ 'import/no-extraneous-dependencies': 'error',
41
+ 'import/no-self-import': 'error',
42
+ 'import/no-useless-path-segments': 'error'
43
+ }
44
+ }
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  env: {
3
4
  browser: true,
@@ -9,36 +10,11 @@ module.exports = {
9
10
  ecmaVersion: 'latest',
10
11
  sourceType: 'module'
11
12
  },
12
- plugins: [ 'import' ],
13
- extends: [ 'eslint:recommended' ],
13
+ extends: [ 'eslint:recommended', './import' ],
14
14
  rules: {
15
15
  semi: [ 'error', 'never' ],
16
16
  'linebreak-style': [ 'error', 'unix' ],
17
17
  'sort-imports': 'off',
18
- 'import/first': 'error',
19
- 'import/newline-after-import': 'error',
20
- 'import/no-duplicates': 'error',
21
- 'import/order': [
22
- 'error',
23
- {
24
- pathGroups: [
25
- {
26
- pattern: '@src/**',
27
- group: 'index'
28
- }
29
- ],
30
- pathGroupsExcludedImportTypes: [ 'builtin' ],
31
- groups: [
32
- [ 'builtin', 'external' ],
33
- [ 'index', 'parent', 'sibling' ]
34
- ],
35
- 'newlines-between': 'always',
36
- alphabetize: {
37
- order: 'asc',
38
- caseInsensitive: true
39
- }
40
- }
41
- ],
42
18
  indent: [ 'error', 2 ],
43
19
  'brace-style': [ 'error', '1tbs', { allowSingleLine: true } ],
44
20
  'comma-spacing': [ 'error', { before: false, after: true } ],
@@ -129,6 +105,26 @@ module.exports = {
129
105
  'spaced-comment': 'error',
130
106
  'use-isnan': 'error',
131
107
  'valid-typeof': 'warn',
132
- 'arrow-parens': [ 'error', 'always' ]
108
+ 'arrow-parens': [ 'error', 'always' ],
109
+ 'keyword-spacing': 'error',
110
+ 'lines-between-class-members': 'error',
111
+ 'padding-line-between-statements': [
112
+ 'error',
113
+ {
114
+ blankLine: 'always',
115
+ prev: '*',
116
+ next: 'return'
117
+ },
118
+ {
119
+ blankLine: 'always',
120
+ prev: [ 'const', 'let', 'var' ],
121
+ next: '*'
122
+ },
123
+ {
124
+ blankLine: 'always',
125
+ prev: [ 'case', 'default' ],
126
+ next: '*'
127
+ }
128
+ ]
133
129
  }
134
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/eslint-config",
3
- "version": "1.0.8",
3
+ "version": "2.0.0",
4
4
  "description": "Eslint configuration for my taste.",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/cenk1cenk2/eslint-config",
@@ -15,32 +15,50 @@
15
15
  "prepare-commit-msg": "[ -t 1 ] && exec < /dev/tty && git cz --hook || true"
16
16
  },
17
17
  "lint-staged": {
18
- "./*.{ts,js,tsx,jsx}": [
18
+ "*.{ts,js,tsx,jsx}": [
19
19
  "prettier --loglevel warn --write",
20
20
  "eslint --fix"
21
21
  ],
22
- "./*.{json,md}": [
22
+ "*.{json,md}": [
23
23
  "prettier --write"
24
24
  ]
25
25
  },
26
26
  "peerDependencies": {
27
- "eslint": ">= 8"
27
+ "eslint": ">= 8",
28
+ "@nuxtjs/eslint-config": ">= 7",
29
+ "@nuxtjs/eslint-config-typescript": ">= 7",
30
+ "eslint-config-react": ">= 1",
31
+ "eslint-plugin-react-hooks": ">= 4"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "@nuxtjs/eslint-config": {
35
+ "optional": true
36
+ },
37
+ "@nuxtjs/eslint-config-typescript": {
38
+ "optional": true
39
+ },
40
+ "eslint-config-react": {
41
+ "optional": true
42
+ },
43
+ "eslint-plugin-react-hooks": {
44
+ "optional": true
45
+ }
28
46
  },
29
47
  "dependencies": {
30
- "@nuxtjs/eslint-config": "^7.0.0",
31
- "@nuxtjs/eslint-config-typescript": "^7.0.2",
32
- "@typescript-eslint/eslint-plugin": "^5.3.0",
33
- "@typescript-eslint/parser": "^5.3.0",
34
- "eslint-config-react": "^1.1.7",
35
- "eslint-plugin-import": "^2.25.3",
36
- "eslint-plugin-react-hooks": "^4.3.0"
48
+ "@typescript-eslint/eslint-plugin": "^5.9.0",
49
+ "@typescript-eslint/parser": "^5.9.0",
50
+ "eslint-plugin-import": "^2.25.4"
37
51
  },
38
52
  "devDependencies": {
39
- "@cenk1cenk2/cz-cc": "^1.4.10",
40
- "eslint": "^8.2.0",
41
- "lint-staged": "^11.2.6",
42
- "prettier": "^2.4.1",
43
- "simple-git-hooks": "^2.7.0"
53
+ "@cenk1cenk2/cz-cc": "^1.4.11",
54
+ "eslint": "^8.8.0",
55
+ "lint-staged": "^12.1.7",
56
+ "prettier": "^2.5.1",
57
+ "simple-git-hooks": "^2.7.0",
58
+ "@nuxtjs/eslint-config": "^8.0.0",
59
+ "@nuxtjs/eslint-config-typescript": "^8.0.0",
60
+ "eslint-config-react": "^1.1.7",
61
+ "eslint-plugin-react-hooks": "^4.3.0"
44
62
  },
45
63
  "config": {
46
64
  "commitizen": {
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  extends: [ './typescript', './react' ],
3
4
  overrides: [
package/react.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  extends: [ './index' ],
3
4
  overrides: [
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  extends: [ './typescript' ],
3
4
  overrides: [
@@ -9,7 +10,9 @@ module.exports = {
9
10
  },
10
11
  rules: {
11
12
  '@typescript-eslint/no-floating-promises': 'error',
12
- '@typescript-eslint/return-await': [ 'error', 'never' ]
13
+ '@typescript-eslint/return-await': [ 'error', 'never' ],
14
+ '@typescript-eslint/await-thenable': 'error',
15
+ '@typescript-eslint/consistent-type-exports': [ 'error', { fixMixedExportsWithInlineTypeSpecifier: false } ]
13
16
  }
14
17
  }
15
18
  ]
package/typescript.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  extends: [ './index' ],
3
4
  overrides: [
@@ -12,9 +13,17 @@ module.exports = {
12
13
  rules: {
13
14
  // this is a bit buggy at the moment
14
15
  '@typescript-eslint/explicit-module-boundary-types': 'off',
15
- '@typescript-eslint/explicit-function-return-type': 'error',
16
+ '@typescript-eslint/explicit-function-return-type': [
17
+ 'error',
18
+ {
19
+ allowExpressions: false,
20
+ allowTypedFunctionExpressions: true,
21
+ allowHigherOrderFunctions: true,
22
+ allowDirectConstAssertionInArrowFunctions: true,
23
+ allowConciseArrowFunctionExpressionsStartingWithVoid: false
24
+ }
25
+ ],
16
26
  '@typescript-eslint/no-unused-vars': 'error',
17
- '@typescript-eslint/array-type': 'error',
18
27
  '@typescript-eslint/ban-ts-ignore': 'off',
19
28
  '@typescript-eslint/explicit-member-accessibility': [
20
29
  'off',
@@ -24,7 +33,7 @@ module.exports = {
24
33
  ],
25
34
  '@typescript-eslint/interface-name-prefix': 'off',
26
35
  '@typescript-eslint/member-delimiter-style': [
27
- 'warn',
36
+ 'error',
28
37
  {
29
38
  multiline: {
30
39
  delimiter: 'none',
@@ -32,7 +41,7 @@ module.exports = {
32
41
  },
33
42
  singleline: {
34
43
  delimiter: 'comma',
35
- requireLast: false
44
+ requireLast: true
36
45
  }
37
46
  }
38
47
  ],
@@ -45,7 +54,133 @@ module.exports = {
45
54
  allowSingleLine: true
46
55
  }
47
56
  ],
48
- '@typescript-eslint/member-ordering': 'warn',
57
+ '@typescript-eslint/member-ordering': [
58
+ 'warn',
59
+ {
60
+ default: [
61
+ // Index signature
62
+ 'signature',
63
+
64
+ // Fields
65
+ 'public-static-field',
66
+ 'protected-static-field',
67
+ 'private-static-field',
68
+
69
+ 'public-instance-field',
70
+ 'public-decorated-field',
71
+ 'protected-instance-field',
72
+ 'protected-decorated-field',
73
+ 'private-instance-field',
74
+ 'private-decorated-field',
75
+
76
+ 'public-abstract-field',
77
+ 'protected-abstract-field',
78
+ 'private-abstract-field',
79
+
80
+ 'public-field',
81
+ 'protected-field',
82
+ 'private-field',
83
+
84
+ 'static-field',
85
+ 'instance-field',
86
+ 'abstract-field',
87
+
88
+ 'decorated-field',
89
+
90
+ 'field',
91
+
92
+ // Constructors
93
+ 'public-constructor',
94
+ 'protected-constructor',
95
+ 'private-constructor',
96
+
97
+ 'constructor',
98
+
99
+ // Getters
100
+ 'public-static-get',
101
+ 'protected-static-get',
102
+ 'private-static-get',
103
+
104
+ 'public-instance-get',
105
+ 'public-decorated-get',
106
+ 'protected-instance-get',
107
+ 'protected-decorated-get',
108
+ 'private-instance-get',
109
+ 'private-decorated-get',
110
+
111
+ 'public-abstract-get',
112
+ 'protected-abstract-get',
113
+ 'private-abstract-get',
114
+
115
+ 'public-get',
116
+ 'protected-get',
117
+ 'private-get',
118
+
119
+ 'static-get',
120
+ 'instance-get',
121
+ 'abstract-get',
122
+
123
+ 'decorated-get',
124
+
125
+ 'get',
126
+
127
+ // Setters
128
+ 'public-static-set',
129
+ 'protected-static-set',
130
+ 'private-static-set',
131
+
132
+ 'public-instance-set',
133
+ 'public-decorated-set',
134
+ 'protected-instance-set',
135
+ 'protected-decorated-set',
136
+ 'private-instance-set',
137
+ 'private-decorated-set',
138
+
139
+ 'public-abstract-set',
140
+ 'protected-abstract-set',
141
+ 'private-abstract-set',
142
+
143
+ 'public-set',
144
+ 'protected-set',
145
+ 'private-set',
146
+
147
+ 'static-set',
148
+ 'instance-set',
149
+ 'abstract-set',
150
+
151
+ 'decorated-set',
152
+
153
+ 'set',
154
+
155
+ // Methods
156
+ 'public-static-method',
157
+ 'protected-static-method',
158
+ 'private-static-method',
159
+
160
+ 'public-instance-method',
161
+ 'protected-instance-method',
162
+ 'private-instance-method',
163
+
164
+ 'public-abstract-method',
165
+ 'protected-abstract-method',
166
+ 'private-abstract-method',
167
+
168
+ 'public-method',
169
+ 'public-decorated-method',
170
+ 'protected-method',
171
+ 'protected-decorated-method',
172
+ 'private-method',
173
+ 'private-decorated-method',
174
+
175
+ 'static-method',
176
+ 'instance-method',
177
+ 'decorated-method',
178
+ 'abstract-method',
179
+
180
+ 'method'
181
+ ]
182
+ }
183
+ ],
49
184
  '@typescript-eslint/no-explicit-any': 'off',
50
185
  camelcase: 'off',
51
186
  '@typescript-eslint/naming-convention': [
@@ -57,9 +192,15 @@ module.exports = {
57
192
 
58
193
  {
59
194
  selector: 'variable',
195
+ modifiers: [ 'const' ],
60
196
  format: [ 'camelCase', 'UPPER_CASE', 'PascalCase' ]
61
197
  },
62
198
 
199
+ {
200
+ selector: 'variable',
201
+ format: [ 'camelCase' ]
202
+ },
203
+
63
204
  {
64
205
  selector: 'function',
65
206
  format: [ 'camelCase', 'PascalCase' ]
@@ -73,7 +214,7 @@ module.exports = {
73
214
 
74
215
  {
75
216
  selector: 'property',
76
- format: [ 'camelCase', 'UPPER_CASE', 'snake_case' ]
217
+ format: [ 'camelCase', 'UPPER_CASE' ]
77
218
  },
78
219
 
79
220
  {
@@ -85,25 +226,17 @@ module.exports = {
85
226
 
86
227
  {
87
228
  selector: 'enumMember',
88
- format: [ 'camelCase', 'UPPER_CASE' ]
229
+ format: [ 'UPPER_CASE' ]
89
230
  },
90
231
 
91
232
  {
92
233
  selector: 'typeLike',
93
234
  format: [ 'PascalCase' ]
94
- },
95
-
96
- {
97
- selector: 'interface',
98
- format: [ 'PascalCase' ]
99
- // custom: {
100
- // regex: '^I[A-Z]',
101
- // match: false
102
- // }
103
235
  }
104
236
  ],
105
237
  '@typescript-eslint/no-parameter-properties': 'off',
106
- '@typescript-eslint/func-call-spacing': [ 'error', 'never' ],
238
+ 'func-call-spacing': 'off',
239
+ '@typescript-eslint/func-call-spacing': [ 'error' ],
107
240
  '@typescript-eslint/prefer-for-of': 'warn',
108
241
  '@typescript-eslint/prefer-function-type': 'error',
109
242
  'space-before-function-paren': 'off',
@@ -127,7 +260,65 @@ module.exports = {
127
260
  '@typescript-eslint/quotes': [ 'error', 'single' ],
128
261
  '@typescript-eslint/semi': [ 'error', 'never' ],
129
262
  '@typescript-eslint/unified-signatures': 'error',
130
- '@typescript-eslint/no-use-before-define': 'off'
263
+ '@typescript-eslint/no-use-before-define': 'off',
264
+ '@typescript-eslint/array-type': [ 'error', 'array' ],
265
+ '@typescript-eslint/consistent-indexed-object-style': [ 'error', 'record' ],
266
+ '@typescript-eslint/consistent-type-assertions': [ 'error', { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow-as-parameter' } ],
267
+ '@typescript-eslint/consistent-type-definitions': [ 'error', 'interface' ],
268
+ '@typescript-eslint/consistent-type-imports': [ 'error', { prefer: 'type-imports' } ],
269
+ '@typescript-eslint/method-signature-style': [ 'error', 'property' ],
270
+ '@typescript-eslint/no-empty-interface': [
271
+ 'error',
272
+ {
273
+ allowSingleExtends: true
274
+ }
275
+ ],
276
+ '@typescript-eslint/no-extra-non-null-assertion': [ 'error' ],
277
+ '@typescript-eslint/no-extraneous-class': [
278
+ 'error',
279
+ {
280
+ allowConstructorOnly: true,
281
+ allowEmpty: false,
282
+ allowStaticOnly: false,
283
+ allowWithDecorator: false
284
+ }
285
+ ],
286
+ '@typescript-eslint/no-inferrable-types': 'error',
287
+ '@typescript-eslint/no-misused-new': 'error',
288
+ '@typescript-eslint/prefer-enum-initializers': 'error',
289
+ 'dot-notation': 'off',
290
+ '@typescript-eslint/dot-notation': [ 'error' ],
291
+ 'keyword-spacing': 'off',
292
+ '@typescript-eslint/keyword-spacing': [ 'error' ],
293
+ 'lines-between-class-members': 'off',
294
+ '@typescript-eslint/lines-between-class-members': [ 'error' ],
295
+ 'no-throw-literal': 'off',
296
+ '@typescript-eslint/no-throw-literal': [ 'error' ],
297
+ 'padding-line-between-statements': 'off',
298
+ '@typescript-eslint/padding-line-between-statements': [
299
+ 'error',
300
+ {
301
+ blankLine: 'always',
302
+ prev: '*',
303
+ next: 'return'
304
+ },
305
+ {
306
+ blankLine: 'always',
307
+ prev: [ 'const', 'let', 'var' ],
308
+ next: '*'
309
+ },
310
+ {
311
+ blankLine: 'always',
312
+ prev: [ 'case', 'default' ],
313
+ next: '*'
314
+ },
315
+ {
316
+ blankLine: 'always',
317
+ prev: '*',
318
+ next: [ 'interface', 'type' ]
319
+ }
320
+ ],
321
+ '@typescript-eslint/prefer-reduce-type-parameter': 'error'
131
322
  }
132
323
  }
133
324
  ]
package/vue-typescript.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  extends: [ './index', './typescript' ],
3
4
  overrides: [
package/vue.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  extends: [ './index' ],
3
4
  overrides: [