Merged in fix/booking-flow-eslint-fix (pull request #3342)
fix: Upgrade booking-flow eslint config * Upgrade booking-flow eslint config Approved-by: Bianca Widstam
This commit is contained in:
@@ -1,50 +1,30 @@
|
||||
import path from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
import { FlatCompat } from "@eslint/eslintrc"
|
||||
import js from "@eslint/js"
|
||||
import typescriptEslint from "@typescript-eslint/eslint-plugin"
|
||||
import tsParser from "@typescript-eslint/parser"
|
||||
import { defineConfig } from "eslint/config"
|
||||
import { defineConfig, globalIgnores } from "eslint/config"
|
||||
import nextVitals from "eslint-config-next/core-web-vitals"
|
||||
import nextTs from "eslint-config-next/typescript"
|
||||
import formatjs from "eslint-plugin-formatjs"
|
||||
import simpleImportSort from "eslint-plugin-simple-import-sort"
|
||||
|
||||
const compat = new FlatCompat({
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
})
|
||||
|
||||
const packageDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
export default defineConfig([
|
||||
...nextVitals,
|
||||
...nextTs,
|
||||
globalIgnores([
|
||||
".next/**",
|
||||
"node_modules/**",
|
||||
"dist/**",
|
||||
"build/**",
|
||||
"coverage/**",
|
||||
"*.config.js",
|
||||
"*.config.ts",
|
||||
"*.config.mjs",
|
||||
]),
|
||||
|
||||
{
|
||||
extends: compat.extends(
|
||||
"next/core-web-vitals",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
),
|
||||
files: ["**/*.{js,jsx,ts,tsx,mts}"],
|
||||
plugins: {
|
||||
"simple-import-sort": simpleImportSort,
|
||||
"@typescript-eslint": typescriptEslint,
|
||||
formatjs,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
},
|
||||
|
||||
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: {
|
||||
"no-console": "warn",
|
||||
"no-unused-vars": "off",
|
||||
@@ -57,15 +37,8 @@ export default defineConfig([
|
||||
propElementValues: "always",
|
||||
},
|
||||
],
|
||||
"react-hooks/incompatible-library": "off",
|
||||
"import/no-relative-packages": "error",
|
||||
"import/no-extraneous-dependencies": [
|
||||
"warn",
|
||||
{
|
||||
includeInternal: true,
|
||||
includeTypes: true,
|
||||
packageDir: [packageDir],
|
||||
},
|
||||
],
|
||||
"simple-import-sort/imports": [
|
||||
"warn",
|
||||
{
|
||||
@@ -113,19 +86,9 @@ export default defineConfig([
|
||||
},
|
||||
],
|
||||
|
||||
"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"],
|
||||
|
||||
"@typescript-eslint/consistent-type-imports": "error",
|
||||
"@typescript-eslint/no-empty-object-type": "off",
|
||||
"@typescript-eslint/no-require-imports": "off",
|
||||
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
@@ -141,6 +104,18 @@ export default defineConfig([
|
||||
],
|
||||
|
||||
"@next/next/no-html-link-for-pages": "off",
|
||||
|
||||
"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"],
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user