|
| 1 | +{ |
| 2 | + "$schema": "./node_modules/oxlint/configuration_schema.json", |
| 3 | + "ignorePatterns": ["dist/**"], |
| 4 | + "categories": { |
| 5 | + "correctness": "error", |
| 6 | + "suspicious": "warn", |
| 7 | + "pedantic": "warn", |
| 8 | + "perf": "warn", |
| 9 | + "style": "warn" |
| 10 | + }, |
| 11 | + "plugins": ["import", "unicorn", "oxc", "promise", "jsdoc", "vitest", "node"], |
| 12 | + "rules": { |
| 13 | + // we should not enforce capitalized comments |
| 14 | + "capitalized-comments": "off", |
| 15 | + // prefer to export declarations instead of exporting at the end |
| 16 | + "group-exports": "off", |
| 17 | + // this rule is too restrictive |
| 18 | + "init-declarations": "off", |
| 19 | + // allow continue in complicated loops |
| 20 | + "no-continue": "off", |
| 21 | + // warn about console usage but allow it |
| 22 | + "no-console": "warn", |
| 23 | + // type imports can be duplicated with value imports |
| 24 | + "no-duplicate-imports": ["error", { "allowSeparateTypeImports": true }], |
| 25 | + // inline comments shall be allowed |
| 26 | + "no-inline-comments": "off", |
| 27 | + "no-magic-numbers": "off", |
| 28 | + // allow nested ternary for better readability in some cases |
| 29 | + "no-nested-ternary": "off", |
| 30 | + // allow null usage |
| 31 | + "no-null": "off", |
| 32 | + // ternary operator shall be allowed for simple expressions |
| 33 | + "no-ternary": "off", |
| 34 | + // normally we do not enforce numeric separator usage |
| 35 | + "numeric-separators-style": "off", |
| 36 | + // we prefer to sort imports with its pkg name |
| 37 | + "sort-imports": "off", |
| 38 | + // object keys are not supposed to be sorted in many cases |
| 39 | + "sort-keys": "off", |
| 40 | + |
| 41 | + // import plugin rules |
| 42 | + |
| 43 | + "import/exports-last": "off", |
| 44 | + // usually we just export vue components as default export without naming it |
| 45 | + "import/no-anonymous-default-export": "off", |
| 46 | + // a rule that shall not be enabled anyway |
| 47 | + "import/no-named-export": "off", |
| 48 | + // allow importing stylesheets |
| 49 | + "import/no-unassigned-import": ["error", { "allow": ["**/*.css", "**/*.scss"] }], |
| 50 | + // named export is preferred |
| 51 | + "import/prefer-default-export": "off", |
| 52 | + |
| 53 | + // jsdoc plugin rules |
| 54 | + |
| 55 | + // duplicated typescript related jsdoc shall be warned |
| 56 | + "jsdoc/check-tag-names": ["warn", { "typed": true }], |
| 57 | + // we do not require types in jsdoc since we use TypeScript |
| 58 | + "jsdoc/require-param-type": "off", |
| 59 | + // we do not require types in jsdoc since we use TypeScript |
| 60 | + "jsdoc/require-returns-type": "off", |
| 61 | + |
| 62 | + "promise/always-return": "off", |
| 63 | + // we sometimes need to create new Promise instance |
| 64 | + "promise/avoid-new": "off", |
| 65 | + // we prefer async/await syntax |
| 66 | + "promise/prefer-await-to-then": "off", |
| 67 | + |
| 68 | + // unicorn plugin rules |
| 69 | + // filename should not be enforced strictly, e.g. Vue SFC files shall be PascalCased |
| 70 | + // we shall expect a project level setting |
| 71 | + "unicorn/filename-case": "off", |
| 72 | + // toReversed can introduce memory overhead, |
| 73 | + // in some chained calls it is better to use reverse as the "reversed" array is also a temp variable. |
| 74 | + "unicorn/no-array-reverse": "off", |
| 75 | + // toSorted can introduce memory overhead |
| 76 | + // in some chained calls it is better to use reverse as the "sorted" array is also a temp variable. |
| 77 | + "unicorn/no-array-sort": "off", |
| 78 | + // sometimes nested ternary is considerable |
| 79 | + "unicorn/no-nested-ternary": "warn", |
| 80 | + // Array.at() is too modern for browser targets |
| 81 | + "unicorn/prefer-at": "off", |
| 82 | + // support starts with chrome71, firefox68. safari12.1, node12 |
| 83 | + // leaving it to warn for edge cases |
| 84 | + "unicorn/prefer-global-this": "warn", |
| 85 | + |
| 86 | + // stylistic rules with default being tweaked |
| 87 | + |
| 88 | + "catch-error-name": ["warn", { "name": "err" }], |
| 89 | + "curly": ["warn", "multi-line"], |
| 90 | + "max-dependencies": ["warn", { "ignoreTypeImports": true, "max": 15 }], |
| 91 | + "max-lines": ["warn", { "max": 500, "skipBlankLines": true, "skipComments": true }], |
| 92 | + "max-lines-per-function": [ |
| 93 | + "warn", |
| 94 | + { "max": 100, "skipBlankLines": true, "skipComments": true } |
| 95 | + ], |
| 96 | + "max-params": ["warn", 4], |
| 97 | + "max-statements": ["warn", { "max": 30 }], |
| 98 | + |
| 99 | + // per project settings |
| 100 | + "id-length": "off" |
| 101 | + }, |
| 102 | + "overrides": [ |
| 103 | + { |
| 104 | + "files": ["**/*.ts"], |
| 105 | + "plugins": ["typescript"], |
| 106 | + "rules": { |
| 107 | + // we make type casts only when necessary |
| 108 | + // "typescript/no-unsafe-type-assertion": "off", |
| 109 | + // skipping it for now, may enable it later |
| 110 | + // "typescript/switch-exhaustiveness-check": "off", |
| 111 | + // a lot of time we are just want to check existence |
| 112 | + // "typescript/strict-boolean-expressions": "off" |
| 113 | + } |
| 114 | + }, |
| 115 | + { |
| 116 | + "files": ["**/__tests__/**"], |
| 117 | + "plugins": ["vitest"] |
| 118 | + } |
| 119 | + ] |
| 120 | +} |
0 commit comments