@h1fra/eslint-config 1.0.1 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h1fra/eslint-config",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "repository": {
@@ -26,24 +26,24 @@
26
26
  "nango"
27
27
  ],
28
28
  "scripts": {
29
- "test": "eslint . --ext .ts"
29
+ "test": "eslint ."
30
30
  },
31
31
  "dependencies": {
32
+ "@eslint/js": "^9.11.1",
32
33
  "@typescript-eslint/eslint-plugin": "^8.7.0",
33
34
  "@typescript-eslint/parser": "^8.7.0",
34
- "@eslint/js": "^9.11.1",
35
+ "eslint": "^9.11.1",
35
36
  "eslint-config-prettier": "^9.1.0",
37
+ "eslint-import-resolver-typescript": "^3.6.3",
36
38
  "eslint-plugin-import-x": "^4.3.0",
37
39
  "eslint-plugin-prettier": "5.2.1",
38
- "eslint": "^9.11.1",
39
- "prettier": "^3.3.3"
40
+ "globals": "^15.9.0",
41
+ "prettier": "^3.3.3",
42
+ "typescript-eslint": "^8.7.0",
43
+ "eslint-plugin-unicorn": "^55.0.0"
40
44
  },
41
45
  "peerDependencies": {
42
46
  "typescript": ">=5.0.0"
43
47
  },
44
- "devDependencies": {
45
- "eslint-import-resolver-typescript": "3.6.3",
46
- "globals": "^15.9.0",
47
- "typescript-eslint": "^8.7.0"
48
- }
48
+ "devDependencies": {}
49
49
  }
@@ -3,6 +3,7 @@ import tsParser from '@typescript-eslint/parser';
3
3
  import prettier from 'eslint-config-prettier';
4
4
  import importEslint from 'eslint-plugin-import-x';
5
5
  import prettierRecommended from 'eslint-plugin-prettier/recommended';
6
+ import globals from 'globals';
6
7
  import * as tseslint from 'typescript-eslint';
7
8
 
8
9
  export default tseslint.config(
@@ -14,16 +15,8 @@ export default tseslint.config(
14
15
  prettier,
15
16
  prettierRecommended,
16
17
  {
17
- files: ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,mtsx,jsx}'],
18
- extends: [...tseslint.configs.recommended],
19
- languageOptions: {
20
- parser: tsParser,
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- parserOptions: { project: './tsconfig.json' },
24
- },
18
+ files: ['**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,mtsx}'],
25
19
  rules: {
26
- '@typescript-eslint/no-var-requires': 'off', // tseslint does not autodetect commonjs context
27
20
  'no-console': 1,
28
21
  'no-constant-condition': 'off',
29
22
 
@@ -41,6 +34,72 @@ export default tseslint.config(
41
34
  },
42
35
  ],
43
36
 
37
+ // --- Import
38
+ 'import-x/extensions': [
39
+ 'error',
40
+ 'always',
41
+ {
42
+ json: 'always',
43
+ js: 'always',
44
+ ts: 'never',
45
+ ignorePackages: true,
46
+ },
47
+ ],
48
+ 'import-x/no-unresolved': 'off',
49
+ 'import-x/no-duplicates': 'error',
50
+ 'import-x/no-extraneous-dependencies': 'error',
51
+ 'import-x/no-empty-named-blocks': 'error',
52
+ 'import-x/no-absolute-path': 'error',
53
+ 'import-x/no-self-import': 'error',
54
+ 'import-x/newline-after-import': 'error',
55
+ 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
56
+ 'import-x/order': [
57
+ 'error',
58
+ {
59
+ groups: [
60
+ 'builtin',
61
+ 'external',
62
+ 'unknown',
63
+ 'internal',
64
+ 'parent',
65
+ 'sibling',
66
+ 'type',
67
+ 'index',
68
+ 'object',
69
+ ],
70
+ 'newlines-between': 'always',
71
+ alphabetize: {
72
+ order: 'asc',
73
+ },
74
+ warnOnUnassignedImports: true,
75
+ pathGroups: [
76
+ {
77
+ pattern: '@/**',
78
+ group: 'parent',
79
+ },
80
+ {
81
+ pattern: '@pohlen/*',
82
+ group: 'internal',
83
+ position: 'after',
84
+ },
85
+ ],
86
+ },
87
+ ],
88
+ },
89
+ },
90
+ {
91
+ files: ['**/*.{ts,mts,cts,tsx,mtsx}'],
92
+ extends: [...tseslint.configs.recommended],
93
+ languageOptions: {
94
+ parser: tsParser,
95
+ ecmaVersion: 'latest',
96
+ sourceType: 'module',
97
+ globals: globals.node,
98
+ parserOptions: { project: './tsconfig.json' },
99
+ },
100
+ rules: {
101
+ '@typescript-eslint/no-var-requires': 'off', // tseslint does not autodetect commonjs context
102
+
44
103
  // --- Typescript
45
104
  // Recommended
46
105
  '@typescript-eslint/await-thenable': 'error',
@@ -90,58 +149,38 @@ export default tseslint.config(
90
149
  fixStyle: 'separate-type-imports',
91
150
  },
92
151
  ],
93
-
94
- // --- Import
95
- 'import-x/extensions': [
152
+ '@typescript-eslint/max-params': ['error', { max: 2 }],
153
+ '@typescript-eslint/method-signature-style': 'error',
154
+ '@typescript-eslint/naming-convention': [
96
155
  'error',
97
- 'always',
98
156
  {
99
- json: 'always',
100
- js: 'always',
101
- ts: 'never',
102
- ignorePackages: true,
157
+ selector: 'variable',
158
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
159
+ leadingUnderscore: 'allow',
103
160
  },
104
- ],
105
- 'import-x/no-unresolved': 'off',
106
- 'import-x/no-duplicates': 'error',
107
- 'import-x/no-extraneous-dependencies': 'error',
108
- 'import-x/no-empty-named-blocks': 'error',
109
- 'import-x/no-absolute-path': 'error',
110
- 'import-x/no-self-import': 'error',
111
- 'import-x/newline-after-import': 'error',
112
- 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
113
- 'import-x/order': [
114
- 'error',
115
161
  {
116
- groups: [
117
- 'builtin',
118
- 'external',
119
- 'unknown',
120
- 'internal',
121
- 'parent',
122
- 'sibling',
123
- 'type',
124
- 'index',
125
- 'object',
126
- ],
127
- 'newlines-between': 'always',
128
- alphabetize: {
129
- order: 'asc',
130
- },
131
- warnOnUnassignedImports: true,
132
- pathGroups: [
133
- {
134
- pattern: '@/**',
135
- group: 'parent',
136
- },
137
- {
138
- pattern: '@pohlen/*',
139
- group: 'internal',
140
- position: 'after',
141
- },
142
- ],
162
+ selector: 'typeParameter',
163
+ format: ['PascalCase'],
164
+ prefix: ['T', 'K'],
165
+ },
166
+ {
167
+ selector: 'typeLike',
168
+ format: ['PascalCase'],
143
169
  },
170
+ {
171
+ selector: 'typeLike',
172
+ format: ['PascalCase'],
173
+ },
174
+ { selector: 'class', format: ['PascalCase'] },
175
+ { selector: 'method', format: ['camelCase'], leadingUnderscore: 'allow' },
176
+ { selector: 'function', format: ['camelCase'] },
144
177
  ],
178
+ '@typescript-eslint/no-import-type-side-effects': 'error',
179
+
180
+ 'no-shadow': 'off',
181
+ '@typescript-eslint/no-shadow': 'error',
182
+ '@typescript-eslint/prefer-enum-initializers': 'error',
183
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
145
184
  },
146
185
  }
147
186
  );
@@ -1,9 +1,13 @@
1
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
1
2
  import * as tseslint from 'typescript-eslint';
2
3
 
3
4
  export default [
4
5
  ...tseslint.configs.strict,
5
6
  ...tseslint.configs.stylistic,
7
+ eslintPluginUnicorn.configs['flat/recommended'],
6
8
  {
9
+ files: ['**/*.{ts,mts,cts,tsx,mtsx}'],
10
+
7
11
  rules: {
8
12
  // --- Typescript
9
13
  // Recommended
@@ -36,6 +40,14 @@ export default [
36
40
  // Stylistic
37
41
  '@typescript-eslint/no-inferrable-types': 'error',
38
42
  '@typescript-eslint/no-empty-function': 'error',
43
+
44
+ // Other
45
+ '@typescript-eslint/explicit-function-return-type': 'error',
46
+ '@typescript-eslint/strict-boolean-expressions': 'error',
47
+ '@typescript-eslint/member-ordering': 'error',
48
+
49
+ // Unicorn
50
+ 'unicorn/catch-error-name': ['error', { name: 'err' }],
39
51
  },
40
52
  },
41
53
  ];