@h1fra/eslint-config 1.0.2 → 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.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "nango"
27
27
  ],
28
28
  "scripts": {
29
- "test": "eslint . --ext .ts"
29
+ "test": "eslint ."
30
30
  },
31
31
  "dependencies": {
32
32
  "@eslint/js": "^9.11.1",
@@ -39,9 +39,11 @@
39
39
  "eslint-plugin-prettier": "5.2.1",
40
40
  "globals": "^15.9.0",
41
41
  "prettier": "^3.3.3",
42
- "typescript-eslint": "^8.7.0"
42
+ "typescript-eslint": "^8.7.0",
43
+ "eslint-plugin-unicorn": "^55.0.0"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "typescript": ">=5.0.0"
46
- }
47
+ },
48
+ "devDependencies": {}
47
49
  }
@@ -15,17 +15,8 @@ export default tseslint.config(
15
15
  prettier,
16
16
  prettierRecommended,
17
17
  {
18
- files: ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,mtsx,jsx}'],
19
- extends: [...tseslint.configs.recommended],
20
- languageOptions: {
21
- parser: tsParser,
22
- ecmaVersion: 'latest',
23
- sourceType: 'module',
24
- globals: globals.node,
25
- parserOptions: { project: './tsconfig.json' },
26
- },
18
+ files: ['**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,mtsx}'],
27
19
  rules: {
28
- '@typescript-eslint/no-var-requires': 'off', // tseslint does not autodetect commonjs context
29
20
  'no-console': 1,
30
21
  'no-constant-condition': 'off',
31
22
 
@@ -43,6 +34,72 @@ export default tseslint.config(
43
34
  },
44
35
  ],
45
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
+
46
103
  // --- Typescript
47
104
  // Recommended
48
105
  '@typescript-eslint/await-thenable': 'error',
@@ -92,58 +149,38 @@ export default tseslint.config(
92
149
  fixStyle: 'separate-type-imports',
93
150
  },
94
151
  ],
95
-
96
- // --- Import
97
- 'import-x/extensions': [
152
+ '@typescript-eslint/max-params': ['error', { max: 2 }],
153
+ '@typescript-eslint/method-signature-style': 'error',
154
+ '@typescript-eslint/naming-convention': [
98
155
  'error',
99
- 'always',
100
156
  {
101
- json: 'always',
102
- js: 'always',
103
- ts: 'never',
104
- ignorePackages: true,
157
+ selector: 'variable',
158
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
159
+ leadingUnderscore: 'allow',
105
160
  },
106
- ],
107
- 'import-x/no-unresolved': 'off',
108
- 'import-x/no-duplicates': 'error',
109
- 'import-x/no-extraneous-dependencies': 'error',
110
- 'import-x/no-empty-named-blocks': 'error',
111
- 'import-x/no-absolute-path': 'error',
112
- 'import-x/no-self-import': 'error',
113
- 'import-x/newline-after-import': 'error',
114
- 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
115
- 'import-x/order': [
116
- 'error',
117
161
  {
118
- groups: [
119
- 'builtin',
120
- 'external',
121
- 'unknown',
122
- 'internal',
123
- 'parent',
124
- 'sibling',
125
- 'type',
126
- 'index',
127
- 'object',
128
- ],
129
- 'newlines-between': 'always',
130
- alphabetize: {
131
- order: 'asc',
132
- },
133
- warnOnUnassignedImports: true,
134
- pathGroups: [
135
- {
136
- pattern: '@/**',
137
- group: 'parent',
138
- },
139
- {
140
- pattern: '@pohlen/*',
141
- group: 'internal',
142
- position: 'after',
143
- },
144
- ],
162
+ selector: 'typeParameter',
163
+ format: ['PascalCase'],
164
+ prefix: ['T', 'K'],
165
+ },
166
+ {
167
+ selector: 'typeLike',
168
+ format: ['PascalCase'],
145
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'] },
146
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',
147
184
  },
148
185
  }
149
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
  ];