fix(SW-3616): Handle EuroBonus point type everywhere * Add tests to formatPrice * formatPrice * More work replacing config with api points type * More work replacing config with api points type * More fixing with currency * maybe actually fixed it * Fix MyStay * Clean up * Fix comments * Merge branch 'master' into fix/refactor-currency-display * Fix calculateTotalPrice for EB points + SF points + cash Approved-by: Joakim Jäderberg
107 lines
2.9 KiB
JavaScript
107 lines
2.9 KiB
JavaScript
import { defineConfig, globalIgnores } from "eslint/config"
|
|
import globals from "globals"
|
|
import tsParser from "@typescript-eslint/parser"
|
|
import reactRefresh from "eslint-plugin-react-refresh"
|
|
import react from "eslint-plugin-react"
|
|
import { FlatCompat } from "@eslint/eslintrc"
|
|
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: {
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
parser: tsParser,
|
|
},
|
|
extends: compat.extends(
|
|
"eslint:recommended",
|
|
"plugin:@typescript-eslint/recommended",
|
|
"plugin:react-hooks/recommended",
|
|
"plugin:storybook/recommended"
|
|
),
|
|
plugins: {
|
|
"react-refresh": reactRefresh,
|
|
import: importPlugin,
|
|
formatjs,
|
|
react,
|
|
},
|
|
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: {
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{
|
|
argsIgnorePattern: "^_",
|
|
varsIgnorePattern: "^_",
|
|
caughtErrorsIgnorePattern: "^_",
|
|
},
|
|
],
|
|
"import/no-relative-packages": "error",
|
|
"import/no-extraneous-dependencies": [
|
|
"error",
|
|
{
|
|
includeInternal: true,
|
|
includeTypes: true,
|
|
packageDir: [packageDir],
|
|
},
|
|
],
|
|
"react-refresh/only-export-components": [
|
|
"warn",
|
|
{
|
|
allowConstantExport: true,
|
|
},
|
|
],
|
|
"react/jsx-curly-brace-presence": [
|
|
"error",
|
|
{
|
|
props: "never",
|
|
children: "never",
|
|
propElementValues: "always",
|
|
},
|
|
],
|
|
|
|
"formatjs/enforce-default-message": ["error", "literal"],
|
|
"formatjs/enforce-placeholders": ["error"],
|
|
"formatjs/enforce-plural-rules": ["error"],
|
|
"formatjs/no-literal-string-in-jsx": ["error"],
|
|
"formatjs/no-multiple-whitespaces": ["error"],
|
|
"formatjs/no-multiple-plurals": ["error"],
|
|
"formatjs/no-invalid-icu": ["error"],
|
|
"formatjs/enforce-id": ["error"],
|
|
"formatjs/no-complex-selectors": ["error"],
|
|
"formatjs/no-useless-message": ["error"],
|
|
"formatjs/prefer-pound-in-plural": ["error"],
|
|
},
|
|
},
|
|
{
|
|
files: ["**/*.stories.tsx"],
|
|
rules: {
|
|
"formatjs/no-literal-string-in-jsx": "off",
|
|
},
|
|
},
|
|
globalIgnores(["**/dist", "**/.eslintrc.cjs", "**/storybook-static"]),
|
|
])
|