Repository navigation
[NoQA] Oxlint with eslint-config-expensify #889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9d08b6d
959d78a
9f554b2
ff60b41
fdfd7af
6249880
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig", | ||
| "extends": "../../../tsconfig.json", | ||
| "compilerOptions": { | ||
| "module": "commonjs", | ||
| "moduleResolution": "node" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,12 @@ permissions: | |
| concurrency: ${{ github.workflow }} | ||
|
|
||
| jobs: | ||
| lint: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure we need to lint in publish if we weren't before?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only reason is ordering, auto-tighten commit and publish version bump commits both write to main. Bump lands about a minute after a merge. Running lint first makes the baseline commit go in before them, so they don’t race |
||
| uses: ./.github/workflows/lint.yml | ||
| secrets: inherit | ||
|
|
||
| publish: | ||
| needs: lint | ||
| # os-botify[bot] will update the version on `main`, so this check is important to prevent an infinite loop | ||
| if: ${{ github.actor != 'os-botify[bot]' }} | ||
| uses: Expensify/GitHub-Actions/.github/workflows/npmPublish.yml@main | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,3 +32,5 @@ jobs: | |
| CI: true | ||
|
|
||
| - run: npm run test:types | ||
|
|
||
| - run: npm run test:lint | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| import {spawnSync} from 'node:child_process'; | ||
| import path from 'node:path'; | ||
| import {fileURLToPath} from 'node:url'; | ||
| import {parseArgs} from 'node:util'; | ||
|
|
||
| import {LINT_SEVERITY, applySeatbelt, resolveSeatbeltOptions} from './seatbelt.mjs'; | ||
|
|
||
| const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..'); | ||
| // Called directly rather than through npx, which passes the whole command line to `sh -c` as one string. | ||
| const OXLINT_BIN = path.join(projectRoot, 'node_modules', '.bin', 'oxlint'); | ||
| const FATAL_EXIT_CODE = 2; | ||
| const JS_PLUGIN_CRASH_MESSAGE = 'Error running JS plugin'; | ||
|
|
||
| function fail(reason, output = '') { | ||
| console.error([reason, output.trim().slice(0, 2000)].filter(Boolean).join('\n')); | ||
| process.exit(FATAL_EXIT_CODE); | ||
| } | ||
|
|
||
| function runOxlint(args) { | ||
| const result = spawnSync(OXLINT_BIN, args, {cwd: projectRoot, encoding: 'utf8', maxBuffer: 512 * 1024 * 1024}); | ||
| if (result.error) { | ||
| fail(`Could not run ${OXLINT_BIN}: ${result.error.message}`); | ||
| } | ||
| return {stdout: result.stdout ?? '', stderr: result.stderr ?? '', exitCode: result.status ?? FATAL_EXIT_CODE}; | ||
| } | ||
|
|
||
| // Oxlint's JSON report leaves out files without findings, and the seatbelt needs them to notice fixed errors. | ||
| function listLintedFiles(targets) { | ||
| return runOxlint(['--debug=files', ...targets]) | ||
| .stdout.split('\n') | ||
| .map((line) => line.trim()) | ||
| .filter(Boolean) | ||
| .map((file) => path.resolve(projectRoot, file)); | ||
| } | ||
|
|
||
| // Oxlint prints `typescript(rule)` and `eslint(rule)`, while config and disable comments use `typescript/rule` and `rule`. | ||
| function toRuleID(code) { | ||
| const match = /^([\w@/.-]+)\((.+)\)$/.exec(code); | ||
| if (!match) { | ||
| return code; | ||
| } | ||
| return match[1] === 'eslint' ? match[2] : `${match[1]}/${match[2]}`; | ||
| } | ||
|
|
||
| function toLintMessage(diagnostic) { | ||
| const span = diagnostic.labels?.[0]?.span; | ||
| const text = [diagnostic.message, diagnostic.help, diagnostic.note].filter(Boolean).join('\n'); | ||
| return { | ||
| filePath: path.resolve(projectRoot, diagnostic.filename), | ||
| ruleID: diagnostic.code ? toRuleID(diagnostic.code) : null, | ||
| severity: ['warning', 'advice'].includes(diagnostic.severity) ? LINT_SEVERITY.WARNING : LINT_SEVERITY.ERROR, | ||
| // A diagnostic without a rule is a file Oxlint could not parse. | ||
| message: diagnostic.code ? text : `Parsing error: ${text}`, | ||
| line: span?.line ?? 0, | ||
| column: span?.column ?? 0, | ||
| }; | ||
| } | ||
|
|
||
| function lint(targets, fix) { | ||
| const {stdout, stderr, exitCode} = runOxlint(['--type-aware', '--format', 'json', ...(fix ? ['--fix'] : []), ...targets]); | ||
| // Oxlint exits 1 for findings. Anything higher, or no JSON at all, means it crashed or rejected the config. | ||
| const start = stdout.indexOf('{'); | ||
| const end = stdout.lastIndexOf('}'); | ||
| if (exitCode > 1 || start < 0 || end <= start) { | ||
| fail(`Oxlint failed (exit ${exitCode}).`, `${stderr}\n${stdout}`); | ||
| } | ||
| let report; | ||
| try { | ||
| report = JSON.parse(stdout.slice(start, end + 1)); | ||
| } catch { | ||
| fail('Could not parse Oxlint JSON output.', stdout); | ||
| } | ||
| if (!Array.isArray(report?.diagnostics)) { | ||
| fail('Oxlint JSON output has no `diagnostics` array.', stdout); | ||
| } | ||
| // A JS plugin crash has no rule and hides that file's JS plugin findings, so fail instead of reporting a parse error. | ||
| const crashes = report.diagnostics.filter((diagnostic) => !diagnostic.code && (diagnostic.message.startsWith(JS_PLUGIN_CRASH_MESSAGE) || !diagnostic.labels?.length)); | ||
| if (crashes.length) { | ||
| fail( | ||
| `Oxlint reported ${crashes.length} JS plugin crash(es):`, | ||
| crashes | ||
| .slice(0, 5) | ||
| .map((diagnostic) => ` ${diagnostic.filename}: ${diagnostic.message.split('\n').slice(0, 3).join(' ')}`) | ||
| .join('\n'), | ||
| ); | ||
| } | ||
| return report.diagnostics.map(toLintMessage); | ||
| } | ||
|
|
||
| function formatStylish(messages, errorCount, warningCount, showWarnings) { | ||
| const visible = showWarnings ? messages : messages.filter((message) => message.severity === LINT_SEVERITY.ERROR); | ||
| const lines = visible.map((message) => { | ||
| const location = `${path.relative(projectRoot, message.filePath)}:${message.line}:${message.column}`; | ||
| const level = message.severity === LINT_SEVERITY.ERROR ? 'error' : 'warning'; | ||
| return `${location}\n ${level} ${message.message}${message.ruleID ? ` ${message.ruleID}` : ''}`; | ||
| }); | ||
| const summary = `${errorCount} error${errorCount === 1 ? '' : 's'}${showWarnings ? `, ${warningCount} warning${warningCount === 1 ? '' : 's'}` : ''}`; | ||
| return [...lines, summary].join('\n\n'); | ||
| } | ||
|
|
||
| const {values, positionals} = parseArgs({ | ||
| allowPositionals: true, | ||
| options: { | ||
| 'show-warnings': {type: 'boolean', default: false}, | ||
| format: {type: 'string', default: 'stylish'}, | ||
| fix: {type: 'boolean', default: false}, | ||
| }, | ||
| }); | ||
| if (!['stylish', 'json'].includes(values.format)) { | ||
| fail(`Unknown format "${values.format}". Expected stylish or json.`); | ||
| } | ||
|
|
||
| const targets = positionals.length ? positionals : ['.']; | ||
| const lintedFiles = listLintedFiles(targets); | ||
| if (!lintedFiles.length) { | ||
| fail(`Oxlint matched no files for: ${targets.join(' ')}`); | ||
| } | ||
|
|
||
| const {messages} = applySeatbelt(lint(targets, values.fix), resolveSeatbeltOptions(projectRoot), lintedFiles); | ||
| const errorCount = messages.filter((message) => message.severity === LINT_SEVERITY.ERROR).length; | ||
| const warningCount = messages.length - errorCount; | ||
| if (values.format === 'json') { | ||
| console.log(JSON.stringify({messages, errorCount, warningCount})); | ||
| } else { | ||
| console.log(formatStylish(messages, errorCount, warningCount, values['show-warnings'])); | ||
| } | ||
| process.exitCode = errorCount > 0 ? 1 : 0; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # seatbelt temporarily allowed errors | ||
| # docs: config/oxlint/seatbelt.mjs | ||
|
|
||
| "../../buildDocs.ts" "hosted/no-extraneous-dependencies" 1 | ||
| "../../jest-test-environment.ts" "hosted/no-extraneous-dependencies" 1 | ||
| "../../lib/DevTools/RealDevTools.ts" "typescript/no-unsafe-assignment" 1 | ||
| "../../lib/DevTools/RealDevTools.ts" "typescript/no-unsafe-member-access" 1 | ||
| "../../lib/DevTools/RealDevTools.ts" "typescript/no-unsafe-type-assertion" 1 | ||
| "../../lib/Onyx.ts" "no-loop-func" 1 | ||
| "../../lib/Onyx.ts" "typescript/no-redundant-type-constituents" 3 | ||
| "../../lib/Onyx.ts" "typescript/no-unnecessary-type-assertion" 9 | ||
| "../../lib/Onyx.ts" "typescript/no-unsafe-type-assertion" 14 | ||
| "../../lib/Onyx.ts" "typescript/non-nullable-type-assertion-style" 1 | ||
| "../../lib/OnyxCache.ts" "typescript/no-redundant-type-constituents" 2 | ||
| "../../lib/OnyxKeys.ts" "typescript/restrict-template-expressions" 1 | ||
| "../../lib/OnyxMerge/index.native.ts" "typescript/no-redundant-type-constituents" 2 | ||
| "../../lib/OnyxMerge/index.native.ts" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../lib/OnyxMerge/index.ts" "typescript/no-redundant-type-constituents" 2 | ||
| "../../lib/OnyxMerge/index.ts" "typescript/no-unsafe-type-assertion" 2 | ||
| "../../lib/OnyxMerge/types.ts" "typescript/no-redundant-type-constituents" 2 | ||
| "../../lib/OnyxSubscriptionManager.ts" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../lib/OnyxSubscriptionManager.ts" "typescript/restrict-template-expressions" 1 | ||
| "../../lib/OnyxUtils.ts" "no-use-before-define" 28 | ||
| "../../lib/OnyxUtils.ts" "typescript/no-redundant-type-constituents" 7 | ||
| "../../lib/OnyxUtils.ts" "typescript/no-unnecessary-type-assertion" 2 | ||
| "../../lib/OnyxUtils.ts" "typescript/no-unsafe-argument" 5 | ||
| "../../lib/OnyxUtils.ts" "typescript/no-unsafe-type-assertion" 23 | ||
| "../../lib/OnyxUtils.ts" "typescript/non-nullable-type-assertion-style" 1 | ||
| "../../lib/OnyxUtils.ts" "typescript/prefer-nullish-coalescing" 3 | ||
| "../../lib/StateMachine.ts" "typescript/no-unsafe-type-assertion" 2 | ||
| "../../lib/storage/__mocks__/index.ts" "typescript/no-unsafe-argument" 1 | ||
| "../../lib/storage/InstanceSync/index.web.ts" "hosted/no-types" 1 | ||
| "../../lib/storage/InstanceSync/index.web.ts" "typescript/no-unsafe-type-assertion" 1 | ||
| "../../lib/storage/InstanceSync/index.web.ts" "typescript/restrict-template-expressions" 1 | ||
| "../../lib/storage/providers/IDBKeyValProvider/index.ts" "typescript/no-unsafe-return" 1 | ||
| "../../lib/storage/providers/IDBKeyValProvider/index.ts" "typescript/no-unsafe-type-assertion" 3 | ||
| "../../lib/storage/providers/MemoryOnlyProvider.ts" "typescript/no-unsafe-type-assertion" 5 | ||
| "../../lib/storage/providers/SQLiteProvider.ts" "hosted/naming-convention" 4 | ||
| "../../lib/storage/providers/SQLiteProvider.ts" "typescript/no-unsafe-assignment" 1 | ||
| "../../lib/storage/providers/SQLiteProvider.ts" "typescript/no-unsafe-return" 2 | ||
| "../../lib/storage/providers/SQLiteProvider.ts" "typescript/no-unsafe-type-assertion" 3 | ||
| "../../lib/storage/providers/SQLiteProvider.ts" "unicorn/prefer-at" 1 | ||
| "../../lib/types.ts" "typescript/consistent-type-definitions" 1 | ||
| "../../lib/types.ts" "typescript/no-empty-object-type" 1 | ||
| "../../lib/types.ts" "typescript/no-restricted-types" 2 | ||
| "../../lib/useOnyx.ts" "typescript/no-unsafe-type-assertion" 2 | ||
| "../../lib/utils.ts" "hosted/naming-convention" 2 | ||
| "../../lib/utils.ts" "typescript/no-redundant-type-constituents" 2 | ||
| "../../lib/utils.ts" "typescript/no-unsafe-type-assertion" 9 | ||
| "../../tests/perf-test/Onyx.perf-test.ts" "typescript/no-unnecessary-type-assertion" 2 | ||
| "../../tests/perf-test/Onyx.perf-test.ts" "typescript/no-unsafe-type-assertion" 1 | ||
| "../../tests/perf-test/Onyx.perf-test.ts" "typescript/restrict-template-expressions" 1 | ||
| "../../tests/perf-test/OnyxCache.perf-test.ts" "typescript/no-unnecessary-type-assertion" 1 | ||
| "../../tests/perf-test/OnyxCache.perf-test.ts" "typescript/no-unsafe-assignment" 1 | ||
| "../../tests/perf-test/OnyxCache.perf-test.ts" "typescript/no-unsafe-member-access" 1 | ||
| "../../tests/perf-test/OnyxCache.perf-test.ts" "typescript/no-unsafe-type-assertion" 1 | ||
| "../../tests/perf-test/OnyxCache.perf-test.ts" "typescript/non-nullable-type-assertion-style" 1 | ||
| "../../tests/perf-test/OnyxUtils.perf-test.ts" "typescript/no-misused-promises" 1 | ||
| "../../tests/perf-test/OnyxUtils.perf-test.ts" "typescript/no-unnecessary-type-assertion" 5 | ||
| "../../tests/perf-test/OnyxUtils.perf-test.ts" "typescript/no-unsafe-type-assertion" 1 | ||
| "../../tests/perf-test/useOnyx.perf-test.tsx" "typescript/no-unnecessary-type-assertion" 1 | ||
| "../../tests/perf-test/useOnyx.perf-test.tsx" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../tests/perf-test/utils.perf-test.ts" "typescript/no-unsafe-call" 1 | ||
| "../../tests/perf-test/utils.perf-test.ts" "typescript/no-unsafe-member-access" 3 | ||
| "../../tests/unit/collectionHydrationTest.ts" "typescript/no-unsafe-assignment" 3 | ||
| "../../tests/unit/collectionHydrationTest.ts" "typescript/no-unsafe-member-access" 7 | ||
| "../../tests/unit/collectionHydrationTest.ts" "unicorn/prefer-at" 3 | ||
| "../../tests/unit/DevToolsTest.ts" "typescript/no-unnecessary-type-assertion" 1 | ||
| "../../tests/unit/DevToolsTest.ts" "typescript/no-unsafe-assignment" 2 | ||
| "../../tests/unit/DevToolsTest.ts" "typescript/no-unsafe-type-assertion" 9 | ||
| "../../tests/unit/onyxCacheTest.tsx" "typescript/no-non-null-assertion" 5 | ||
| "../../tests/unit/onyxCacheTest.tsx" "typescript/no-unsafe-assignment" 8 | ||
| "../../tests/unit/onyxCacheTest.tsx" "typescript/no-unsafe-member-access" 7 | ||
| "../../tests/unit/onyxCacheTest.tsx" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../tests/unit/onyxClearConcurrentWriteTest.ts" "typescript/no-unsafe-assignment" 1 | ||
| "../../tests/unit/onyxClearConcurrentWriteTest.ts" "typescript/no-unsafe-member-access" 1 | ||
| "../../tests/unit/onyxClearConcurrentWriteTest.ts" "typescript/no-unsafe-type-assertion" 1 | ||
| "../../tests/unit/onyxClearNativeStorageTest.ts" "typescript/no-unsafe-assignment" 1 | ||
| "../../tests/unit/onyxClearNativeStorageTest.ts" "typescript/no-unsafe-member-access" 1 | ||
| "../../tests/unit/onyxClearNativeStorageTest.ts" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../tests/unit/onyxClearWebStorageTest.ts" "typescript/no-unnecessary-type-assertion" 4 | ||
| "../../tests/unit/onyxClearWebStorageTest.ts" "typescript/no-unsafe-assignment" 1 | ||
| "../../tests/unit/onyxClearWebStorageTest.ts" "typescript/no-unsafe-member-access" 1 | ||
| "../../tests/unit/OnyxMergeNativeTest.ts" "typescript/no-unsafe-return" 3 | ||
| "../../tests/unit/onyxMultiMergeWebStorageTest.ts" "typescript/no-unnecessary-type-assertion" 5 | ||
| "../../tests/unit/onyxMultiMergeWebStorageTest.ts" "typescript/no-unsafe-assignment" 1 | ||
| "../../tests/unit/onyxMultiMergeWebStorageTest.ts" "typescript/no-unsafe-member-access" 1 | ||
| "../../tests/unit/onyxMultiMergeWebStorageTest.ts" "typescript/no-unsafe-type-assertion" 1 | ||
| "../../tests/unit/OnyxSubscriptionManagerTest.ts" "typescript/no-unnecessary-type-assertion" 1 | ||
| "../../tests/unit/OnyxSubscriptionManagerTest.ts" "typescript/no-unsafe-member-access" 1 | ||
| "../../tests/unit/OnyxSubscriptionManagerTest.ts" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../tests/unit/onyxTest.ts" "hosted/no-extraneous-dependencies" 2 | ||
| "../../tests/unit/onyxTest.ts" "typescript/no-deprecated" 2 | ||
| "../../tests/unit/onyxTest.ts" "typescript/no-unnecessary-type-assertion" 70 | ||
| "../../tests/unit/onyxTest.ts" "typescript/no-unsafe-assignment" 16 | ||
| "../../tests/unit/onyxTest.ts" "typescript/no-unsafe-call" 7 | ||
| "../../tests/unit/onyxTest.ts" "typescript/no-unsafe-member-access" 29 | ||
| "../../tests/unit/onyxTest.ts" "typescript/no-unsafe-return" 1 | ||
| "../../tests/unit/onyxTest.ts" "typescript/no-unsafe-type-assertion" 47 | ||
| "../../tests/unit/onyxUtilsTest.ts" "typescript/no-unnecessary-type-assertion" 21 | ||
| "../../tests/unit/onyxUtilsTest.ts" "typescript/no-unsafe-assignment" 9 | ||
| "../../tests/unit/onyxUtilsTest.ts" "typescript/no-unsafe-call" 2 | ||
| "../../tests/unit/onyxUtilsTest.ts" "typescript/no-unsafe-member-access" 20 | ||
| "../../tests/unit/onyxUtilsTest.ts" "typescript/no-unsafe-return" 1 | ||
| "../../tests/unit/onyxUtilsTest.ts" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../tests/unit/storage/instanceSyncWebTest.ts" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../tests/unit/storage/providers/createStoreTest.ts" "typescript/no-non-null-assertion" 1 | ||
| "../../tests/unit/storage/providers/createStoreTest.ts" "typescript/no-unnecessary-type-assertion" 4 | ||
| "../../tests/unit/storage/providers/createStoreTest.ts" "typescript/no-unsafe-assignment" 27 | ||
| "../../tests/unit/storage/providers/createStoreTest.ts" "typescript/no-unsafe-type-assertion" 11 | ||
| "../../tests/unit/storage/providers/createStoreTest.ts" "typescript/unbound-method" 15 | ||
| "../../tests/unit/storage/providers/IDBKeyvalProviderTest.ts" "typescript/no-unnecessary-type-assertion" 2 | ||
| "../../tests/unit/storage/providers/IDBKeyvalProviderTest.ts" "typescript/no-unsafe-member-access" 2 | ||
| "../../tests/unit/storage/providers/IDBKeyvalProviderTest.ts" "typescript/no-unsafe-type-assertion" 4 | ||
| "../../tests/unit/storage/providers/IDBKeyvalProviderTest.ts" "typescript/unbound-method" 2 | ||
| "../../tests/unit/storage/providers/SQLiteProviderTest.ts" "hosted/naming-convention" 3 | ||
| "../../tests/unit/storage/providers/SQLiteProviderTest.ts" "typescript/no-non-null-assertion" 8 | ||
| "../../tests/unit/storage/providers/SQLiteProviderTest.ts" "typescript/no-unnecessary-type-assertion" 7 | ||
| "../../tests/unit/storage/providers/SQLiteProviderTest.ts" "typescript/no-unsafe-member-access" 2 | ||
| "../../tests/unit/storage/providers/SQLiteProviderTest.ts" "typescript/no-unsafe-type-assertion" 5 | ||
| "../../tests/unit/storage/providers/SQLiteProviderTest.ts" "typescript/unbound-method" 5 | ||
| "../../tests/unit/storage/SQLiteStorageFallbackTest.ts" "typescript/no-unsafe-assignment" 1 | ||
| "../../tests/unit/storage/SQLiteStorageFallbackTest.ts" "typescript/no-unsafe-return" 1 | ||
| "../../tests/unit/storage/tryOrDegradePerformanceTest.ts" "typescript/no-unsafe-assignment" 3 | ||
| "../../tests/unit/storage/tryOrDegradePerformanceTest.ts" "typescript/no-unsafe-member-access" 2 | ||
| "../../tests/unit/storage/tryOrDegradePerformanceTest.ts" "typescript/no-unsafe-return" 1 | ||
| "../../tests/unit/storage/tryOrDegradePerformanceTest.ts" "typescript/no-unsafe-type-assertion" 1 | ||
| "../../tests/unit/useOnyxTest.ts" "typescript/no-unnecessary-type-assertion" 17 | ||
| "../../tests/unit/useOnyxTest.ts" "typescript/no-unsafe-assignment" 2 | ||
| "../../tests/unit/useOnyxTest.ts" "typescript/no-unsafe-call" 2 | ||
| "../../tests/unit/useOnyxTest.ts" "typescript/no-unsafe-member-access" 2 | ||
| "../../tests/unit/useOnyxTest.ts" "typescript/no-unsafe-type-assertion" 24 | ||
| "../../tests/unit/useOnyxTest.ts" "typescript/prefer-nullish-coalescing" 1 | ||
| "../../tests/unit/utilsTest.ts" "typescript/no-restricted-types" 1 | ||
| "../../tests/unit/utilsTest.ts" "typescript/no-unnecessary-type-assertion" 2 | ||
| "../../tests/unit/utilsTest.ts" "typescript/no-unsafe-member-access" 3 | ||
| "../../tests/unit/utilsTest.ts" "typescript/no-unsafe-type-assertion" 8 | ||
| "../../tests/utils/collections/reportActions.ts" "typescript/restrict-template-expressions" 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If another push advances
mainafter this check but before the PUT, the request still writes tobranch=main; itsshaisHEAD:$file, andgh api --helpdefines--fieldas “Add a typed parameter in key=value format,” not a precondition on the branch ref. The stale run can therefore lower the baseline beneath diagnostics added by the concurrent push; its bot push is skipped, while that push's run can already have checked out its event SHA and skip saving after seeing the bot commit, leaving subsequent main lint failing. Use an atomic ref compare-and-swap or re-lint the latestmainbefore writing. Fresh evidence: this change adds only a separate preflightls-remote, so the interval before the PUT remains racy.Useful? React with 👍 / 👎.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is a small window between the check and the PUT. The gap is about few seconds probably, and the closest merges to main in the recent run history were about two minutes apart, so closing it probably isn’t worth the extra code. If it ever happens, main goes red and the fix is to raise the baseline. EApp avoids it with
git push, which needs secrets Onyx doesn’t have yet, so I would skip this case