@cenk1cenk2/eslint-config 2.3.2 → 2.5.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/CHANGELOG.md +28 -0
- package/import-utils.js +67 -0
- package/index.js +2 -1
- package/package.json +9 -8
- package/typescript.js +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# [2.5.0](https://github.com/cenk1cenk2/eslint-config/compare/v2.4.0...v2.5.0) (2022-02-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* autoresolve typescript paths ([6fa8fcf](https://github.com/cenk1cenk2/eslint-config/commit/6fa8fcfed10a7dc7a4461ace7416f96e5088a3b9))
|
|
7
|
+
|
|
8
|
+
# [2.4.0](https://github.com/cenk1cenk2/eslint-config/compare/v2.3.4...v2.4.0) (2022-01-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* adds the import helper ([7d8e040](https://github.com/cenk1cenk2/eslint-config/commit/7d8e040e2d60d8f2d33d09cd5058de6077d3b1da))
|
|
14
|
+
|
|
15
|
+
## [2.3.4](https://github.com/cenk1cenk2/eslint-config/compare/v2.3.3...v2.3.4) (2022-01-31)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* update rule ([63addc7](https://github.com/cenk1cenk2/eslint-config/commit/63addc71495f563d50748aacb4f0dac229b4e902))
|
|
21
|
+
|
|
22
|
+
## [2.3.3](https://github.com/cenk1cenk2/eslint-config/compare/v2.3.2...v2.3.3) (2022-01-31)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* update rule ([20abc5c](https://github.com/cenk1cenk2/eslint-config/commit/20abc5c2af9f051dbb944b2f7fc8d9a2dcfcee44))
|
|
28
|
+
|
|
1
29
|
## [2.3.2](https://github.com/cenk1cenk2/eslint-config/compare/v2.3.1...v2.3.2) (2022-01-31)
|
|
2
30
|
|
|
3
31
|
|
package/import-utils.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const { loadTsConfig } = require('load-tsconfig')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {{ paths?: string[] tsconfig?: string, tsconfigDir?: string}} options
|
|
5
|
+
* @returns {import("eslint").Linter.Config['rules']}
|
|
6
|
+
*/
|
|
7
|
+
function generateImportPluginGroupCases (options) {
|
|
8
|
+
const defaults = [ '@cenk1cenk2', '@cenk1cenk2-*' ]
|
|
9
|
+
|
|
10
|
+
options.paths = options.paths ? options.paths.push(...defaults) : defaults
|
|
11
|
+
|
|
12
|
+
/** @type {string[]} */
|
|
13
|
+
let tsConfigPaths = []
|
|
14
|
+
|
|
15
|
+
if (options.tsconfigDir) {
|
|
16
|
+
const tsconfig = loadTsConfig(options.tsconfigDir, options.tsconfig)
|
|
17
|
+
|
|
18
|
+
if (tsconfig.data?.compilerOptions?.paths) {
|
|
19
|
+
tsConfigPaths = Object.keys(tsconfig.data.compilerOptions.paths).map((path) => {
|
|
20
|
+
return path.replace('*', '**')
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
'import/order': [
|
|
27
|
+
'error',
|
|
28
|
+
{
|
|
29
|
+
pathGroups: [
|
|
30
|
+
...options.paths.map((path) => {
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
pattern: `${path}/**`,
|
|
34
|
+
group: 'internal'
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
{
|
|
38
|
+
pattern: `${path}`,
|
|
39
|
+
group: 'internal'
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}),
|
|
43
|
+
...tsConfigPaths.map((path) => {
|
|
44
|
+
return [
|
|
45
|
+
{
|
|
46
|
+
pattern: `${path}`,
|
|
47
|
+
group: 'internal'
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
],
|
|
52
|
+
pathGroupsExcludedImportTypes: [ 'builtin' ],
|
|
53
|
+
groups: [
|
|
54
|
+
[ 'builtin', 'external' ],
|
|
55
|
+
[ 'internal', 'index', 'parent', 'sibling' ]
|
|
56
|
+
],
|
|
57
|
+
'newlines-between': 'always',
|
|
58
|
+
alphabetize: {
|
|
59
|
+
order: 'asc',
|
|
60
|
+
caseInsensitive: true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = generateImportPluginGroupCases
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cenk1cenk2/eslint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Eslint configuration for my taste.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/cenk1cenk2/eslint-config",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"eslint": ">= 8",
|
|
28
27
|
"@nuxtjs/eslint-config": ">= 7",
|
|
29
28
|
"@nuxtjs/eslint-config-typescript": ">= 7",
|
|
29
|
+
"eslint": ">= 8",
|
|
30
30
|
"eslint-config-react": ">= 1",
|
|
31
31
|
"eslint-plugin-react-hooks": ">= 4"
|
|
32
32
|
},
|
|
@@ -47,18 +47,19 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@typescript-eslint/eslint-plugin": "^5.9.0",
|
|
49
49
|
"@typescript-eslint/parser": "^5.9.0",
|
|
50
|
-
"eslint-plugin-import": "^2.25.4"
|
|
50
|
+
"eslint-plugin-import": "^2.25.4",
|
|
51
|
+
"load-tsconfig": "^0.2.3"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@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
55
|
"@nuxtjs/eslint-config": "^8.0.0",
|
|
59
56
|
"@nuxtjs/eslint-config-typescript": "^8.0.0",
|
|
57
|
+
"eslint": "^8.8.0",
|
|
60
58
|
"eslint-config-react": "^1.1.7",
|
|
61
|
-
"eslint-plugin-react-hooks": "^4.3.0"
|
|
59
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
60
|
+
"lint-staged": "^12.1.7",
|
|
61
|
+
"prettier": "^2.5.1",
|
|
62
|
+
"simple-git-hooks": "^2.7.0"
|
|
62
63
|
},
|
|
63
64
|
"config": {
|
|
64
65
|
"commitizen": {
|
package/typescript.js
CHANGED
|
@@ -213,7 +213,14 @@ module.exports = {
|
|
|
213
213
|
{
|
|
214
214
|
selector: 'parameter',
|
|
215
215
|
format: [ 'camelCase', 'PascalCase' ],
|
|
216
|
-
|
|
216
|
+
modifiers: [ 'unused' ],
|
|
217
|
+
leadingUnderscore: 'require'
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
{
|
|
221
|
+
selector: 'parameter',
|
|
222
|
+
format: [ 'camelCase', 'PascalCase' ],
|
|
223
|
+
leadingUnderscore: 'forbid'
|
|
217
224
|
},
|
|
218
225
|
|
|
219
226
|
{
|
|
@@ -236,13 +243,6 @@ module.exports = {
|
|
|
236
243
|
{
|
|
237
244
|
selector: 'typeLike',
|
|
238
245
|
format: [ 'PascalCase' ]
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
{
|
|
242
|
-
selector: 'parameter',
|
|
243
|
-
format: [ 'camelCase', 'PascalCase' ],
|
|
244
|
-
modifiers: [ 'unused' ],
|
|
245
|
-
leadingUnderscore: 'require'
|
|
246
246
|
}
|
|
247
247
|
],
|
|
248
248
|
'@typescript-eslint/no-parameter-properties': 'off',
|