@cenk1cenk2/eslint-config 2.5.2 → 2.5.6
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/CHANGELOG.md +29 -0
- package/constants.js +3 -0
- package/import-strict.js +12 -4
- package/import.js +43 -36
- package/package.json +1 -1
- package/{import-utils.js → utils.js} +23 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [2.5.6](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.5...v2.5.6) (2022-02-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update the config override func ([68a0b1f](https://github.com/cenk1cenk2/eslint-config/commit/68a0b1f4ae48036016dcfa42390012fa7aedf206))
|
|
7
|
+
|
|
8
|
+
## [2.5.5](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.4...v2.5.5) (2022-02-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update ([1ae486c](https://github.com/cenk1cenk2/eslint-config/commit/1ae486c8c3d3f83c6ed1e4e8199b1b41f7b29e2d))
|
|
14
|
+
|
|
15
|
+
## [2.5.4](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.3...v2.5.4) (2022-02-01)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* update function ([1f44e37](https://github.com/cenk1cenk2/eslint-config/commit/1f44e37062366c67ea001c86f8be3ebc4d3f0eb9))
|
|
21
|
+
* update utils ([3beeab4](https://github.com/cenk1cenk2/eslint-config/commit/3beeab4756c1a517e9d65e4137f0e041daee70c1))
|
|
22
|
+
|
|
23
|
+
## [2.5.3](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.2...v2.5.3) (2022-02-01)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* allowed groups ([2e5a615](https://github.com/cenk1cenk2/eslint-config/commit/2e5a615d1918059f52f1f2bc29e709779194f844))
|
|
29
|
+
|
|
1
30
|
## [2.5.2](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.1...v2.5.2) (2022-02-01)
|
|
2
31
|
|
|
3
32
|
|
package/constants.js
ADDED
package/import-strict.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
const { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS } = require('./constants')
|
|
2
|
+
|
|
1
3
|
/** @type {import("eslint").Linter.Config} */
|
|
2
4
|
module.exports = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
overrides: [
|
|
6
|
+
{
|
|
7
|
+
files: ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS,
|
|
8
|
+
plugins: [ 'import' ],
|
|
9
|
+
rules: {
|
|
10
|
+
'import/no-extraneous-dependencies': 'error',
|
|
11
|
+
'import/exports-last': 'error'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
]
|
|
7
15
|
}
|
package/import.js
CHANGED
|
@@ -1,43 +1,50 @@
|
|
|
1
|
+
const { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS } = require('./constants')
|
|
2
|
+
|
|
1
3
|
/** @type {import("eslint").Linter.Config} */
|
|
2
4
|
module.exports = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
overrides: [
|
|
6
|
+
{
|
|
7
|
+
files: ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS,
|
|
8
|
+
plugins: [ 'import' ],
|
|
9
|
+
rules: {
|
|
10
|
+
'sort-imports': 'off',
|
|
11
|
+
'import/first': 'error',
|
|
12
|
+
'import/newline-after-import': 'error',
|
|
13
|
+
'import/no-duplicates': 'error',
|
|
14
|
+
'import/order': [
|
|
15
|
+
'error',
|
|
13
16
|
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
pathGroups: [
|
|
18
|
+
{
|
|
19
|
+
pattern: '@{cenk1cenk2,cenk1cenk2-*}/**',
|
|
20
|
+
group: 'index'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
pattern: '@{src,interfaces,utils,constants,commands}/**',
|
|
24
|
+
group: 'index'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
pattern: '@{src,interfaces,utils,constants,commands}',
|
|
28
|
+
group: 'index'
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
pathGroupsExcludedImportTypes: [ 'builtin' ],
|
|
32
|
+
groups: [
|
|
33
|
+
[ 'builtin', 'external' ],
|
|
34
|
+
[ 'index', 'parent', 'sibling' ]
|
|
35
|
+
],
|
|
36
|
+
'newlines-between': 'always',
|
|
37
|
+
alphabetize: {
|
|
38
|
+
order: 'asc',
|
|
39
|
+
caseInsensitive: true
|
|
40
|
+
}
|
|
24
41
|
}
|
|
25
42
|
],
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
],
|
|
31
|
-
'newlines-between': 'always',
|
|
32
|
-
alphabetize: {
|
|
33
|
-
order: 'asc',
|
|
34
|
-
caseInsensitive: true
|
|
35
|
-
}
|
|
43
|
+
'import/export': 'error',
|
|
44
|
+
'import/no-extraneous-dependencies': 'error',
|
|
45
|
+
'import/no-self-import': 'error',
|
|
46
|
+
'import/no-useless-path-segments': 'error'
|
|
36
47
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'import/no-extraneous-dependencies': 'error',
|
|
40
|
-
'import/no-self-import': 'error',
|
|
41
|
-
'import/no-useless-path-segments': 'error'
|
|
42
|
-
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
43
50
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
const { loadTsConfig } = require('load-tsconfig')
|
|
2
2
|
|
|
3
|
+
const { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS } = require('./constants')
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* @param {{ paths?: string[] tsconfig?: string, tsconfigDir?: string}} options
|
|
5
7
|
* @returns {import("eslint").Linter.Config['rules']}
|
|
6
8
|
*/
|
|
7
|
-
function
|
|
9
|
+
function generateImportGroups (options) {
|
|
8
10
|
const defaults = [ '@cenk1cenk2', '@cenk1cenk2-*' ]
|
|
9
11
|
|
|
10
|
-
options.paths = options.paths ? options.paths
|
|
12
|
+
options.paths = Array.isArray(options.paths) ? [ ...options.paths, ...defaults ] : defaults
|
|
11
13
|
|
|
12
14
|
/** @type {string[]} */
|
|
13
15
|
let tsConfigPaths = []
|
|
@@ -33,12 +35,12 @@ function generateImportPluginGroupCases (options) {
|
|
|
33
35
|
|
|
34
36
|
{
|
|
35
37
|
pattern: `${path}/**`,
|
|
36
|
-
group: '
|
|
38
|
+
group: 'index'
|
|
37
39
|
},
|
|
38
40
|
|
|
39
41
|
{
|
|
40
42
|
pattern: `${path}`,
|
|
41
|
-
group: '
|
|
43
|
+
group: 'index'
|
|
42
44
|
}
|
|
43
45
|
]
|
|
44
46
|
}, []),
|
|
@@ -48,7 +50,7 @@ function generateImportPluginGroupCases (options) {
|
|
|
48
50
|
|
|
49
51
|
{
|
|
50
52
|
pattern: `${path}`,
|
|
51
|
-
group: '
|
|
53
|
+
group: 'index'
|
|
52
54
|
}
|
|
53
55
|
]
|
|
54
56
|
}, [])
|
|
@@ -56,7 +58,7 @@ function generateImportPluginGroupCases (options) {
|
|
|
56
58
|
pathGroupsExcludedImportTypes: [ 'builtin' ],
|
|
57
59
|
groups: [
|
|
58
60
|
[ 'builtin', 'external' ],
|
|
59
|
-
[ '
|
|
61
|
+
[ 'index', 'parent', 'sibling' ]
|
|
60
62
|
],
|
|
61
63
|
'newlines-between': 'always',
|
|
62
64
|
alphabetize: {
|
|
@@ -68,4 +70,18 @@ function generateImportPluginGroupCases (options) {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
/**
|
|
74
|
+
* @param {{ paths?: string[] tsconfig?: string, tsconfigDir?: string}} options
|
|
75
|
+
* @returns {import("eslint").Linter.ConfigOverride}
|
|
76
|
+
*/
|
|
77
|
+
function generateImportGroupsWithOverride (options) {
|
|
78
|
+
return [
|
|
79
|
+
{
|
|
80
|
+
files: ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS,
|
|
81
|
+
plugins: [ 'import' ],
|
|
82
|
+
rules: generateImportGroups(options)
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
module.exports = { generateImportGroups, generateImportGroupsWithOverride }
|