medusa

Форк
0
/
.eslintrc.js 
319 строк · 10.0 Кб
1
module.exports = {
2
  root: true,
3
  parserOptions: {
4
    requireConfigFile: false,
5
    ecmaFeatures: {
6
      experimentalDecorators: true,
7
    },
8
  },
9
  plugins: ["prettier"],
10
  extends: ["eslint:recommended", "google", "plugin:prettier/recommended"],
11
  rules: {
12
    curly: ["error", "all"],
13
    "new-cap": "off",
14
    "require-jsdoc": "off",
15
    "no-unused-expressions": "off",
16
    "no-unused-vars": "off",
17
    camelcase: "off",
18
    "no-invalid-this": "off",
19
    "max-len": [
20
      "error",
21
      {
22
        code: 80,
23
        ignoreStrings: true,
24
        ignoreRegExpLiterals: true,
25
        ignoreComments: true,
26
        ignoreTrailingComments: true,
27
        ignoreUrls: true,
28
        ignoreTemplateLiterals: true,
29
      },
30
    ],
31
    semi: ["error", "never"],
32
    quotes: [
33
      "error",
34
      "double",
35
      {
36
        allowTemplateLiterals: true,
37
      },
38
    ],
39
    "comma-dangle": [
40
      "error",
41
      {
42
        arrays: "always-multiline",
43
        objects: "always-multiline",
44
        imports: "always-multiline",
45
        exports: "always-multiline",
46
        functions: "never",
47
      },
48
    ],
49
    "object-curly-spacing": ["error", "always"],
50
    "arrow-parens": ["error", "always"],
51
    "linebreak-style": 0,
52
    "no-confusing-arrow": [
53
      "error",
54
      {
55
        allowParens: false,
56
      },
57
    ],
58
    "space-before-function-paren": [
59
      "error",
60
      {
61
        anonymous: "always",
62
        named: "never",
63
        asyncArrow: "always",
64
      },
65
    ],
66
    "space-infix-ops": "error",
67
    "eol-last": ["error", "always"],
68
  },
69
  env: {
70
    es6: true,
71
    node: true,
72
    jest: true,
73
  },
74
  overrides: [
75
    {
76
      files: ["*.ts"],
77
      plugins: ["@typescript-eslint/eslint-plugin"],
78
      extends: ["plugin:@typescript-eslint/recommended"],
79
      parser: "@typescript-eslint/parser",
80
      parserOptions: {
81
        project: [
82
          "./packages/medusa/tsconfig.json",
83

84
          "./packages/admin-next/dashboard/tsconfig.json",
85
          "./packages/admin-next/admin-sdk/tsconfig.json",
86
          "./packages/admin-next/admin-shared/tsconfig.json",
87
          "./packages/admin-next/admin-vite-plugin/tsconfig.json",
88

89
          "./packages/cli/create-medusa-app/tsconfig.json",
90
          "./packages/cli/medusa-cli/tsconfig.spec.json",
91
          "./packages/cli/medusa-dev-cli/tsconfig.spec.json",
92
          "./packages/cli/oas/medusa-oas-cli/tsconfig.spec.json",
93

94
          "./packages/core/orchestration/tsconfig.json",
95
          "./packages/core/workflows-sdk/tsconfig.spec.json",
96
          "./packages/core/modules-sdk/tsconfig.json",
97
          "./packages/core/js-sdk/tsconfig.json",
98
          "./packages/core/types/tsconfig.json",
99
          "./packages/core/utils/tsconfig.spec.json",
100
          "./packages/core/medusa-test-utils/tsconfig.json",
101

102
          "./packages/modules/product/tsconfig.json",
103
          "./packages/modules/event-bus-local/tsconfig.spec.json",
104
          "./packages/modules/event-bus-redis/tsconfig.spec.json",
105
          "./packages/modules/cache-redis/tsconfig.spec.json",
106
          "./packages/modules/cache-inmemory/tsconfig.spec.json",
107
          "./packages/modules/workflow-engine-redis/tsconfig.spec.json",
108
          "./packages/modules/workflow-engine-inmemory/tsconfig.spec.json",
109
          "./packages/modules/fulfillment/tsconfig.spec.json",
110
          "./packages/modules/api-key/tsconfig.spec.json",
111
          "./packages/modules/auth/tsconfig.spec.json",
112
          "./packages/modules/cart/tsconfig.spec.json",
113
          "./packages/modules/currency/tsconfig.spec.json",
114
          "./packages/modules/customer/tsconfig.spec.json",
115
          "./packages/modules/file/tsconfig.spec.json",
116
          "./packages/modules/inventory-next/tsconfig.spec.json",
117
          "./packages/modules/stock-location-next/tsconfig.spec.json",
118
          "./packages/modules/order/tsconfig.spec.json",
119
          "./packages/modules/payment/tsconfig.spec.json",
120
          "./packages/modules/pricing/tsconfig.spec.json",
121
          "./packages/modules/promotion/tsconfig.spec.json",
122
          "./packages/modules/region/tsconfig.spec.json",
123
          "./packages/modules/sales-channel/tsconfig.spec.json",
124
          "./packages/modules/store/tsconfig.spec.json",
125
          "./packages/modules/tax/tsconfig.spec.json",
126
          "./packages/modules/workflow-engine-inmemory/tsconfig.spec.json",
127
          "./packages/modules/workflow-engine-redis/tsconfig.spec.json",
128
          "./packages/modules/link-modules/tsconfig.spec.json",
129
          "./packages/modules/user/tsconfig.spec.json",
130

131
          "./packages/modules/providers/file-local/tsconfig.spec.json",
132
          "./packages/modules/providers/file-s3/tsconfig.spec.json",
133
          "./packages/modules/providers/fulfillment-manual/tsconfig.spec.json",
134
          "./packages/modules/providers/payment-stripe/tsconfig.spec.json",
135

136
          "./packages/framework/framework/tsconfig.json",
137
        ],
138
      },
139
      rules: {
140
        "valid-jsdoc": "off",
141
        "@typescript-eslint/no-non-null-assertion": "off",
142
        "@typescript-eslint/no-floating-promises": "error",
143
        "@typescript-eslint/await-thenable": "error",
144
        "@typescript-eslint/promise-function-async": "error",
145
        "@typescript-eslint/keyword-spacing": "error",
146
        "@typescript-eslint/space-before-function-paren": [
147
          "error",
148
          {
149
            anonymous: "always",
150
            named: "never",
151
            asyncArrow: "always",
152
          },
153
        ],
154
        "@typescript-eslint/space-infix-ops": "error",
155

156
        // --- Rules to be fixed
157
        "@typescript-eslint/ban-ts-comment": "off",
158
        "@typescript-eslint/no-unused-vars": "off",
159
        "@typescript-eslint/no-explicit-any": "off",
160
        "@typescript-eslint/explicit-function-return-type": "off",
161
        "@typescript-eslint/ban-types": "off",
162
        "@typescript-eslint/no-var-requires": "off",
163
      },
164
    },
165
    {
166
      files: ["packages/design-system/ui/**/*.{ts,tsx}"],
167
      extends: [
168
        "plugin:react/recommended",
169
        "plugin:storybook/recommended",
170
        "plugin:react-hooks/recommended",
171
        "plugin:@typescript-eslint/recommended",
172
      ],
173
      plugins: ["@typescript-eslint"],
174
      rules: {
175
        "react/no-children-prop": "off",
176
        "react-hooks/exhaustive-deps": "warn",
177
        "react/prop-types": "off",
178
        "@typescript-eslint/no-explicit-any": "off",
179
        "@typescript-eslint/no-unused-vars": [
180
          "error",
181
          { argsIgnorePattern: "^_" },
182
        ],
183
      },
184
      settings: {
185
        react: {
186
          version: "detect",
187
        },
188
      },
189
      parser: "@typescript-eslint/parser",
190
      parserOptions: {
191
        project: "./packages/design-system/ui/tsconfig.json",
192
      },
193
    },
194
    {
195
      files: ["packages/design-system/icons/**/*.{ts,tsx}"],
196
      extends: [
197
        "plugin:react/recommended",
198
        "plugin:@typescript-eslint/recommended",
199
      ],
200
      plugins: ["@typescript-eslint"],
201
      rules: {
202
        "react/no-children-prop": "off",
203
        "react/prop-types": "off",
204
        "@typescript-eslint/no-explicit-any": "off",
205
        "@typescript-eslint/no-unused-vars": [
206
          "error",
207
          { argsIgnorePattern: "^_" },
208
        ],
209
      },
210
      settings: {
211
        react: {
212
          version: "detect",
213
        },
214
      },
215
      parser: "@typescript-eslint/parser",
216
      parserOptions: {
217
        project: "./packages/design-system/icons/tsconfig.json",
218
      },
219
    },
220
    {
221
      files: [
222
        "packages/admin-next/dashboard/**/*.ts",
223
        "packages/admin-next/dashboard/**/*.tsx",
224
      ],
225
      plugins: ["unused-imports", "react-refresh"],
226
      extends: [
227
        "plugin:react/recommended",
228
        "plugin:react/jsx-runtime",
229
        "plugin:react-hooks/recommended",
230
      ],
231
      parser: "@typescript-eslint/parser",
232
      parserOptions: {
233
        ecmaFeatures: {
234
          jsx: true,
235
        },
236
        ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
237
        sourceType: "module", // Allows for the use of imports
238
        project: "./packages/admin-next/dashboard/tsconfig.json",
239
      },
240
      globals: {
241
        __BASE__: "readonly",
242
      },
243
      env: {
244
        browser: true,
245
      },
246
      rules: {
247
        "prettier/prettier": "error",
248
        "react/prop-types": "off",
249
        "new-cap": "off",
250
        "require-jsdoc": "off",
251
        "valid-jsdoc": "off",
252
        "react-refresh/only-export-components": [
253
          "warn",
254
          { allowConstantExport: true },
255
        ],
256
        "no-unused-expressions": "off",
257
        "unused-imports/no-unused-imports": "error",
258
        "unused-imports/no-unused-vars": [
259
          "warn",
260
          {
261
            vars: "all",
262
            varsIgnorePattern: "^_",
263
            args: "after-used",
264
            argsIgnorePattern: "^_",
265
          },
266
        ],
267
      },
268
    },
269
    {
270
      files: [
271
        "packages/admin-next/app/**/*.ts",
272
        "packages/admin-next/app/**/*.tsx",
273
      ],
274
      plugins: ["unused-imports", "react-refresh"],
275
      extends: [
276
        "plugin:react/recommended",
277
        "plugin:react/jsx-runtime",
278
        "plugin:react-hooks/recommended",
279
      ],
280
      parser: "@typescript-eslint/parser",
281
      parserOptions: {
282
        ecmaFeatures: {
283
          jsx: true,
284
        },
285
        ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
286
        sourceType: "module", // Allows for the use of imports
287
        project: "./packages/admin-next/app/tsconfig.json",
288
      },
289
      globals: {
290
        __BASE__: "readonly",
291
      },
292
      env: {
293
        browser: true,
294
      },
295
      rules: {
296
        "prettier/prettier": "error",
297
        "react/prop-types": "off",
298
        "new-cap": "off",
299
        "require-jsdoc": "off",
300
        "valid-jsdoc": "off",
301
        "react-refresh/only-export-components": [
302
          "warn",
303
          { allowConstantExport: true },
304
        ],
305
        "no-unused-expressions": "off",
306
        "unused-imports/no-unused-imports": "error",
307
        "unused-imports/no-unused-vars": [
308
          "warn",
309
          {
310
            vars: "all",
311
            varsIgnorePattern: "^_",
312
            args: "after-used",
313
            argsIgnorePattern: "^_",
314
          },
315
        ],
316
      },
317
    },
318
  ],
319
}
320

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.