Skip to content

Commit 224d630

Browse files
committed
chore: add explicit extensions eslint rule
1 parent 4a9afb5 commit 224d630

File tree

7 files changed

+1037
-4
lines changed

7 files changed

+1037
-4
lines changed

eslint.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import globals from 'globals';
66
import { fileURLToPath } from 'node:url';
77
import ts from 'typescript-eslint';
88
import svelteConfig from './svelte.config.js';
9+
import eslint_plugin_import from 'eslint-plugin-import';
910

1011
const gitignore_path = fileURLToPath(new URL('./.gitignore', import.meta.url));
1112

@@ -14,6 +15,7 @@ export default ts.config(
1415
js.configs.recommended,
1516
...ts.configs.recommended,
1617
...svelte.configs.recommended,
18+
eslint_plugin_import.flatConfigs.recommended,
1719
prettier,
1820
...svelte.configs.prettier,
1921
{
@@ -33,11 +35,34 @@ export default ts.config(
3335
},
3436
],
3537
'func-style': ['error', 'declaration', { allowTypeAnnotation: true }],
38+
'import/no-unresolved': 'off', // this doesn't work well with typescript path mapping
39+
'import/extensions': [
40+
'error',
41+
'ignorePackages',
42+
{
43+
js: 'always',
44+
mjs: 'always',
45+
cjs: 'always',
46+
ts: 'always',
47+
svelte: 'always',
48+
},
49+
],
3650
},
3751
},
3852
{
3953
files: ['./src/lib/**/*'],
4054
rules: {
55+
'import/extensions': [
56+
'error',
57+
'ignorePackages',
58+
{
59+
js: 'always',
60+
mjs: 'always',
61+
cjs: 'always',
62+
ts: 'always',
63+
svelte: 'always',
64+
},
65+
],
4166
'no-restricted-imports': [
4267
'error',
4368
{

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"drizzle-kit": "^0.30.2",
5151
"drizzle-orm": "^0.40.0",
5252
"eslint-config-prettier": "^10.0.1",
53+
"eslint-plugin-import": "^2.32.0",
5354
"globals": "^16.0.0",
5455
"prettier": "^3.4.2",
5556
"prettier-plugin-svelte": "^3.3.3",

0 commit comments

Comments
 (0)