Skip to content

Commit

Permalink
⬆️ ESLint 9 (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
NatoBoram authored Sep 2, 2024
1 parent c422d3d commit f06712d
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 363 deletions.
38 changes: 0 additions & 38 deletions .eslintignore

This file was deleted.

69 changes: 0 additions & 69 deletions .eslintrc.yaml

This file was deleted.

96 changes: 96 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import eslint from '@eslint/js'
import prettier from 'eslint-config-prettier'
import svelte from 'eslint-plugin-svelte'
import globals from 'globals'
import svelteParser from 'svelte-eslint-parser'
import tseslint from 'typescript-eslint'

/* eslint-disable @typescript-eslint/no-unsafe-member-access */

export default tseslint.config(
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
extends: [
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
prettier,
],
files: ['.js', '.mjs', '.mts', '.svelte', '.ts'].flatMap(e => [`**/*${e}`, `*${e}`]),
languageOptions: {
globals: { ...globals.browser, ...globals.node },
parser: tseslint.parser,
parserOptions: { extraFileExtensions: ['.svelte'], project: './tsconfig.eslint.json' },
},
rules: {
'@typescript-eslint/class-methods-use-this': [
'error',
{ ignoreClassesThatImplementAnInterface: true, ignoreOverrideMethods: true },
],
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ fixStyle: 'separate-type-imports' },
],
'@typescript-eslint/default-param-last': 'error',
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-useless-empty-export': 'error',
'@typescript-eslint/prefer-nullish-coalescing': ['error', { ignorePrimitives: true }],
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-regexp-exec': 'error',
'@typescript-eslint/promise-function-async': ['error', { checkArrowFunctions: false }],
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowBoolean: true, allowNullish: true, allowNumber: true, allowRegExp: true },
],
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'func-style': ['error', 'declaration'],

'@typescript-eslint/no-throw-literal': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
},
},

{
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
extends: [...svelte.configs['flat/recommended'], ...svelte.configs['flat/prettier']],
files: ['.svelte'].flatMap(e => [`**/*${e}`, `*${e}`]),
languageOptions: {
parser: svelteParser,
parserOptions: { project: './tsconfig.eslint.json', parser: tseslint.parser },
},
rules: { 'svelte/no-at-html-tags': 'off' },
},

{
ignores: [
'.pnpm-store/',
'.svelte-kit/',
'android/app/build/',
'android/app/src/main/assets/public/',
'build/',
'capacitor-cordova-android-plugins/',
'coverage/',
'dist/',
'node_modules/',
'package/',
'playwright-report/',
'test-results/',

'*.cjs',
'*.tsbuildinfo',
'**/$types.d.ts',
'vite.config.js.timestamp-*',
'vite.config.ts.timestamp-*',
],
},
)
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"devDependencies": {
"@capacitor/assets": "^3.0.5",
"@capacitor/cli": "^5.7.8",
"@eslint/js": "^9.9.1",
"@natoboram/heroicons.svelte": "^1.0.6",
"@playwright/test": "^1.41.2",
"@prettier/plugin-xml": "^3.4.1",
Expand All @@ -100,14 +101,13 @@
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@ts-stack/markdown": "^1.5.0",
"@types/cookie": "^0.6.0",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"autoprefixer": "^10.4.20",
"cookie": "^0.6.0",
"eslint": "^8.57.0",
"eslint": "^9.9.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"eslint-plugin-svelte": "^2.43.0",
"globals": "^15.9.0",
"highlight.js": "^11.10.0",
"lemmy-js-client": "0.19.0",
"postcss": "^8.4.42",
Expand All @@ -117,9 +117,11 @@
"publint": "^0.2.10",
"svelte": "^4.2.19",
"svelte-check": "^3.8.6",
"svelte-eslint-parser": "^0.41.0",
"tailwindcss": "^3.4.10",
"tslib": "^2.7.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.3.0",
"vite": "^5.0.12",
"vitest": "^1.2.2"
},
Expand Down
Loading

0 comments on commit f06712d

Please sign in to comment.