@cenk1cenk2/eslint-config 2.5.3 → 2.5.7

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.7](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.6...v2.5.7) (2022-02-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update all slow ring [@weekly](https://github.com/weekly) ([ef87573](https://github.com/cenk1cenk2/eslint-config/commit/ef87573b73e7e6c3ce5e95c38024e059d8e898bd))
7
+
8
+ ## [2.5.6](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.5...v2.5.6) (2022-02-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * update the config override func ([68a0b1f](https://github.com/cenk1cenk2/eslint-config/commit/68a0b1f4ae48036016dcfa42390012fa7aedf206))
14
+
15
+ ## [2.5.5](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.4...v2.5.5) (2022-02-01)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * update ([1ae486c](https://github.com/cenk1cenk2/eslint-config/commit/1ae486c8c3d3f83c6ed1e4e8199b1b41f7b29e2d))
21
+
22
+ ## [2.5.4](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.3...v2.5.4) (2022-02-01)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update function ([1f44e37](https://github.com/cenk1cenk2/eslint-config/commit/1f44e37062366c67ea001c86f8be3ebc4d3f0eb9))
28
+ * update utils ([3beeab4](https://github.com/cenk1cenk2/eslint-config/commit/3beeab4756c1a517e9d65e4137f0e041daee70c1))
29
+
1
30
  ## [2.5.3](https://github.com/cenk1cenk2/eslint-config/compare/v2.5.2...v2.5.3) (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.3",
3
+ "version": "2.5.7",
4
4
  "description": "Eslint configuration for my taste.",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/cenk1cenk2/eslint-config",
@@ -45,19 +45,19 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@typescript-eslint/eslint-plugin": "^5.9.0",
49
- "@typescript-eslint/parser": "^5.9.0",
48
+ "@typescript-eslint/eslint-plugin": "^5.12.0",
49
+ "@typescript-eslint/parser": "^5.12.0",
50
50
  "eslint-plugin-import": "^2.25.4",
51
51
  "load-tsconfig": "^0.2.3"
52
52
  },
53
53
  "devDependencies": {
54
- "@cenk1cenk2/cz-cc": "^1.4.11",
54
+ "@cenk1cenk2/cz-cc": "^1.5.1",
55
55
  "@nuxtjs/eslint-config": "^8.0.0",
56
56
  "@nuxtjs/eslint-config-typescript": "^8.0.0",
57
- "eslint": "^8.8.0",
57
+ "eslint": "^8.9.0",
58
58
  "eslint-config-react": "^1.1.7",
59
59
  "eslint-plugin-react-hooks": "^4.3.0",
60
- "lint-staged": "^12.1.7",
60
+ "lint-staged": "^12.3.4",
61
61
  "prettier": "^2.5.1",
62
62
  "simple-git-hooks": "^2.7.0"
63
63
  },
@@ -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 = []
@@ -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 }