Files
RSSHub/eslint-plugins/no-then.js
T
Tony 1acb805799 style: migrate eslint to oxlint (#21224)
* chore: add oxlint support

* style: apply autofix

* style: apply autofix for toSorted

* style: use alternative api for nsfw-flag jsPlugins

* fix: git diff

* fix: codeql

* test: console.log

* style: update lint workflow to use Checkstyle SARIF converter

* style: remove debug log from extractDateFromURL function

* chore: use oxlint-json-to-sarif

* test: console.log

* test: remove console.log

* test: update cookie data expectation in getCookies test

https://github.com/mccutchen/go-httpbin/pull/235 breaks this

* style: type-aware linting

* style: enable type-aware linting for oxlint
2026-02-28 21:23:11 +08:00

46 lines
1.3 KiB
JavaScript

import { eslintCompatPlugin } from '@oxlint/plugins';
const rule = {
meta: {
type: 'suggestion',
docs: {
description: 'enforce using `async/await` syntax over Promises',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/no-then.md',
recommended: true,
},
schema: [],
messages: {
preferAsyncAwait: 'Prefer async/await to Promise.{{method}}()',
},
},
createOnce(context) {
return {
MemberExpression(node) {
if (node.property && node.property.name === 'then') {
context.report({
node: node.property,
messageId: 'preferAsyncAwait',
data: { method: 'then' },
});
} else if (node.property && node.property.name === 'catch') {
context.report({
node: node.property,
messageId: 'preferAsyncAwait',
data: { method: 'catch' },
});
}
},
};
},
};
export default eslintCompatPlugin({
meta: {
name: 'github',
},
rules: {
'no-then': rule,
},
});