Closed as not planned
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
normal lint code
create(extensionId, mimeType, hostname);
LINTER:
Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.eslint@typescript-eslint/no-floating-promises
invalid lint code
const result = create(extensionId, mimeType, hostname);
LINTER:
const create: <string>(extensionId?: string | undefined, mimeType?: string | undefined, hostname?: string | undefined) => Promise<WyrmInstance>
ESLint Config
require('@rushstack/eslint-patch/modern-module-resolution');
const rules = require('./.eslint-rules.cjs');
const _tsconfig = require('./tsconfig.json');
const _alias = _tsconfig.compilerOptions.paths;
const arrayType = ['.js', '.mjs', '.jsx', '.ts', '.d.ts', '.tsx'];
const pluginsRule = ['unicorn', 'import', 'json', 'promise', 'optimize-regex', 'sonarjs'];
const listFiles = {
extVue: ['*.vue', '*.html'],
extJs: ['*.js', '*.cjs', '*.mjs', '*.jsx', '*.ts', '*.d.ts', '*.tsx'],
};
const extendsRule = [
'./.eslintrc-auto-import.json',
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:sonarjs/recommended',
'plugin:json/recommended',
'plugin:unicorn/all',
];
const envRule = {
browser: true,
es6: true,
node: true,
jest: true,
};
const settingsRule = {
'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'] },
'import/extensions': arrayType,
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.json',
},
alias: true,
node: { extensions: arrayType },
'eslint-import-resolver-custom-alias': {
alias: _alias,
extensions: arrayType,
},
},
'prettier-vue': {
SFCBlocks: {
template: true,
script: true,
style: true,
customBlocks: {
docs: { lang: 'markdown' },
config: { lang: 'json' },
module: { lang: 'js' },
comments: false,
},
},
usePrettierrc: true,
fileInfoOptions: {
withNodeModules: false,
},
},
};
// ---------------- START ----------------
module.exports = {
root: true,
ignorePatterns: ['!.*', 'dist', 'node_modules'],
overrides: [
{
rules,
files: listFiles.extJs,
env: envRule,
parser: '@typescript-eslint/parser',
parserOptions: {
extraFileExtensions: ['.vue'],
sourceType: 'module',
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
project: 'tsconfig.json',
tsconfigRootDir: process.cwd(),
},
extends: [
...extendsRule,
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
plugins: pluginsRule,
settings: settingsRule,
},
{
rules,
env: {
...envRule,
'vue/setup-compiler-macros': true,
},
files: listFiles.extVue,
parser: 'vue-eslint-parser',
parserOptions: {
extraFileExtensions: ['.vue'],
sourceType: 'module',
ecmaVersion: 'latest',
parser: '@typescript-eslint/parser',
ecmaFeatures: { jsx: true },
project: 'tsconfig.json',
'<i18n>': '@typescript-eslint/parser',
},
extends: [
...extendsRule,
'plugin:vue/vue3-recommended',
'plugin:vue/vue3-essential',
'@vue/eslint-config-typescript/recommended',
'@vue/eslint-config-prettier',
],
plugins: [...pluginsRule, 'vue'],
settings: settingsRule,
},
],
};
tsconfig
Expected Result
when assigned to a variable, the expected promise is not found by eslint
without a variable, everything works and the function is recognized as a promise
Actual Result
a function definition is expected that this is a promise
Additional Info
No response