mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-11-25 00:28:06 +08:00
* style: use cloudflare/oxlint-config * style: fix no-known-value-widening * style: fix typescript/only-throw-error * style: fix typescript/no-floating-promises * style: fix typescript/use-unknown-in-catch-callback-variable * style: fix typescript/no-misused-promises * style: fix typescript/no-unsafe-unary-minus * style: fix typescript/no-for-in-array * style: fix react/purity * style: fix typescript/switch-exhaustiveness-check * style: fix typescript/unbound-method * style: fix react/rules-of-hooks * style: fix typescript/return-await * style: fix react/button-has-type * style: fix react/no-unescaped-entities * style: fix import/no-namespace * style: fix typescript/no-import-type-side-effects * style: fix no-promise-executor-return * style: fix no-useless-assignment * style: fix typescript/no-misused-spread * style: fix react/jsx-no-target-blank * style: fix typescript/await-thenable * style: fix typescript/no-unnecessary-type-assertion * style: fix import/consistent-type-specifier-style * style: fix react/no-unknown-property * style: remove unused disable directive * style: merge region * style: enable prefer-smaller-scope * style: add react/no-danger * style: add unicorn-js/prefer-uint8array-base64/hex * style: move non-recommended unicorn rules to custom region
12 lines
390 B
TypeScript
12 lines
390 B
TypeScript
import { parseSync, rawTransferSupported } from 'oxc-parser';
|
|
|
|
export const parseScriptSource = (source: string) => {
|
|
const { program, errors } = parseSync('script.js', source, {
|
|
lang: 'js',
|
|
sourceType: 'script',
|
|
preserveParens: false,
|
|
experimentalRawTransfer: rawTransferSupported(),
|
|
} as never);
|
|
return Promise.resolve({ program, errors });
|
|
};
|