Skip to content

chore: enable no-unsafe-return internally #3471

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const SEEN_NODES = new Map<Node, number>();

const serializer: NewPlugin = {
test(val): boolean {
return (
return !!(
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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