Skip to content

Commit

Permalink
chore: update eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
BearToCode committed Oct 17, 2024
1 parent 14d44d6 commit 6af4f68
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 41 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

34 changes: 0 additions & 34 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions docs/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-require-imports */
const tailwindcss = require('tailwindcss');
const autoprefixer = require('autoprefixer');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let enabled = false;
$: {
$page.url;
$page.url = $page.url;
enabled = false;
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/routes/[...slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
});
$: if (mounted) {
$page.url;
$page.url = $page.url;
clientSideComponent = null;
renderClientSideComponent();
}
Expand Down
89 changes: 89 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import parser from 'svelte-eslint-parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
{
ignores: [
'**/dist',
'**/build',
'**/.svelte-kit',
'**/assets',
'.DS_Store',
'node_modules',
'/build',
'/.svelte-kit',
'/package',
'.env',
'.env.*',
'!.env.example',
'vite.config.js.timestamp-*',
'vite.config.ts.timestamp-*',
'.eslintcache',
'.pnpm-debug.log',
'**/dis',
'**/tsconfig.tsbuildinf',
'**/.rollup.cache'
]
},
...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended'
),
{
plugins: {
'@typescript-eslint': typescriptEslint
},

languageOptions: {
globals: {
...globals.node,
...globals.browser
},

parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',

parserOptions: {
extraFileExtensions: ['.svelte']
}
},

settings: {
'svelte3/typescript': true
},

rules: {
'no-mixed-spaces-and-tabs': 0,
'@typescript-eslint/no-unused-expressions': 0
}
},
{
files: ['**/*.svelte'],

languageOptions: {
parser: parser,
ecmaVersion: 5,
sourceType: 'script',

parserOptions: {
parser: '@typescript-eslint/parser'
}
}
}
];
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"commit": "cz"
},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.12.0",
"@types/node": "^18.16.3",
"@typescript-eslint/eslint-plugin": "^8.10.0",
"@typescript-eslint/parser": "^8.10.0",
Expand All @@ -28,6 +30,7 @@
"eslint": "^9.12.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-svelte": "^2.45.1",
"globals": "^15.11.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"ora": "^6.3.0",
Expand Down
1 change: 0 additions & 1 deletion packages/carta-md/src/lib/internal/carta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export interface Plugin {
* Unified transformers plugins.
* @important If the plugin is async, it will not run in SSR rendering.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transformers?: UnifiedTransformer<'sync' | 'async'>[];
/**
* Additional keyboard shortcuts.
Expand Down
2 changes: 1 addition & 1 deletion packages/carta-md/src/lib/internal/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ export class InputEnhancer {
destroy: () => {
try {
data.portal.removeChild(elem);
} catch (e: unknown) {
} catch {
// Ignore
}
this.textarea.removeEventListener('input', callback);
Expand Down
2 changes: 1 addition & 1 deletion packages/carta-md/src/lib/internal/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Workaround to add intellisense
// eslint-disable-next-line @typescript-eslint/no-empty-interface
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface Nothing {}
type Union<T, U> = T | (U & Nothing);

Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6af4f68

Please sign in to comment.