Skip to content

Commit

Permalink
Replace deprecated eslint rules with eslint-stylistic
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Feb 12, 2024
1 parent 75f0c13 commit 7462978
Show file tree
Hide file tree
Showing 19 changed files with 209 additions and 44 deletions.
34 changes: 21 additions & 13 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@stylistic/disable-legacy',
],
plugins: [
'@typescript-eslint',
'import',
'@stylistic',
],
parserOptions: {
sourceType: 'module',
Expand All @@ -26,17 +28,19 @@ module.exports = {
parser: '@typescript-eslint/parser',
},
rules: {
'svelte/indent': ['error', { indent: 2 }],
/// linting
'svelte/valid-compile': ['error', { ignoreWarnings: true }],
'svelte/no-extra-reactive-curlies': 'warn',
'svelte/html-self-closing': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
/// formatting
'@stylistic/indent': 'off',
'svelte/indent': ['error', { indent: 2 }],
'svelte/first-attribute-linebreak': 'warn',
'svelte/max-attributes-per-line': ['warn', { singleline: 3 }],
'svelte/mustache-spacing': 'warn',
'svelte/no-extra-reactive-curlies': 'warn',
'svelte/no-spaces-around-equal-signs-in-attribute': 'error',
'svelte/sort-attributes': 'warn',
'svelte/html-self-closing': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
indent: 'off',
},
},
{
Expand All @@ -60,16 +64,20 @@ module.exports = {
node: true,
},
rules: {
'no-multi-spaces': 'error',
indent: ['error', 2],
quotes: ['error', 'single'],
/// linting
curly: ['error', 'multi-line'],
'no-extra-semi': 'error',
'no-var': 'error',
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
semi: ['error', 'always'],
'comma-dangle': ['error', 'always-multiline'],
'object-curly-spacing': ['error', 'always'],
/// formatting
// general
'@stylistic/no-multi-spaces': 'error',
'@stylistic/indent': ['error', 2],
'@stylistic/quotes': ['error', 'single'],
'@stylistic/no-extra-semi': 'error',
'@stylistic/quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
'@stylistic/semi': ['error', 'always'],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/object-curly-spacing': ['error', 'always'],
// imports
'import/order': ['error', { 'newlines-between': 'always' }],
'import/newline-after-import': ['error'],
'import/no-duplicates': ['error'],
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@mdi/js": "^7.3.67",
"@skeletonlabs/skeleton": "^2.7.1",
"@skeletonlabs/tw-plugin": "^0.3.1",
"@stylistic/eslint-plugin": "^1.6.1",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@tsconfig/svelte": "^5.0.2",
"@types/async": "^3.2.24",
Expand Down
156 changes: 156 additions & 0 deletions frontend/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion frontend/src/lib/components/Select.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}
// eslint-disable-next-line no-undef
const dispatch = createEventDispatcher<{change: T}>();
const dispatch = createEventDispatcher<{ change: T }>();
function onChange({ target }: Event) {
const newValue = (target as HTMLButtonElement).value;
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/lib/components/left-bar/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
closeQuery: '[data-popup="start-view-menu"] .listbox-item',
} satisfies PopupSettings;
let views: {id: ViewType, name: string}[] = [
let views: { id: ViewType, name: string }[] = [
{
id: 'compact',
name: 'Compact',
Expand All @@ -55,7 +55,7 @@
closeQuery: '[data-popup="update-check-mode-menu"] .listbox-item',
} satisfies PopupSettings;
let updateCheckModes: {id: 'launch'|'exit'|'ask', name: string}[] = [
let updateCheckModes: { id: 'launch'|'exit'|'ask', name: string }[] = [
{
id: 'launch',
name: 'On start',
Expand All @@ -80,7 +80,7 @@
closeQuery: '[data-popup="queue-mode-menu"] .listbox-item',
} satisfies PopupSettings;
let queueModes: {id: boolean, name: string}[] = [
let queueModes: { id: boolean, name: string }[] = [
{
id: true,
name: 'Start immediately',
Expand All @@ -101,7 +101,7 @@
closeQuery: '[data-popup="launch-button-menu"] .listbox-item',
} satisfies PopupSettings;
let launchButtons: {id: LaunchButtonType, name: string}[] = [
let launchButtons: { id: LaunchButtonType, name: string }[] = [
{
id: 'normal',
name: 'Normal',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/modals/ErrorModal.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { GenerateDebugInfo } from '$lib/generated/wailsjs/go/app/app';
export let parent: {onClose: () => void};
export let parent: { onClose: () => void };
export let error: string;
</script>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/modals/ModChangelog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { GetChangelogDocument } from '$lib/generated';
import { offline } from '$lib/store/settingsStore';
export let parent: {onClose: () => void};
export let parent: { onClose: () => void };
export let mod: string;
export let versionRange: string | { from: string, to: string };
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/modals/ModImage.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
// Skeleton passes the parent prop to the modal component, and we would get a warning if the prop is not present here
export let parent: {onClose: () => void};
export let parent: { onClose: () => void };
// Just so that it's not unused
$: parent;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/modals/ServerManager.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export let parent: { onClose: () => void };
type RemoteType = ({ type: 'remote'; protocol: string; } | { type: 'local' }) & { name: string; }
type RemoteType = ({ type: 'remote'; protocol: string; } | { type: 'local' }) & { name: string; };
const remoteTypes: RemoteType[] = [
{ type: 'remote', protocol: 'ftp://', name: 'FTP' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { selectedProfile } from '$lib/store/ficsitCLIStore';
import { error } from '$lib/store/generalStore';
export let parent: {onClose: () => void};
export let parent: { onClose: () => void };
async function finishAddProfile() {
try {
Expand Down
Loading

0 comments on commit 7462978

Please sign in to comment.