@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 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
@@ -0,0 +1,3 @@
1
+ const ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS = [ '*.js', '*.cjs', '*.mjs', '*.ts', '*.tsx', '*.vue', '*.svelte' ]
2
+
3
+ module.exports = { ALL_KNOWN_JAVASCRIPT_FILE_EXTENSIONS }
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
- rules: {
4
- 'import/no-extraneous-dependencies': 'error',
5
- 'import/exports-last': 'error'
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
- 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: [
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
- 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'
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
- 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
- }
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
- 'import/export': 'error',
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/eslint-config",
3
- "version": "2.5.2",
3
+ "version": "2.5.6",
4
4
  "description": "Eslint configuration for my taste.",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/cenk1cenk2/eslint-config",
@@ -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 generateImportPluginGroupCases (options) {
9
+ function generateImportGroups (options) {
8
10
  const defaults = [ '@cenk1cenk2', '@cenk1cenk2-*' ]
9
11
 
10
- options.paths = options.paths ? options.paths.push(...defaults) : defaults
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: 'internal'
38
+ group: 'index'
37
39
  },
38
40
 
39
41
  {
40
42
  pattern: `${path}`,
41
- group: 'internal'
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: 'internal'
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
- [ 'internal', 'index', 'parent', 'sibling' ]
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
- module.exports = generateImportPluginGroupCases
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 }