Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 61 additions & 16 deletions bundles/org.openhab.ui/web/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,45 +99,77 @@ const rules = {
'@typescript-eslint/no-empty-object-type': 'off'
}

// Type-checked configs for TypeScript files, which require type information and thus are separated from the main config to avoid performance issues for JavaScript files.
const tsTypeCheckedConfigs = tseslint.configs.recommendedTypeChecked.map((config) => ({
...config,
files: ['**/*.{ts,tsx}'],
ignores: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx'],
rules: {
...config.rules,
'@typescript-eslint/no-unsafe-call': 'off'
}
}))

// Type-checked configs for Vue files with TypeScript, which require type information and thus are separated from the main config to avoid performance issues for JavaScript files.
const vueTsTypeCheckedConfigs = tseslint.configs.recommendedTypeChecked.map((config) => ({
...config,
files: [
'**/*.vue?vue&type=script&lang=ts',
'**/*.vue?vue&type=script&lang.ts',
'**/*.vue?vue&type=script&lang=tsx',
'**/*.vue?vue&type=script&lang.tsx'
],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
extraFileExtensions: ['.vue']
}
}
}))

export default defineConfig([
...pluginVue.configs['flat/recommended'],
// eslintPluginPrettierRecommended,
...pluginVueI18n.configs.recommended,
eslint.configs.recommended,
tseslint.configs.recommended,
...tsTypeCheckedConfigs,
...vueTsTypeCheckedConfigs,
pluginImport.flatConfigs.recommended,
pluginImport.flatConfigs.typescript,
...pluginJsonc.configs['flat/recommended-with-jsonc'],
{
settings: {
'vue-i18n': {
localeDir: './src/assets/i18n/**/*.json',
messageSyntaxVersion: '^11.0.0',
}
}
},
{
files: ['*.vue', '**/*.vue'],
languageOptions: {
parser: parserVue,
parserOptions: {
parser: tseslint.parser
parser: tseslint.parser,
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
extraFileExtensions: ['.vue']
}
},
rules: rules,
settings: {
'vue-i18n': {
localeDir: './src/assets/i18n/**/*.json',
messageSyntaxVersion: '^11.0.0'
}
}
rules: rules
},
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsxn,json}'],
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx}'],
languageOptions: {
parser: tseslint.parser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
project: './tsconfig.json', // Path to your tsconfig.json
project: './tsconfig.eslint.json', // Path to your tsconfig.json
tsconfigRootDir: import.meta.dirname
}
},
languageOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
},
globals: {
...globals.browser,
...globals.node,
Expand All @@ -155,6 +187,19 @@ export default defineConfig([
}
}
},
{
files: ['src/assets/i18n/**/*.json'],
rules: {
'@intlify/vue-i18n/no-html-messages': 'off',
'no-irregular-whitespace': 'off'
}
},
{ // disable js rule for ts files, as they are already covered by the above config
files: ['**/*.{ts,tsx}'],
rules: {
'no-undef': 'off'
}
},
globalIgnores(['dist', 'build', 'public', '**/*.nearley.js', 'src/api/**']),
eslintConfigPrettier // Disables all ESLint rules that conflict with Prettier/oxfmt
])
13 changes: 13 additions & 0 deletions bundles/org.openhab.ui/web/patches/framework7+7.1.5.patch
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,16 @@ index f607800..24e6369 100644
"./less": "./framework7.less",
"./less/bundle": "./framework7-bundle.less",
"./css": "./framework7.css",
diff --git a/node_modules/framework7/shared/utils.d.ts b/node_modules/framework7/shared/utils.d.ts
index c88ac4c..e29088b 100644
--- a/node_modules/framework7/shared/utils.d.ts
+++ b/node_modules/framework7/shared/utils.d.ts
@@ -66,7 +66,7 @@ export interface Utils {
/** Returns unique number, increased by 1 with every call */
uniqueNumber: () => number;
/** Generates random ID-like string */
- id: (mask: string, map: string) => string;
+ id: (mask?: string, map?: string) => string;
/** Returns preloader inner content for MD theme */
mdPreloaderContent: () => string;
/** Returns preloader inner content for iOS theme */
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ import * as hintUtils from './hint-utils'
// So we import the raw data and parse it manually to avoid it
// @ts-expect-error - raw import has no type declaration
import EcmascriptRaw from '@/assets/ecmascript.json?raw'
const EcmascriptDefs: any = JSON.parse(EcmascriptRaw)
const EcmascriptDefs = JSON.parse(String(EcmascriptRaw)) as Definitions

import NashornDefs from '@/assets/nashorn-tern-defs.json'
import OpenhabJsDefs from '@/assets/openhab-js-tern-defs.json'

/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-return */

type Definitions = Record<string, any>

let GlobalTypes: Definitions = {}
Expand Down Expand Up @@ -136,7 +142,7 @@ function resolveDefinition(identifier: string, scopedDef: Definitions): Definiti
function resolveDefinitionFromPath(path: readonly string[]) {
let def: Definitions | undefined = GlobalIdentifiers
for (let segment of path) {
def = resolveDefinition(segment, def!)
def = resolveDefinition(segment, def)
if (!def) return
}
return def
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<template>
<f7-link v-if="iconVisible && runtimeStore.showDeveloperDock" icon-f7="question_circle_fill" @click="f7.emit('toggleDeveloperDock')" />
<f7-link
v-if="iconVisible && runtimeStore.showDeveloperDock"
icon-f7="question_circle_fill"
@click="f7.emit('toggleDeveloperDock' as Framework7Events)" />
<f7-link
v-else-if="iconVisible"
icon-f7="question_circle"
@click="f7.emit('selectDeveloperDock', { dock: 'help', helpTab: 'current' })" />
@click="f7.emit('selectDeveloperDock' as Framework7Events, { dock: 'help', helpTab: 'current' })" />
</template>

<script setup lang="ts">
Expand All @@ -12,6 +15,8 @@ import { f7 } from 'framework7-vue'
import { useUserStore } from '@/js/stores/useUserStore'
import { useRuntimeStore } from '@/js/stores/useRuntimeStore'

import type { Framework7Events } from '@/types/framework7-extensions'

const userStore = useUserStore()
const runtimeStore = useRuntimeStore()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const props = withDefaults(defineProps<{
saveLink?: string,
saveLinkUrl?: string,
large?: boolean,
f7router?: object,
f7router?: Router.Router,
}>(), {
backLink: 'Back',
editable: undefined,
Expand Down
Loading