@aneuhold/eslint-config 2.0.1 → 2.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": "@aneuhold/eslint-config",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Main ESLint Configuration for personal projects",
5
5
  "main": "./src/ts-lib-config.js",
6
6
  "packageManager": "pnpm@10.21.0",
@@ -5,10 +5,15 @@ import simpleImportSort from 'eslint-plugin-simple-import-sort';
5
5
  import eslintPluginSvelte from 'eslint-plugin-svelte';
6
6
  import { defineConfig } from 'eslint/config';
7
7
  import globals from 'globals';
8
- import svelteParser from 'svelte-eslint-parser';
9
8
  import tseslint from 'typescript-eslint';
10
9
 
11
- const defaultConfig = defineConfig(
10
+ // Shared extraFileExtensions constant to avoid project service reloads.
11
+ // See: https://typescript-eslint.io/troubleshooting/typed-linting/performance/#changes-to-extrafileextensions-with-projectservice
12
+ const extraFileExtensions = ['.svelte'];
13
+
14
+ export default defineConfig(
15
+ // 1. Global config: applies to all linted files (js, ts, svelte)
16
+ // Sets up ESLint recommended + TypeScript strict + JSDoc + Prettier compat
12
17
  {
13
18
  files: ['**/*.js', '**/*.ts', '**/*.svelte'],
14
19
  extends: [
@@ -24,13 +29,13 @@ const defaultConfig = defineConfig(
24
29
  parser: tseslint.parser,
25
30
  parserOptions: {
26
31
  sourceType: 'module',
27
- extraFileExtensions: ['.svelte'],
32
+ extraFileExtensions,
28
33
  projectService: true,
29
34
  },
30
35
  globals: { ...globals.browser, ...globals.node },
31
36
  },
32
37
  // Rules for js, and ts in ts files and svelte files
33
- //don't set 'svelte/*' rules here
38
+ // Don't set 'svelte/*' rules here
34
39
  rules: {
35
40
  // Makes it so that there's 1 line above tags in jsdoc comments.
36
41
  'jsdoc/tag-lines': ['warn', 'any', { startLines: 1 }],
@@ -84,12 +89,16 @@ const defaultConfig = defineConfig(
84
89
  // Disabled because on the frontend, it isn't always necessary to await
85
90
  // a promise.
86
91
  '@typescript-eslint/no-floating-promises': 'off',
87
- // The below have to be disabled because of the issue with svelte TS
88
- // types not being recognized in TS files, and vice versa.
92
+ // The below have to be disabled because svelte-eslint-parser cannot
93
+ // resolve types from imported .svelte files (it doesn't use svelte2tsx
94
+ // like VS Code's Svelte extension does), so types from
95
+ // ComponentProps<typeof SvelteComponent> and similar patterns resolve
96
+ // as `any`. See: https://github.com/sveltejs/eslint-plugin-svelte/issues/1303
89
97
  '@typescript-eslint/no-unsafe-member-access': 'off',
90
98
  '@typescript-eslint/no-unsafe-call': 'off',
91
99
  '@typescript-eslint/no-unsafe-return': 'off',
92
100
  '@typescript-eslint/no-unsafe-assignment': 'off',
101
+ '@typescript-eslint/no-unsafe-argument': 'off',
93
102
  '@typescript-eslint/no-unused-vars': [
94
103
  'error',
95
104
  {
@@ -102,53 +111,56 @@ const defaultConfig = defineConfig(
102
111
  // Turned off because it doesn't seem too helpful, and it likes to error
103
112
  // on things that seem to be just fine in generics.
104
113
  '@typescript-eslint/no-unnecessary-type-parameters': 'off',
114
+ // Disabled due to false positives with Svelte components
115
+ '@typescript-eslint/no-useless-default-assignment': 'off',
116
+ // Disabled because it wasn't working correctly with Svelte snippets
117
+ '@typescript-eslint/no-confusing-void-expression': 'off',
118
+ // Disabled because it doesn't make sense IMO. This should be disabled globally.
119
+ '@typescript-eslint/prefer-literal-enum-member': 'off',
105
120
  },
106
121
  },
122
+
123
+ // 2. Disable type-aware linting on JS files
107
124
  {
108
- // disable type-aware linting on JS files
109
125
  files: ['**/*.js'],
110
126
  extends: [tseslint.configs.disableTypeChecked],
111
- }
112
- );
127
+ },
113
128
 
114
- const svelteConfig = defineConfig({
115
- files: ['**/*.svelte'],
129
+ // 3. Svelte config: recommended rules + prettier compat for svelte files.
130
+ // eslint-plugin-svelte's flat/recommended already includes base config
131
+ // which sets up svelte-eslint-parser and the svelte processor.
132
+ // flat/prettier disables svelte rules that conflict with Prettier.
116
133
  // @ts-expect-error - eslint-plugin-svelte is not typed
117
- extends: [
118
- ...eslintPluginSvelte.configs['flat/recommended'],
119
- ...eslintPluginSvelte.configs['flat/prettier'],
120
- ],
121
- languageOptions: {
122
- parser: svelteParser,
123
- parserOptions: {
124
- parser: tseslint.parser,
125
- sourceType: 'module',
126
- extraFileExtensions: ['.svelte'],
127
- projectService: true,
128
- },
129
- },
130
- // Svelte Rules
131
- rules: {
132
- 'svelte/no-navigation-without-resolve': [
133
- 'error',
134
- {
135
- ignoreGoto: false,
136
- ignoreLinks: true,
137
- ignorePushState: false,
138
- ignoreReplaceState: false,
134
+ ...eslintPluginSvelte.configs['flat/recommended'],
135
+ // @ts-expect-error - eslint-plugin-svelte is not typed
136
+ ...eslintPluginSvelte.configs['flat/prettier'],
137
+
138
+ // 4. TypeScript integration for Svelte files: tell svelte-eslint-parser
139
+ // to delegate <script> parsing to @typescript-eslint/parser with
140
+ // project service for type-aware linting.
141
+ // See: https://sveltejs.github.io/eslint-plugin-svelte/ (TypeScript project section)
142
+ {
143
+ files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
144
+ languageOptions: {
145
+ parserOptions: {
146
+ parser: tseslint.parser,
147
+ extraFileExtensions,
148
+ projectService: true,
139
149
  },
140
- ],
150
+ },
141
151
  },
142
- });
143
152
 
144
- export default defineConfig(
145
- ...defaultConfig,
146
- ...svelteConfig,
153
+ // 5. Svelte rule overrides
147
154
  {
148
- // other override settings. e.g. for `files: ['**/*.test.*']`
155
+ files: ['**/*.svelte'],
156
+ rules: {
157
+ // Disabling this because we have a bunch of dynamic routes
158
+ 'svelte/no-navigation-without-resolve': 'off',
159
+ },
149
160
  },
161
+
162
+ // 6. Global ignores
150
163
  {
151
- // overrides global ignores
152
164
  ignores: ['.svelte-kit', '.yarn', 'build', 'node_modules', '**/.DS_Store'],
153
165
  }
154
166
  );
@@ -27,6 +27,9 @@ const defaultConfig = defineConfig(
27
27
  // Makes it so that there's 1 line above tags in jsdoc comments.
28
28
  'jsdoc/tag-lines': ['error', 'any', { startLines: 1 }],
29
29
  'jsdoc/require-returns': 'off',
30
+ // Disabled because it doesn't seem to support triple back-tick code blocks at the moment
31
+ // 2/21/2026.
32
+ 'jsdoc/escape-inline-tags': 'off',
30
33
  'no-use-before-define': 'off',
31
34
  'no-undef': 'off',
32
35
  // Just 100% disagree with this rule. The reasoning is that using a