chore: Centralise ESLint rules (#2162)
* chore: centrilize eslint rules
This commit is contained in:
committed by
GitHub
parent
612a548875
commit
a94d9816fe
140
.eslintrc.js
140
.eslintrc.js
@@ -1,77 +1,111 @@
|
||||
module.exports = {
|
||||
parser: `@babel/eslint-parser`,
|
||||
root: true,
|
||||
parser: "@babel/eslint-parser",
|
||||
parserOptions: {
|
||||
requireConfigFile: false,
|
||||
ecmaFeatures: {
|
||||
experimentalDecorators: true,
|
||||
},
|
||||
},
|
||||
plugins: [`eslint-plugin-prettier`],
|
||||
extends: [`eslint:recommended`, `google`, `eslint-config-prettier`],
|
||||
plugins: ["prettier"],
|
||||
extends: ["eslint:recommended", "google", "plugin:prettier/recommended"],
|
||||
rules: {
|
||||
"prettier/prettier": `error`,
|
||||
curly: [2, `all`],
|
||||
"new-cap": `off`,
|
||||
"require-jsdoc": `off`,
|
||||
semi: `off`,
|
||||
"no-unused-expressions": `off`,
|
||||
camelcase: `off`,
|
||||
"no-invalid-this": `off`,
|
||||
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"],
|
||||
},
|
||||
env: {
|
||||
es6: true,
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
ignorePatterns: [`**/models`, `**/repositories`],
|
||||
ignorePatterns: [],
|
||||
overrides: [
|
||||
{
|
||||
files: [`*.ts`],
|
||||
parser: `@typescript-eslint/parser`,
|
||||
plugins: [`@typescript-eslint/eslint-plugin`],
|
||||
extends: [`plugin:@typescript-eslint/recommended`, "prettier"],
|
||||
files: ["*.ts"],
|
||||
plugins: ["@typescript-eslint/eslint-plugin"],
|
||||
extends: ["plugin:@typescript-eslint/recommended"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
project: "./packages/medusa/tsconfig.json",
|
||||
},
|
||||
rules: {
|
||||
"valid-jsdoc": [
|
||||
"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",
|
||||
"@typescript-eslint/keyword-spacing": "error",
|
||||
"@typescript-eslint/space-before-function-paren": [
|
||||
"error",
|
||||
{
|
||||
requireParamType: false,
|
||||
requireReturnType: false,
|
||||
prefer: {
|
||||
arg: "param",
|
||||
argument: "param",
|
||||
class: "constructor",
|
||||
return: "return",
|
||||
virtual: "abstract",
|
||||
},
|
||||
anonymous: "always",
|
||||
named: "never",
|
||||
asyncArrow: "always",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/explicit-function-return-type": ["error"],
|
||||
"@typescript-eslint/no-non-null-assertion": ["off"],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
"**/api/**/*.js",
|
||||
"**/api/**/*.ts",
|
||||
"**/medusa-js/**/resources/**/*.ts",
|
||||
],
|
||||
rules: {
|
||||
"valid-jsdoc": ["off"],
|
||||
},
|
||||
},
|
||||
{
|
||||
// Medusa JS client
|
||||
files: ["**/medusa-js/**/resources/**/*.ts"],
|
||||
rules: {
|
||||
"valid-jsdoc": ["off"],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["**/api/**/*.ts"],
|
||||
rules: {
|
||||
"valid-jsdoc": ["off"],
|
||||
"@typescript-eslint/explicit-function-return-type": ["off"],
|
||||
"@typescript-eslint/no-var-requires": ["off"],
|
||||
"@typescript-eslint/space-infix-ops": "error",
|
||||
|
||||
// --- Rules to be fixed
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user