2024-10-21 12:50:10 +03:00
|
|
|
import prettier from 'eslint-config-prettier';
|
2024-06-26 19:01:09 +03:00
|
|
|
import js from '@eslint/js';
|
2024-10-21 12:50:10 +03:00
|
|
|
import svelte from 'eslint-plugin-svelte';
|
2024-06-26 19:01:09 +03:00
|
|
|
import globals from 'globals';
|
2024-10-21 12:50:10 +03:00
|
|
|
import ts from 'typescript-eslint';
|
2024-10-21 17:03:03 +03:00
|
|
|
import pluginImportX from 'eslint-plugin-import-x';
|
2024-06-26 19:01:09 +03:00
|
|
|
|
2024-10-21 12:50:10 +03:00
|
|
|
export default ts.config(
|
2024-06-26 19:01:09 +03:00
|
|
|
js.configs.recommended,
|
2024-10-21 12:50:10 +03:00
|
|
|
...ts.configs.recommended,
|
|
|
|
...svelte.configs['flat/recommended'],
|
|
|
|
prettier,
|
|
|
|
...svelte.configs['flat/prettier'],
|
2024-08-16 16:30:53 +03:00
|
|
|
{
|
|
|
|
languageOptions: {
|
|
|
|
globals: {
|
|
|
|
...globals.browser,
|
2024-10-21 12:50:10 +03:00
|
|
|
...globals.node
|
2024-10-26 16:54:38 +03:00
|
|
|
},
|
|
|
|
parserOptions: {
|
|
|
|
projectService: true
|
2024-06-26 19:01:09 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
rules: {
|
2024-10-21 17:03:03 +03:00
|
|
|
'@typescript-eslint/no-namespace': 'off',
|
|
|
|
'@typescript-eslint/no-empty-function': 'off',
|
|
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
|
|
'@typescript-eslint/no-unused-vars': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
argsIgnorePattern: '^_',
|
|
|
|
varsIgnorePattern: '^_',
|
|
|
|
caughtErrorsIgnorePattern: '^_'
|
|
|
|
}
|
|
|
|
],
|
2024-10-26 16:54:38 +03:00
|
|
|
'@typescript-eslint/return-await': ['error', 'always'],
|
|
|
|
'@typescript-eslint/promise-function-async': 'error',
|
|
|
|
'@typescript-eslint/await-thenable': 'error',
|
2024-10-21 17:03:03 +03:00
|
|
|
|
2024-06-26 19:01:09 +03:00
|
|
|
eqeqeq: ['error', 'always'],
|
|
|
|
'import-x/no-cycle': 'error',
|
|
|
|
'import-x/order': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
alphabetize: {
|
|
|
|
order: 'asc',
|
|
|
|
orderImportKind: 'asc',
|
|
|
|
caseInsensitive: false
|
|
|
|
},
|
|
|
|
groups: [
|
|
|
|
'index',
|
|
|
|
'sibling',
|
|
|
|
'parent',
|
|
|
|
'internal',
|
|
|
|
'external',
|
|
|
|
'builtin',
|
|
|
|
'object',
|
|
|
|
'type'
|
|
|
|
],
|
|
|
|
'newlines-between': 'never'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
'import-x/no-unresolved': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
ignore: ['^\\$app', '^\\$env']
|
|
|
|
}
|
|
|
|
],
|
2024-07-02 16:00:47 +03:00
|
|
|
'import-x/no-relative-packages': 'error', // Don't allow packages to have relative imports between each other
|
2024-06-26 19:01:09 +03:00
|
|
|
'func-style': [2, 'declaration'],
|
|
|
|
'no-return-await': 'off',
|
2024-10-24 17:32:50 +03:00
|
|
|
'svelte/no-at-html-tags': 'off',
|
|
|
|
'svelte/button-has-type': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
button: true,
|
|
|
|
submit: true,
|
|
|
|
reset: true
|
|
|
|
}
|
|
|
|
]
|
2024-06-26 19:01:09 +03:00
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
'import-x/extensions': ['.ts'],
|
|
|
|
'import-x/parsers': {
|
|
|
|
'@typescript-eslint/parser': ['.ts']
|
|
|
|
},
|
|
|
|
'import-x/resolver': {
|
|
|
|
typescript: {
|
2024-06-28 13:15:11 +03:00
|
|
|
project: [
|
2024-07-25 18:53:28 +03:00
|
|
|
'./apps/desktop/tsconfig.json',
|
|
|
|
'./apps/desktop/.svelte-kit/tsconfig.json',
|
|
|
|
'./apps/web/tsconfig.json',
|
|
|
|
'./apps/web/.svelte-kit/tsconfig.json',
|
2024-06-28 13:15:11 +03:00
|
|
|
'./packages/**/tsconfig.json',
|
2024-10-21 12:50:10 +03:00
|
|
|
'./packages/ui/.svelte-kit/tsconfig.json',
|
|
|
|
'./packages/shared/.svelte-kit/tsconfig.json'
|
2024-06-28 13:15:11 +03:00
|
|
|
]
|
2024-06-26 19:01:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
plugins: {
|
|
|
|
'import-x': pluginImportX
|
|
|
|
}
|
2024-10-21 12:50:10 +03:00
|
|
|
},
|
2024-10-26 16:54:38 +03:00
|
|
|
{
|
|
|
|
files: ['**/*.svelte'],
|
|
|
|
...ts.configs.disableTypeChecked
|
|
|
|
},
|
2024-10-21 12:50:10 +03:00
|
|
|
{
|
|
|
|
files: ['**/*.svelte'],
|
|
|
|
languageOptions: {
|
|
|
|
parserOptions: {
|
|
|
|
parser: ts.parser
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ignores: [
|
|
|
|
'**/.*', // dotfiles aren't ignored by default in FlatConfig
|
|
|
|
'.*', // dotfiles aren't ignored by default in FlatConfig
|
|
|
|
'**/.DS_Store',
|
|
|
|
'**/node_modules',
|
|
|
|
'**/butler/target',
|
|
|
|
'**/build',
|
|
|
|
'**/dist',
|
|
|
|
'.svelte-kit',
|
|
|
|
'**/package',
|
|
|
|
'**/.env',
|
|
|
|
'**/.env.*',
|
|
|
|
'!**/.env.example',
|
|
|
|
'**/pnpm-lock.yaml',
|
|
|
|
'**/package-lock.json',
|
|
|
|
'**/yarn.lock',
|
|
|
|
'.github',
|
|
|
|
'.vscode',
|
|
|
|
'**/eslint.config.js',
|
|
|
|
'**/svelte.config.js',
|
|
|
|
'**/.pnpm-store',
|
|
|
|
'**/vite.config.ts.timestamp-*',
|
|
|
|
'!.storybook',
|
|
|
|
'target/',
|
|
|
|
'crates/',
|
2024-10-21 18:15:49 +03:00
|
|
|
'packages/ui/storybook-static',
|
|
|
|
// Storybook Meta type wrapper
|
|
|
|
'packages/ui/src/stories/**/*.stories.ts'
|
2024-10-21 12:50:10 +03:00
|
|
|
]
|
2024-06-26 19:01:09 +03:00
|
|
|
}
|
|
|
|
);
|