@kitschpatrol/eslint-config 4.2.0 → 4.2.2
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/eslint.config.cjs +41 -6
- package/init/.eslintignore +1 -0
- package/init/.eslintrc.cjs +2 -1
- package/package.json +1 -1
package/eslint.config.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable unicorn/no-null */
|
|
1
2
|
/* eslint-disable perfectionist/sort-objects */
|
|
2
3
|
const extendsPrefix = [
|
|
3
4
|
'eslint:recommended',
|
|
@@ -83,6 +84,30 @@ const globalRulesTypescript = {
|
|
|
83
84
|
// https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
|
84
85
|
'no-undef': 'off',
|
|
85
86
|
'no-unused-vars': 'off',
|
|
87
|
+
'@typescript-eslint/naming-convention': [
|
|
88
|
+
'error',
|
|
89
|
+
{
|
|
90
|
+
selector: 'default',
|
|
91
|
+
format: ['camelCase', 'StrictPascalCase'],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
selector: 'default',
|
|
95
|
+
format: null,
|
|
96
|
+
modifiers: ['requiresQuotes'],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
selector: 'variable',
|
|
100
|
+
format: ['camelCase', 'StrictPascalCase'],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
selector: 'function',
|
|
104
|
+
format: ['camelCase'],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
selector: 'typeLike',
|
|
108
|
+
format: ['StrictPascalCase'],
|
|
109
|
+
},
|
|
110
|
+
],
|
|
86
111
|
}
|
|
87
112
|
|
|
88
113
|
/* @type {import('eslint').Linter.Config} */
|
|
@@ -101,13 +126,14 @@ module.exports = {
|
|
|
101
126
|
ecmaVersion: 2022,
|
|
102
127
|
extraFileExtensions: ['.svelte', '.astro'], // Essential for these file types to make it to the override
|
|
103
128
|
project: 'tsconfig.eslint.json',
|
|
129
|
+
tsconfigRootDir: process.cwd(), // Look for tsconfig in the consuming project's root
|
|
104
130
|
sourceType: 'module',
|
|
105
131
|
},
|
|
106
132
|
rules: globalRulesPrefix,
|
|
107
133
|
overrides: [
|
|
108
134
|
// Markdown
|
|
109
135
|
{
|
|
110
|
-
extends: ['plugin:mdx/recommended'
|
|
136
|
+
extends: ['plugin:mdx/recommended'],
|
|
111
137
|
files: ['*.md'],
|
|
112
138
|
parser: 'eslint-mdx',
|
|
113
139
|
rules: globalRulesPrefix,
|
|
@@ -118,6 +144,7 @@ module.exports = {
|
|
|
118
144
|
files: ['*.mdx'],
|
|
119
145
|
parser: 'eslint-mdx',
|
|
120
146
|
rules: {
|
|
147
|
+
...globalRulesPrefix,
|
|
121
148
|
'no-unused-expressions': 'off',
|
|
122
149
|
'no-unused-vars': 'off',
|
|
123
150
|
|
|
@@ -153,7 +180,7 @@ module.exports = {
|
|
|
153
180
|
],
|
|
154
181
|
parser: '@typescript-eslint/parser',
|
|
155
182
|
parserOptions: {
|
|
156
|
-
project:
|
|
183
|
+
project: 'tsconfig.eslint.json', // Not sure why this isn't inherited
|
|
157
184
|
},
|
|
158
185
|
rules: {
|
|
159
186
|
...globalRulesPrefix,
|
|
@@ -164,7 +191,10 @@ module.exports = {
|
|
|
164
191
|
{
|
|
165
192
|
extends: [...extendsSuffix],
|
|
166
193
|
files: ['*.jsx', '*.mjs', '*.cjs', '.js'],
|
|
167
|
-
rules:
|
|
194
|
+
rules: {
|
|
195
|
+
...globalRulesPrefix,
|
|
196
|
+
...globalRulesTypescript,
|
|
197
|
+
},
|
|
168
198
|
},
|
|
169
199
|
// Astro
|
|
170
200
|
{
|
|
@@ -179,7 +209,7 @@ module.exports = {
|
|
|
179
209
|
parserOptions: {
|
|
180
210
|
extraFileExtensions: ['.astro'],
|
|
181
211
|
parser: '@typescript-eslint/parser',
|
|
182
|
-
project:
|
|
212
|
+
project: 'tsconfig.eslint.json', // Not sure why this isn't inherited
|
|
183
213
|
sourceType: 'module',
|
|
184
214
|
},
|
|
185
215
|
rules: {
|
|
@@ -187,11 +217,16 @@ module.exports = {
|
|
|
187
217
|
...globalRulesTypescript,
|
|
188
218
|
'@typescript-eslint/no-unsafe-assignment': 'off', // Crashing
|
|
189
219
|
'@typescript-eslint/no-unsafe-return': 'off', // Happens in templates
|
|
190
|
-
// Astro components are PascalCase
|
|
220
|
+
// Astro components are usually PascalCase,
|
|
221
|
+
// but when used as pages they are kebab-case
|
|
191
222
|
'unicorn/filename-case': [
|
|
192
223
|
'error',
|
|
193
224
|
{
|
|
194
|
-
|
|
225
|
+
cases: {
|
|
226
|
+
kebabCase: true,
|
|
227
|
+
pascalCase: true,
|
|
228
|
+
},
|
|
229
|
+
ignore: ['^\\[slug\\]\\.astro$'],
|
|
195
230
|
},
|
|
196
231
|
],
|
|
197
232
|
},
|
package/init/.eslintignore
CHANGED
package/init/.eslintrc.cjs
CHANGED