2024-06-26 19:01:09 +03:00
|
|
|
import js from '@eslint/js';
|
|
|
|
import tsParser from '@typescript-eslint/parser';
|
|
|
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
|
|
import eslintPluginSvelte from 'eslint-plugin-svelte';
|
|
|
|
import globals from 'globals';
|
|
|
|
import tsEslint from 'typescript-eslint';
|
|
|
|
import pluginImportX from 'eslint-plugin-import-x';
|
2024-06-27 17:37:54 +03:00
|
|
|
// Flat config support: https://github.com/storybookjs/eslint-plugin-storybook/pull/156
|
|
|
|
import storybook from 'eslint-plugin-storybook';
|
|
|
|
import svelteParser from 'svelte-eslint-parser';
|
2024-06-26 19:01:09 +03:00
|
|
|
|
|
|
|
export default tsEslint.config(
|
|
|
|
js.configs.recommended,
|
2024-06-27 17:42:22 +03:00
|
|
|
...storybook.configs['flat/recommended'],
|
2024-06-26 19:01:09 +03:00
|
|
|
...tsEslint.configs.recommended,
|
|
|
|
...eslintPluginSvelte.configs['flat/recommended'],
|
|
|
|
eslintConfigPrettier,
|
|
|
|
...eslintPluginSvelte.configs['flat/prettier'],
|
2024-08-16 16:30:53 +03:00
|
|
|
{
|
|
|
|
files: ['apps/desktop/e2e/**'],
|
|
|
|
languageOptions: {
|
|
|
|
ecmaVersion: 2021,
|
|
|
|
sourceType: 'module',
|
|
|
|
globals: {
|
|
|
|
...globals.node,
|
|
|
|
...globals.browser,
|
|
|
|
...globals.mocha,
|
|
|
|
...globals.chai,
|
|
|
|
$: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-06-26 19:01:09 +03:00
|
|
|
{
|
|
|
|
files: ['**/*.svelte'],
|
|
|
|
languageOptions: {
|
|
|
|
ecmaVersion: 2021,
|
|
|
|
sourceType: 'module',
|
|
|
|
globals: {
|
|
|
|
...globals.node,
|
|
|
|
...globals.browser,
|
|
|
|
$state: 'readonly',
|
|
|
|
$derived: 'readonly',
|
|
|
|
$props: 'readonly',
|
|
|
|
$bindable: 'readonly',
|
|
|
|
$inspect: 'readonly',
|
2024-07-08 12:38:50 +03:00
|
|
|
$host: 'readonly',
|
|
|
|
$effect: 'readonly'
|
2024-06-26 19:01:09 +03:00
|
|
|
},
|
|
|
|
parser: svelteParser,
|
|
|
|
parserOptions: {
|
|
|
|
parser: tsParser,
|
2024-09-11 17:00:04 +03:00
|
|
|
extraFileExtensions: ['.svelte'],
|
|
|
|
svelteFeatures: {
|
|
|
|
experimentalGenerics: true
|
|
|
|
}
|
2024-06-26 19:01:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ignores: [
|
|
|
|
'**/.*', // dotfiles aren't ignored by default in FlatConfig
|
|
|
|
'.*', // dotfiles aren't ignored by default in FlatConfig
|
|
|
|
'**/.DS_Store',
|
|
|
|
'**/node_modules',
|
2024-06-28 13:15:11 +03:00
|
|
|
'**/butler/target',
|
|
|
|
'**/build',
|
|
|
|
'**/dist',
|
2024-06-26 19:01:09 +03:00
|
|
|
'.svelte-kit',
|
2024-06-28 13:15:11 +03:00
|
|
|
'**/package',
|
2024-06-26 19:01:09 +03:00
|
|
|
'**/.env',
|
|
|
|
'**/.env.*',
|
|
|
|
'!**/.env.example',
|
|
|
|
'**/pnpm-lock.yaml',
|
|
|
|
'**/package-lock.json',
|
|
|
|
'**/yarn.lock',
|
|
|
|
'.github',
|
|
|
|
'.vscode',
|
|
|
|
'src-tauri',
|
2024-06-28 13:15:11 +03:00
|
|
|
'**/eslint.config.js',
|
|
|
|
'**/svelte.config.js',
|
2024-06-27 17:37:54 +03:00
|
|
|
'**/.pnpm-store',
|
2024-07-11 13:13:25 +03:00
|
|
|
'**/vite.config.ts.timestamp-*',
|
2024-06-28 13:15:11 +03:00
|
|
|
'!.storybook',
|
|
|
|
'target/',
|
2024-08-05 12:45:45 +03:00
|
|
|
'crates/',
|
2024-10-03 21:51:01 +03:00
|
|
|
'packages/ui/storybook-static',
|
2024-08-05 12:45:45 +03:00
|
|
|
// We're having issues parsing splat syntax in svelte components
|
|
|
|
'packages/ui/src/stories/**/*.svelte'
|
2024-06-26 19:01:09 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
languageOptions: {
|
|
|
|
parserOptions: {
|
|
|
|
parser: tsEslint.parser,
|
2024-07-25 18:53:28 +03:00
|
|
|
project: ['./packages/**/tsconfig.json', './apps/**/tsconfig.json'],
|
2024-06-26 19:01:09 +03:00
|
|
|
extraFileExtensions: ['.svelte']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
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'],
|
|
|
|
'@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: '^_'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
'no-return-await': 'off',
|
|
|
|
'@typescript-eslint/return-await': ['error', 'always'],
|
|
|
|
'@typescript-eslint/promise-function-async': 'error',
|
|
|
|
'@typescript-eslint/await-thenable': 'error',
|
|
|
|
'svelte/no-at-html-tags': 'off'
|
|
|
|
},
|
|
|
|
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-06-28 13:41:18 +03:00
|
|
|
'./packages/ui/.svelte-kit/tsconfig.json'
|
2024-06-28 13:15:11 +03:00
|
|
|
]
|
2024-06-26 19:01:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
plugins: {
|
|
|
|
'import-x': pluginImportX
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|