Files
medusa-store/www/eslint.config.mjs
Shahed Nasser 137913b469 docs: update many-to-many docs (#10323)
* docs: update many-to-many docs

* added note about version

* fix eslint error
2024-11-27 19:11:23 +02:00

170 lines
4.3 KiB
JavaScript

import prettier from "eslint-plugin-prettier/recommended";
import globals from "globals";
import babelParser from "@babel/eslint-parser";
import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [
prettier,
{
ignores: [
"**/dist",
"**/build",
"**/global-config.ts",
"**/next.config.js",
"**/spec",
"**/node_modules",
"**/public",
"**/.eslintrc.js",
"**/generated",
],
}, ...compat.extends(
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
), {
languageOptions: {
globals: {
...globals.node,
...globals.jest,
...globals.browser,
},
parser: babelParser,
ecmaVersion: 13,
sourceType: "module",
parserOptions: {
requireConfigFile: false,
ecmaFeatures: {
experimentalDecorators: true,
jsx: true,
modules: true
},
project: true,
},
},
settings: {
react: {
version: "detect",
},
},
rules: {
curly: ["error", "all"],
"new-cap": "off",
"require-jsdoc": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
camelcase: "off",
"no-invalid-this": "off",
"max-len": ["error", {
code: 80,
ignoreStrings: true,
ignoreRegExpLiterals: true,
ignoreComments: true,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreTemplateLiterals: true,
}],
semi: ["error", "never"],
quotes: ["error", "double", {
allowTemplateLiterals: true,
}],
"comma-dangle": ["error", {
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
functions: "never",
}],
"object-curly-spacing": ["error", "always"],
"arrow-parens": ["error", "always"],
"linebreak-style": 0,
"no-confusing-arrow": ["error", {
allowParens: false,
}],
"space-before-function-paren": ["error", {
anonymous: "always",
named: "never",
asyncArrow: "always",
}],
"space-infix-ops": "error",
"eol-last": ["error", "always"],
"no-console": ["error", {
allow: ["error", "warn"],
}],
"react/prop-types": [2, {
ignore: ["className"],
}],
},
}, ...compat.extends("plugin:@typescript-eslint/recommended", "plugin:react/recommended").map(config => ({
...config,
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
})), {
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
plugins: {
"@typescript-eslint": typescriptEslintEslintPlugin,
},
languageOptions: {
parser: tsParser,
ecmaVersion: 13,
sourceType: "module",
parserOptions: {
project: "./tsconfig.json",
},
},
rules: {
"valid-jsdoc": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/promise-function-async": "error",
"@/keyword-spacing": "error",
"@/space-before-function-paren": ["error", {
anonymous: "always",
named: "never",
asyncArrow: "always",
}],
"@/space-infix-ops": "error",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn",
},
settings: {
next: {
rootDir: ["apps/*/"],
},
},
}];