|
| 1 | +import tsdoc from "eslint-plugin-tsdoc"; |
| 2 | +import typescriptParser from "@typescript-eslint/parser"; |
| 3 | +import scwTypescript from '@scaleway/eslint-config-react/typescript'; |
| 4 | + |
| 5 | + |
| 6 | +const scwPlugins = scwTypescript.reduce((acc, config) => { |
| 7 | + return { ...acc, ...config.plugins }; |
| 8 | +}, {}); |
| 9 | + |
| 10 | +export default [ |
| 11 | + { |
| 12 | + ignores: [ |
| 13 | + "**/node_modules/", |
| 14 | + "**/dist/", |
| 15 | + "**/examples/", |
| 16 | + "**/vite.config.ts", |
| 17 | + "packages/clients/.eslintrc.cjs", |
| 18 | + "eslint.config.mjs", |
| 19 | + "packages/clients/src/vendor/base64/index.js", |
| 20 | + "packages/configuration-loader/.eslintrc.cjs", |
| 21 | + |
| 22 | + ], |
| 23 | + }, |
| 24 | + { |
| 25 | + languageOptions: { |
| 26 | + ecmaVersion: 5, |
| 27 | + sourceType: "script", |
| 28 | + parser: typescriptParser, |
| 29 | + parserOptions: { |
| 30 | + project: ["tsconfig.json"], |
| 31 | + }, |
| 32 | + }, |
| 33 | + plugins: { |
| 34 | + tsdoc, |
| 35 | + ...scwPlugins, |
| 36 | + }, |
| 37 | + rules: { |
| 38 | + "tsdoc/syntax": "warn", |
| 39 | + "@typescript-eslint/naming-convention": [ |
| 40 | + "error", |
| 41 | + { |
| 42 | + selector: "enumMember", |
| 43 | + format: ["PascalCase"], |
| 44 | + }, |
| 45 | + ], |
| 46 | + "import/prefer-default-export": "off", |
| 47 | + "import/no-default-export": "error", |
| 48 | + "no-await-in-loop": "off", |
| 49 | + "@typescript-eslint/no-namespace": "off", |
| 50 | + }, |
| 51 | + }, |
| 52 | + |
| 53 | + ...scwTypescript.map(config => ({ |
| 54 | + ...config, |
| 55 | + files: ['**/*.ts', '**/*.tsx'], |
| 56 | + rules: { |
| 57 | + ...config.rules, |
| 58 | + //new rules |
| 59 | + "no-restricted-syntax": "warn", |
| 60 | + "no-useless-escape": "warn", |
| 61 | + "max-classes-per-file": "warn", |
| 62 | + "no-underscore-dangle": "warn", |
| 63 | + "no-await-in-loop": "warn", |
| 64 | + "@typescript-eslint/no-unused-vars": "warn", |
| 65 | + "@typescript-eslint/consistent-type-definitions": "warn", |
| 66 | + "@typescript-eslint/ban-types": "warn", |
| 67 | + }, |
| 68 | + })), |
| 69 | + |
| 70 | + ...scwTypescript.map(config => ({ |
| 71 | + ...config, |
| 72 | + files: [ |
| 73 | + "./packages/clients/src/scw/**/*.ts", |
| 74 | + "./packages/clients/src/internal/**/*.ts", |
| 75 | + ], |
| 76 | + rules: { |
| 77 | + ...config.rules, |
| 78 | + "@typescript-eslint/no-unused-vars": "off", |
| 79 | + "@typescript-eslint/consistent-type-definitions": "off", |
| 80 | + }, |
| 81 | + |
| 82 | + })), |
| 83 | + |
| 84 | + ...scwTypescript.map(config => ({ |
| 85 | + ...config, |
| 86 | + files: ["**/*.test.ts", "__tests__/**/*.ts", "**/vite.config.ts"], |
| 87 | + rules: { |
| 88 | + ...config.rules, |
| 89 | + "import/no-extraneous-dependencies": "off", |
| 90 | + }, |
| 91 | + |
| 92 | + })), |
| 93 | + |
| 94 | + ...scwTypescript.map(config => ({ |
| 95 | + ...config, |
| 96 | + files: ["packages/clients/src/api/dedibox/v1/*.ts"], |
| 97 | + rules: { |
| 98 | + ...config.rules, |
| 99 | + "no-use-before-define": "off", |
| 100 | + "@typescript-eslint/no-use-before-define": "off", |
| 101 | + "@typescript-eslint/no-unused-vars": "off", |
| 102 | + "@typescript-eslint/consistent-type-definitions": "off", |
| 103 | + "max-classes-per-file": "off", |
| 104 | + "no-restricted-syntax": "off", |
| 105 | + }, |
| 106 | + |
| 107 | + })), |
| 108 | + |
| 109 | +]; |
0 commit comments