Merged in fix/linting (pull request #2708)

Fix/linting

* fix import issues and add lint check no-extraneous-dependencies
* fix use type HotelType instead of string

Approved-by: Anton Gunnarsson
This commit is contained in:
Joakim Jäderberg
2025-08-27 09:22:37 +00:00
parent 67bdf5bbcf
commit 80c3327419
55 changed files with 250 additions and 135 deletions

View File

@@ -7,11 +7,16 @@ import js from '@eslint/js'
import importPlugin from 'eslint-plugin-import'
import formatjs from 'eslint-plugin-formatjs'
import { fileURLToPath } from 'node:url'
import path from 'node:path'
const compat = new FlatCompat({
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
const packageDir = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig([
{
languageOptions: {
@@ -31,8 +36,28 @@ export default defineConfig([
import: importPlugin,
formatjs,
},
settings: {
// Ensure the plugin can resolve workspace packages and TS path aliases
'import/resolver': {
typescript: {
project: [path.join(packageDir, 'tsconfig.json')],
alwaysTryTypes: true,
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
'import/no-relative-packages': 'error',
'import/no-extraneous-dependencies': [
'error',
{
includeInternal: true,
includeTypes: true,
packageDir: [packageDir],
},
],
'react-refresh/only-export-components': [
'warn',
{
@@ -53,5 +78,11 @@ export default defineConfig([
'formatjs/prefer-pound-in-plural': ['error'],
},
},
globalIgnores(['**/dist', '**/.eslintrc.cjs']),
{
files: ['**/*.stories.tsx'],
rules: {
'formatjs/no-literal-string-in-jsx': 'off',
},
},
globalIgnores(['**/dist', '**/.eslintrc.cjs', '**/storybook-static']),
])