Skip to content
Myr

chore: unified oxfmt and oxlint config (#5518)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Rahul Mishra · committed by GitHub · parent decda78 · Browse files · 3 files+249 added−285 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+249 added−285 removed

  • other:+249 added−285 removed

3 files+249 added−285 removed

deleted:.oxfmtrc.json-21 removed
deleted:.oxlintrc.json-260 removed
1{2 "$schema": "./node_modules/oxlint/configuration_schema.json",3 "plugins": [4 "node",5 "typescript",6 "import",7 "unicorn"8 ],9 "categories": {10 "correctness": "off"11 },12 "env": {13 "builtin": true,14 "es2024": true15 },16 "globals": {17 "__dirname": "off",18 "__filename": "off",19 "AbortController": "readonly",20 "AbortSignal": "readonly",21 "atob": "readonly",22 "Blob": "readonly",23 "BroadcastChannel": "readonly",24 "btoa": "readonly",25 "Buffer": "readonly",26 "ByteLengthQueuingStrategy": "readonly",27 "clearImmediate": "readonly",28 "clearInterval": "readonly",29 "clearTimeout": "readonly",30 "CloseEvent": "readonly",31 "CompressionStream": "readonly",32 "console": "readonly",33 "CountQueuingStrategy": "readonly",34 "crypto": "readonly",35 "Crypto": "readonly",36 "CryptoKey": "readonly",37 "CustomEvent": "readonly",38 "DecompressionStream": "readonly",39 "DOMException": "readonly",40 "Event": "readonly",41 "EventTarget": "readonly",42 "exports": "off",43 "fetch": "readonly",44 "File": "readonly",45 "FormData": "readonly",46 "global": "readonly",47 "Headers": "readonly",48 "MessageChannel": "readonly",49 "MessageEvent": "readonly",50 "MessagePort": "readonly",51 "module": "off",52 "navigator": "readonly",53 "Navigator": "readonly",54 "performance": "readonly",55 "Performance": "readonly",56 "PerformanceEntry": "readonly",57 "PerformanceMark": "readonly",58 "PerformanceMeasure": "readonly",59 "PerformanceObserver": "readonly",60 "PerformanceObserverEntryList": "readonly",61 "PerformanceResourceTiming": "readonly",62 "process": "readonly",63 "queueMicrotask": "readonly",64 "ReadableByteStreamController": "readonly",65 "ReadableStream": "readonly",66 "ReadableStreamBYOBReader": "readonly",67 "ReadableStreamBYOBRequest": "readonly",68 "ReadableStreamDefaultController": "readonly",69 "ReadableStreamDefaultReader": "readonly",70 "Request": "readonly",71 "require": "off",72 "Response": "readonly",73 "setImmediate": "readonly",74 "setInterval": "readonly",75 "setTimeout": "readonly",76 "structuredClone": "readonly",77 "SubtleCrypto": "readonly",78 "TextDecoder": "readonly",79 "TextDecoderStream": "readonly",80 "TextEncoder": "readonly",81 "TextEncoderStream": "readonly",82 "TransformStream": "readonly",83 "TransformStreamDefaultController": "readonly",84 "URL": "readonly",85 "URLSearchParams": "readonly",86 "WebAssembly": "readonly",87 "WebSocket": "readonly",88 "WritableStream": "readonly",89 "WritableStreamDefaultController": "readonly",90 "WritableStreamDefaultWriter": "readonly",91 "addEventListener": "readonly"92 },93 "ignorePatterns": [94 ".wrangler",95 "**/coverage",96 "**/dist"97 ],98 "rules": {99 "constructor-super": "error",100 "for-direction": "error",101 "getter-return": "error",102 "no-async-promise-executor": "error",103 "no-case-declarations": "error",104 "no-class-assign": "error",105 "no-compare-neg-zero": "error",106 "no-cond-assign": "error",107 "no-const-assign": "error",108 "no-constant-binary-expression": "error",109 "no-constant-condition": "error",110 "no-control-regex": "error",111 "no-debugger": [112 "error"113 ],114 "no-delete-var": "error",115 "no-dupe-class-members": "error",116 "no-dupe-else-if": "error",117 "no-dupe-keys": "error",118 "no-duplicate-case": "error",119 "no-empty": [120 "warn",121 {122 "allowEmptyCatch": true123 }124 ],125 "no-empty-character-class": "error",126 "no-empty-pattern": "error",127 "no-empty-static-block": "error",128 "no-ex-assign": "error",129 "no-extra-boolean-cast": "error",130 "no-fallthrough": "error",131 "no-func-assign": "error",132 "no-global-assign": "error",133 "no-import-assign": "error",134 "no-invalid-regexp": "error",135 "no-irregular-whitespace": "error",136 "no-loss-of-precision": "error",137 "no-misleading-character-class": "error",138 "no-new-native-nonconstructor": "error",139 "no-nonoctal-decimal-escape": "error",140 "no-obj-calls": "error",141 "no-prototype-builtins": "error",142 "no-redeclare": "error",143 "no-regex-spaces": "error",144 "no-self-assign": "error",145 "no-setter-return": "error",146 "no-shadow-restricted-names": "error",147 "no-sparse-arrays": "error",148 "no-this-before-super": "error",149 "no-unreachable": "error",150 "no-unsafe-finally": "error",151 "no-unsafe-negation": "error",152 "no-unsafe-optional-chaining": "error",153 "no-unused-labels": "error",154 "no-unused-private-class-members": "error",155 "no-unused-vars": [156 "warn",157 {158 "args": "all",159 "argsIgnorePattern": "^_",160 "caughtErrors": "all",161 "caughtErrorsIgnorePattern": "^_",162 "destructuredArrayIgnorePattern": "^_",163 "varsIgnorePattern": "^_",164 "ignoreRestSiblings": true165 }166 ],167 "no-useless-backreference": "error",168 "no-useless-catch": "error",169 "no-with": "error",170 "require-yield": "error",171 "use-isnan": "error",172 "valid-typeof": "error",173 "no-array-constructor": "error",174 "no-empty-function": [175 "error",176 {177 "allow": [178 "arrowFunctions"179 ]180 }181 ],182 "prefer-const": [183 "warn",184 {185 "destructuring": "all"186 }187 ],188 "curly": [189 "error",190 "all"191 ],192 "import/consistent-type-specifier-style": [193 "error",194 "prefer-top-level"195 ],196 "import/no-duplicates": "error",197 "node/no-exports-assign": "error",198 "typescript/ban-ts-comment": [199 "error",200 {201 "minimumDescriptionLength": 10202 }203 ],204 "typescript/no-duplicate-enum-values": "error",205 "typescript/no-explicit-any": "warn",206 "typescript/no-extra-non-null-assertion": "error",207 "typescript/no-misused-new": "error",208 "typescript/no-namespace": "error",209 "typescript/no-non-null-asserted-nullish-coalescing": "error",210 "typescript/no-non-null-asserted-optional-chain": "error",211 "typescript/no-this-alias": "error",212 "typescript/no-unnecessary-type-constraint": "error",213 "typescript/no-unsafe-declaration-merging": "error",214 "typescript/no-wrapper-object-types": "error",215 "typescript/prefer-as-const": "error",216 "typescript/prefer-namespace-keyword": "error",217 "typescript/triple-slash-reference": "error",218 "typescript/adjacent-overload-signatures": "error",219 "typescript/ban-tslint-comment": "error",220 "typescript/class-literal-property-style": "error",221 "typescript/consistent-type-assertions": "error",222 "typescript/consistent-type-imports": [223 "error",224 {225 "prefer": "type-imports"226 }227 ]228 },229 "overrides": [230 {231 "files": [232 "**/*.ts",233 "**/*.tsx",234 "**/*.mts",235 "**/*.cts"236 ],237 "rules": {238 "constructor-super": "off",239 "getter-return": "off",240 "no-class-assign": "off",241 "no-const-assign": "off",242 "no-dupe-class-members": "off",243 "no-dupe-keys": "off",244 "no-func-assign": "off",245 "no-import-assign": "off",246 "no-new-native-nonconstructor": "off",247 "no-obj-calls": "off",248 "no-redeclare": "off",249 "no-setter-return": "off",250 "no-this-before-super": "off",251 "no-unreachable": "off",252 "no-unsafe-negation": "off",253 "no-var": "error",254 "no-with": "off",255 "prefer-rest-params": "error",256 "prefer-spread": "error"257 }258 }259 ]260}
modified:vite.config.ts+249 added-4 removed
1import { RolldownMagicString } from 'rolldown'2import { parse, Visitor } from 'rolldown/utils'3import { defineConfig } from 'vite-plus'4import type { TsdownPluginOption } from 'vite-plus/pack'5import oxfmtConfig from './.oxfmtrc.json' with { type: 'json' }6import oxlintConfig from './.oxlintrc.json' with { type: 'json' }5import { appendExportEmptyToDts } from './build/dts-plugins'67const entry = ['src/**/*.ts', '!src/**/*.test.ts', '!src/**/*.test.tsx']8const common = {
77 unmodified lines
86 },87}8889export default defineConfig({92 fmt: oxfmtConfig,93 lint: oxlintConfig,90 fmt: {91 printWidth: 100,92 trailingComma: 'es5',93 tabWidth: 2,94 semi: false,95 singleQuote: true,96 jsxSingleQuote: true,97 endOfLine: 'lf',98 sortImports: {99 newlinesBetween: false,100 },101 sortPackageJson: false,102 ignorePatterns: ['dist/', 'coverage/', '.wrangler/', 'pnpm-lock.yaml', '**/*.json', '**/*.mts'],103 },104 lint: {105 plugins: ['node', 'typescript', 'import', 'unicorn'],106 categories: {107 correctness: 'off',108 },109 env: {110 builtin: true,111 es2024: true,112 },113 globals: {114 __dirname: 'off',115 __filename: 'off',116 AbortController: 'readonly',117 AbortSignal: 'readonly',118 atob: 'readonly',119 Blob: 'readonly',120 BroadcastChannel: 'readonly',121 btoa: 'readonly',122 Buffer: 'readonly',123 ByteLengthQueuingStrategy: 'readonly',124 clearImmediate: 'readonly',125 clearInterval: 'readonly',126 clearTimeout: 'readonly',127 CloseEvent: 'readonly',128 CompressionStream: 'readonly',129 console: 'readonly',130 CountQueuingStrategy: 'readonly',131 crypto: 'readonly',132 Crypto: 'readonly',133 CryptoKey: 'readonly',134 CustomEvent: 'readonly',135 DecompressionStream: 'readonly',136 DOMException: 'readonly',137 Event: 'readonly',138 EventTarget: 'readonly',139 exports: 'off',140 fetch: 'readonly',141 File: 'readonly',142 FormData: 'readonly',143 global: 'readonly',144 Headers: 'readonly',145 MessageChannel: 'readonly',146 MessageEvent: 'readonly',147 MessagePort: 'readonly',148 module: 'off',149 navigator: 'readonly',150 Navigator: 'readonly',151 performance: 'readonly',152 Performance: 'readonly',153 PerformanceEntry: 'readonly',154 PerformanceMark: 'readonly',155 PerformanceMeasure: 'readonly',156 PerformanceObserver: 'readonly',157 PerformanceObserverEntryList: 'readonly',158 PerformanceResourceTiming: 'readonly',159 process: 'readonly',160 queueMicrotask: 'readonly',161 ReadableByteStreamController: 'readonly',162 ReadableStream: 'readonly',163 ReadableStreamBYOBReader: 'readonly',164 ReadableStreamBYOBRequest: 'readonly',165 ReadableStreamDefaultController: 'readonly',166 ReadableStreamDefaultReader: 'readonly',167 Request: 'readonly',168 require: 'off',169 Response: 'readonly',170 setImmediate: 'readonly',171 setInterval: 'readonly',172 setTimeout: 'readonly',173 structuredClone: 'readonly',174 SubtleCrypto: 'readonly',175 TextDecoder: 'readonly',176 TextDecoderStream: 'readonly',177 TextEncoder: 'readonly',178 TextEncoderStream: 'readonly',179 TransformStream: 'readonly',180 TransformStreamDefaultController: 'readonly',181 URL: 'readonly',182 URLSearchParams: 'readonly',183 WebAssembly: 'readonly',184 WebSocket: 'readonly',185 WritableStream: 'readonly',186 WritableStreamDefaultController: 'readonly',187 WritableStreamDefaultWriter: 'readonly',188 addEventListener: 'readonly',189 },190 ignorePatterns: ['.wrangler', '**/coverage', '**/dist'],191 rules: {192 'constructor-super': 'error',193 'for-direction': 'error',194 'getter-return': 'error',195 'no-async-promise-executor': 'error',196 'no-case-declarations': 'error',197 'no-class-assign': 'error',198 'no-compare-neg-zero': 'error',199 'no-cond-assign': 'error',200 'no-const-assign': 'error',201 'no-constant-binary-expression': 'error',202 'no-constant-condition': 'error',203 'no-control-regex': 'error',204 'no-debugger': ['error'],205 'no-delete-var': 'error',206 'no-dupe-class-members': 'error',207 'no-dupe-else-if': 'error',208 'no-dupe-keys': 'error',209 'no-duplicate-case': 'error',210 'no-empty': [211 'warn',212 {213 allowEmptyCatch: true,214 },215 ],216 'no-empty-character-class': 'error',217 'no-empty-pattern': 'error',218 'no-empty-static-block': 'error',219 'no-ex-assign': 'error',220 'no-extra-boolean-cast': 'error',221 'no-fallthrough': 'error',222 'no-func-assign': 'error',223 'no-global-assign': 'error',224 'no-import-assign': 'error',225 'no-invalid-regexp': 'error',226 'no-irregular-whitespace': 'error',227 'no-loss-of-precision': 'error',228 'no-misleading-character-class': 'error',229 'no-new-native-nonconstructor': 'error',230 'no-nonoctal-decimal-escape': 'error',231 'no-obj-calls': 'error',232 'no-prototype-builtins': 'error',233 'no-redeclare': 'error',234 'no-regex-spaces': 'error',235 'no-self-assign': 'error',236 'no-setter-return': 'error',237 'no-shadow-restricted-names': 'error',238 'no-sparse-arrays': 'error',239 'no-this-before-super': 'error',240 'no-unreachable': 'error',241 'no-unsafe-finally': 'error',242 'no-unsafe-negation': 'error',243 'no-unsafe-optional-chaining': 'error',244 'no-unused-labels': 'error',245 'no-unused-private-class-members': 'error',246 'no-unused-vars': [247 'warn',248 {249 args: 'all',250 argsIgnorePattern: '^_',251 caughtErrors: 'all',252 caughtErrorsIgnorePattern: '^_',253 destructuredArrayIgnorePattern: '^_',254 varsIgnorePattern: '^_',255 ignoreRestSiblings: true,256 },257 ],258 'no-useless-backreference': 'error',259 'no-useless-catch': 'error',260 'no-with': 'error',261 'require-yield': 'error',262 'use-isnan': 'error',263 'valid-typeof': 'error',264 'no-array-constructor': 'error',265 'no-empty-function': [266 'error',267 {268 allow: ['arrowFunctions'],269 },270 ],271 'prefer-const': [272 'warn',273 {274 destructuring: 'all',275 },276 ],277 curly: ['error', 'all'],278 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],279 'import/no-duplicates': 'error',280 'node/no-exports-assign': 'error',281 'typescript/ban-ts-comment': [282 'error',283 {284 minimumDescriptionLength: 10,285 },286 ],287 'typescript/no-duplicate-enum-values': 'error',288 'typescript/no-explicit-any': 'warn',289 'typescript/no-extra-non-null-assertion': 'error',290 'typescript/no-misused-new': 'error',291 'typescript/no-namespace': 'error',292 'typescript/no-non-null-asserted-nullish-coalescing': 'error',293 'typescript/no-non-null-asserted-optional-chain': 'error',294 'typescript/no-this-alias': 'error',295 'typescript/no-unnecessary-type-constraint': 'error',296 'typescript/no-unsafe-declaration-merging': 'error',297 'typescript/no-wrapper-object-types': 'error',298 'typescript/prefer-as-const': 'error',299 'typescript/prefer-namespace-keyword': 'error',300 'typescript/triple-slash-reference': 'error',301 'typescript/adjacent-overload-signatures': 'error',302 'typescript/ban-tslint-comment': 'error',303 'typescript/class-literal-property-style': 'error',304 'typescript/consistent-type-assertions': 'error',305 'typescript/consistent-type-imports': [306 'error',307 {308 prefer: 'type-imports',309 },310 ],311 },312 overrides: [313 {314 files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],315 rules: {316 'constructor-super': 'off',317 'getter-return': 'off',318 'no-class-assign': 'off',319 'no-const-assign': 'off',320 'no-dupe-class-members': 'off',321 'no-dupe-keys': 'off',322 'no-func-assign': 'off',323 'no-import-assign': 'off',324 'no-new-native-nonconstructor': 'off',325 'no-obj-calls': 'off',326 'no-redeclare': 'off',327 'no-setter-return': 'off',328 'no-this-before-super': 'off',329 'no-unreachable': 'off',330 'no-unsafe-negation': 'off',331 'no-var': 'error',332 'no-with': 'off',333 'prefer-rest-params': 'error',334 'prefer-spread': 'error',335 },336 },337 ],338 },339 pack: [340 {341 ...common,342 format: ['esm'],
23 unmodified lines