Skip to content
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

chore: enable no-unsafe-return internally #3471

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Expand Up @@ -66,7 +66,6 @@ module.exports = {

// TODO - enable these new recommended rules
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
// TODO - enable this
'@typescript-eslint/naming-convention': 'off',
Expand Down Expand Up @@ -173,6 +172,7 @@ module.exports = {
},
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'eslint-plugin/no-identical-tests': 'error',
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
Expand All @@ -198,6 +198,7 @@ module.exports = {
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
},
},
Expand Down
4 changes: 3 additions & 1 deletion packages/eslint-plugin/src/rules/no-loss-of-precision.ts
Expand Up @@ -4,7 +4,9 @@ import * as util from '../util';

const baseRule = ((): typeof BaseRule | null => {
try {
return require('eslint/lib/rules/no-loss-of-precision');
return require('eslint/lib/rules/no-loss-of-precision') as
| typeof BaseRule
| null;
} catch {
/* istanbul ignore next */
return null;
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/tools/generate-rules-lists.ts
Expand Up @@ -43,7 +43,7 @@ const staticElements = {
emojiKey.fixable,
emojiKey.requiresTypeChecking,
],
listSpacerRow: Array(5).fill('-'),
listSpacerRow: Array<string>(5).fill('-'),
};

const returnEmojiIfTrue = <TKey extends keyof typeof emojiKey>(
Expand Down
Expand Up @@ -18,7 +18,7 @@ const SEEN_NODES = new Map<Node, number>();

const serializer: NewPlugin = {
test(val): boolean {
return (
return !!(
bradzacher marked this conversation as resolved.
Show resolved Hide resolved
val &&
typeof val === 'object' &&
// make sure it's not one of the classes from the package
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-estree/src/convert.ts
@@ -1,5 +1,5 @@
// There's lots of funny stuff due to the typing of ts.Node
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return */
import * as ts from 'typescript';
import {
canContainDirective,
Expand Down
4 changes: 2 additions & 2 deletions tools/generate-contributors.ts
Expand Up @@ -78,9 +78,9 @@ async function main(): Promise<void> {

// fetch the user info
const users = await Promise.all(
githubContributors.map<Promise<User>>(async c => {
githubContributors.map(async c => {
const response = await fetch(c.url, { method: 'GET' });
return response.json();
return (await response.json()) as User;
}),
);

Expand Down