chore: Migrate from next lint to eslint * Migrate scandic-web * Migrate partner-sas * Enable any rule in partner-sas Approved-by: Joakim Jäderberg Approved-by: Linus Flood
129 lines
3.5 KiB
JavaScript
129 lines
3.5 KiB
JavaScript
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 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,
|
|
})
|
|
|
|
export default defineConfig([
|
|
{
|
|
ignores: [
|
|
".next/**",
|
|
"node_modules/**",
|
|
"dist/**",
|
|
"build/**",
|
|
"public/**",
|
|
"playwright-report/**",
|
|
"test-results/**",
|
|
"coverage/**",
|
|
"*.config.js",
|
|
"*.config.ts",
|
|
"*.config.mjs",
|
|
"next-env.d.ts",
|
|
],
|
|
},
|
|
{
|
|
extends: compat.extends(
|
|
"next/core-web-vitals",
|
|
"plugin:@typescript-eslint/recommended"
|
|
),
|
|
plugins: {
|
|
"simple-import-sort": simpleImportSort,
|
|
"@typescript-eslint": typescriptEslint,
|
|
formatjs,
|
|
},
|
|
|
|
languageOptions: {
|
|
parser: tsParser,
|
|
},
|
|
|
|
rules: {
|
|
"no-console": "warn",
|
|
"no-unused-vars": "off",
|
|
"react/function-component-definition": "error",
|
|
"import/no-relative-packages": "error",
|
|
"simple-import-sort/imports": [
|
|
"warn",
|
|
{
|
|
groups: [
|
|
["^\\u0000"],
|
|
["^node:"],
|
|
["^@?\\w"],
|
|
["^@scandic-hotels/(?!.*\\u0000$).*$"],
|
|
[
|
|
"^@/constants/?(?!.*\\u0000$).*$",
|
|
"^@/env/?(?!.*\\u0000$).*$",
|
|
"^@/lib/?(?!.*\\u0000$).*$",
|
|
"^@/server/?(?!.*\\u0000$).*$",
|
|
"^@/stores/?(?!.*\\u0000$).*$",
|
|
],
|
|
["^@/(?!(types|.*\\u0000$)).*$"],
|
|
[
|
|
"^\\.\\.(?!/?$)",
|
|
"^\\.\\./?$",
|
|
"^\\./(?=.*/)(?!/?$)",
|
|
"^\\.(?!/?$)",
|
|
"^\\./?$",
|
|
],
|
|
["^(?!\\u0000).+\\.s?css$"],
|
|
["^node:.*\\u0000$", "^@?\\w.*\\u0000$"],
|
|
[
|
|
"^@scandichotels/.*\\u0000$",
|
|
"^@/types/.*",
|
|
"^@/.*\\u0000$",
|
|
"^[^.].*\\u0000$",
|
|
"^\\..*\\u0000$",
|
|
],
|
|
],
|
|
},
|
|
],
|
|
|
|
"simple-import-sort/exports": "error",
|
|
"import/first": "error",
|
|
"import/newline-after-import": "error",
|
|
|
|
"import/no-duplicates": [
|
|
"error",
|
|
{
|
|
"prefer-inline": true,
|
|
},
|
|
],
|
|
|
|
"@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",
|
|
{
|
|
args: "all",
|
|
argsIgnorePattern: "^_",
|
|
caughtErrors: "all",
|
|
caughtErrorsIgnorePattern: "^_",
|
|
destructuredArrayIgnorePattern: "^_",
|
|
varsIgnorePattern: "^_",
|
|
ignoreRestSiblings: true,
|
|
},
|
|
],
|
|
|
|
"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"],
|
|
},
|
|
},
|
|
])
|