Eslint migration 4 (#13773)

A new attempt to migrate!
This commit is contained in:
Félix Malfait 2025-08-08 16:21:57 +02:00 committed by GitHub
parent 81012ab1fb
commit 5fae14377a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 1206 additions and 510 deletions

View file

@ -5,7 +5,7 @@ module.exports = {
'plugin:@nx/react',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:storybook/recommended',
// 'plugin:storybook/recommended', // Temporarily disabled
'plugin:prettier/recommended',
'plugin:lingui/recommended',
'plugin:@nx/typescript'
@ -143,17 +143,18 @@ module.exports = {
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
{
files: ['.storybook/main.@(js|cjs|mjs|ts)'],
rules: {
'storybook/no-uninstalled-addons': [
'error',
{
packageJsonLocation: path.resolve(__dirname, './package.json'),
},
],
},
},
// Temporarily disabled storybook rules / TODO: Re-enable after migrating Storybook to v8
// {
// files: ['.storybook/main.@(js|cjs|mjs|ts)'],
// rules: {
// 'storybook/no-uninstalled-addons': [
// 'error',
// {
// packageJsonLocation: path.resolve(__dirname, './package.json'),
// },
// ],
// },
// },
{
files: ['*.js', '*.jsx'],
extends: ['plugin:@nx/javascript'],

View file

@ -43,6 +43,9 @@
"cacheLocation": "{workspaceRoot}/.cache/eslint",
"ignorePath": "{workspaceRoot}/.gitignore"
},
"env": {
"ESLINT_USE_FLAT_CONFIG": "false"
},
"configurations": {
"ci": { "cacheStrategy": "content" },
"fix": { "fix": true }
@ -106,7 +109,7 @@
"outputs": ["{projectRoot}/{options.output-dir}"],
"options": {
"cwd": "{projectRoot}",
"command": "VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true storybook build --test",
"command": "ESLINT_USE_FLAT_CONFIG=false VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true storybook build --test",
"output-dir": "storybook-static",
"config-dir": ".storybook"
},
@ -261,5 +264,4 @@
},
"useInferencePlugins": false,
"defaultBase": "main",
"nxCloudId": "6895ca12e7d4ba1786546b3c"
}

View file

@ -265,10 +265,9 @@
"@types/react-dom": "^18.2.15",
"@types/supertest": "^2.0.11",
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/experimental-utils": "^5.62.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/utils": "6.21.0",
"@typescript-eslint/eslint-plugin": "^8.39.0",
"@typescript-eslint/parser": "^8.39.0",
"@typescript-eslint/utils": "^8.39.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"@vitest/ui": "1.4.0",
"@yarnpkg/types": "^4.0.0",
@ -279,21 +278,21 @@
"dotenv-cli": "^7.2.1",
"drizzle-kit": "^0.20.14",
"esbuild": "^0.23.0",
"eslint": "^8.53.0",
"eslint-config-next": "14.0.4",
"eslint": "^9.32.0",
"eslint-config-next": "^15.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-lingui": "^0.9.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-project-structure": "^3.9.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.4",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-storybook": "^0.9.0",
"eslint-plugin-unicorn": "^56.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"http-server": "^14.1.1",
"jest": "29.7.0",

View file

@ -3,8 +3,8 @@
"private": true,
"type": "module",
"scripts": {
"build": "NODE_ENV=production VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=8192 npx vite build && sh ./scripts/inject-runtime-env.sh",
"build:sourcemaps": "NODE_ENV=production VITE_BUILD_SOURCEMAP=true VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=8192 npx vite build && sh ./scripts/inject-runtime-env.sh",
"build": "ESLINT_USE_FLAT_CONFIG=false NODE_ENV=production VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=8192 npx vite build && sh ./scripts/inject-runtime-env.sh",
"build:sourcemaps": "ESLINT_USE_FLAT_CONFIG=false NODE_ENV=production VITE_BUILD_SOURCEMAP=true VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=8192 npx vite build && sh ./scripts/inject-runtime-env.sh",
"start:prod": "NODE_ENV=production npx serve -s build",
"tsup": "npx tsup"
},
@ -67,25 +67,24 @@
"@lingui/swc-plugin": "^5.1.0",
"@lingui/vite-plugin": "^5.1.2",
"@types/file-saver": "^2",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/experimental-utils": "^5.62.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/utils": "6.21.0",
"eslint": "^8.53.0",
"eslint-config-next": "14.0.4",
"@typescript-eslint/eslint-plugin": "^8.39.0",
"@typescript-eslint/parser": "^8.39.0",
"@typescript-eslint/utils": "^8.39.0",
"eslint": "^9.32.0",
"eslint-config-next": "^15.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-lingui": "^0.9.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-project-structure": "^3.9.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.4",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-storybook": "^0.9.0",
"eslint-plugin-unicorn": "^56.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"optionator": "^0.9.1",
"rollup-plugin-visualizer": "^5.14.0"

View file

@ -1,4 +1,5 @@
import { ThemeType } from 'twenty-ui/theme';
declare module '@emotion/react' {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface Theme extends ThemeType {}
}

View file

@ -13,7 +13,7 @@ const StyledContainer = styled.div<{ maxWidth?: number }>`
display: flex;
flex-wrap: wrap;
gap: ${({ theme }) => theme.spacing(1)};
max-width: ${({ maxWidth }) => `${maxWidth}px` || 'none'};
max-width: ${({ maxWidth }) => (maxWidth ? `${maxWidth}px` : 'none')};
`;
export const ActivityTargetChips = ({

View file

@ -18,6 +18,7 @@ const StyledContainer = styled.div`
width: 480px;
`;
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface SettingsOptionCardContentSelectProps
extends React.ComponentProps<typeof SettingsOptionCardContentSelect> {}

View file

@ -24,11 +24,11 @@ import { AdvancedSettingsWrapper } from '@/settings/components/AdvancedSettingsW
import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState';
import { t } from '@lingui/core/macro';
import { useRecoilValue } from 'recoil';
import { SettingsDataModelFieldSelectFormOptionRow } from './SettingsDataModelFieldSelectFormOptionRow';
import { CardContent, CardFooter } from 'twenty-ui/layout';
import { IconPlus, IconPoint } from 'twenty-ui/display';
import { LightButton } from 'twenty-ui/input';
import { CardContent, CardFooter } from 'twenty-ui/layout';
import { MAIN_COLORS } from 'twenty-ui/theme';
import { SettingsDataModelFieldSelectFormOptionRow } from './SettingsDataModelFieldSelectFormOptionRow';
export const settingsDataModelFieldSelectFormSchema = z.object({
defaultValue: selectFieldDefaultValueSchema(),
@ -40,13 +40,9 @@ export const settingsDataModelFieldMultiSelectFormSchema = z.object({
options: selectOptionsSchema,
});
const selectOrMultiSelectFormSchema = z.union([
settingsDataModelFieldSelectFormSchema,
settingsDataModelFieldMultiSelectFormSchema,
]);
export type SettingsDataModelFieldSelectFormValues = z.infer<
typeof selectOrMultiSelectFormSchema
| typeof settingsDataModelFieldSelectFormSchema
| typeof settingsDataModelFieldMultiSelectFormSchema
>;
type SettingsDataModelFieldSelectFormProps = {

View file

@ -1,5 +1,5 @@
import { useFormContext } from 'react-hook-form';
import styled from '@emotion/styled';
import { useFormContext } from 'react-hook-form';
import { z } from 'zod';
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
@ -15,13 +15,9 @@ import {
SettingsDataModelFieldPreviewCardProps,
} from '@/settings/data-model/fields/preview/components/SettingsDataModelFieldPreviewCard';
const selectOrMultiSelectFormSchema = z.union([
settingsDataModelFieldSelectFormSchema,
settingsDataModelFieldMultiSelectFormSchema,
]);
type SettingsDataModelFieldSelectOrMultiSelectFormValues = z.infer<
typeof selectOrMultiSelectFormSchema
| typeof settingsDataModelFieldSelectFormSchema
| typeof settingsDataModelFieldMultiSelectFormSchema
>;
type SettingsDataModelFieldSelectSettingsFormCardProps = {

View file

@ -1,28 +1,17 @@
import { Meta, StoryObj } from '@storybook/react';
import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';
import { WorkflowDiagramStepNodeData } from '@/workflow/workflow-diagram/types/WorkflowDiagram';
import { WorkflowDiagramNodeVariant } from '@/workflow/workflow-diagram/types/WorkflowDiagramNodeVariant';
import { fn } from '@storybook/test';
import '@xyflow/react/dist/style.css';
import { ComponentProps } from 'react';
import { RecoilRoot } from 'recoil';
import { CatalogDecorator, CatalogStory } from 'twenty-ui/testing';
import { ReactflowDecorator } from '~/testing/decorators/ReactflowDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { WorkflowDiagramStepNodeEditableContent } from '../WorkflowDiagramStepNodeEditableContent';
import { RecoilRoot } from 'recoil';
import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';
type ComponentState = 'default' | 'hover' | 'selected';
type WrapperProps = ComponentProps<
typeof WorkflowDiagramStepNodeEditableContent
> & { state: ComponentState };
const Wrapper = (_props: WrapperProps) => {
return <div></div>;
};
const meta: Meta<WrapperProps> = {
const meta: Meta<typeof WorkflowDiagramStepNodeEditableContent> = {
title: 'Modules/Workflow/WorkflowDiagramStepNodeEditableContent',
component: WorkflowDiagramStepNodeEditableContent,
parameters: {
@ -32,7 +21,7 @@ const meta: Meta<WrapperProps> = {
export default meta;
type Story = StoryObj<typeof Wrapper>;
type Story = StoryObj<typeof WorkflowDiagramStepNodeEditableContent>;
const ALL_STEPS = [
{
@ -125,8 +114,15 @@ const ALL_STEPS = [
},
] satisfies WorkflowDiagramStepNodeData[];
export const Catalog: CatalogStory<Story, typeof Wrapper> = {
export const Catalog: CatalogStory<
Story,
typeof WorkflowDiagramStepNodeEditableContent
> = {
args: {
id: 'story-node',
data: ALL_STEPS[0],
variant: 'default',
selected: false,
onDelete: fn(),
},
parameters: {
@ -157,9 +153,9 @@ export const Catalog: CatalogStory<Story, typeof Wrapper> = {
props: (variant: WorkflowDiagramNodeVariant) => ({ variant }),
},
{
name: 'state',
values: ['default', 'hover', 'selected'] satisfies ComponentState[],
props: (state: ComponentState) => ({ state }),
name: 'selected',
values: [false, true],
props: (selected: boolean) => ({ selected }),
},
],
},
@ -167,9 +163,7 @@ export const Catalog: CatalogStory<Story, typeof Wrapper> = {
decorators: [
(Story, { args }) => {
return (
<div
className={`selectable ${args.state === 'selected' ? 'selected' : args.state === 'hover' ? 'workflow-node-container hover' : ''}`}
>
<div className={`selectable ${args.selected ? 'selected' : ''}`}>
<RecoilRoot>
<WorkflowVisualizerComponentInstanceContext.Provider
value={{ instanceId: 'workflow-visualizer-instance-id' }}

View file

@ -73,7 +73,7 @@ export default defineConfig(({ command, mode }) => {
checkers['eslint'] = {
lintCommand:
// Appended to packages/twenty-front/.eslintrc.cjs
'eslint ../../packages/twenty-front --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs',
'ESLINT_USE_FLAT_CONFIG=false eslint ../../packages/twenty-front --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs',
};
}

View file

@ -4,7 +4,7 @@ type DeepPartial<T> = {
: DeepPartial<T[K]>;
};
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
type ExcludeFunctions<T> = T extends Function ? never : T;
/**

View file

@ -14,7 +14,9 @@ export const performQuery = async <T = unknown>(
try {
const result = await rawDataSource.query<T>(query);
withLog && console.log(`Performed '${consoleDescription}' successfully`);
if (withLog) {
console.log(`Performed '${consoleDescription}' successfully`);
}
return result;
} catch (err) {
@ -25,6 +27,8 @@ export const performQuery = async <T = unknown>(
} else {
message = `Failed to perform '${consoleDescription}': ${err}`;
}
withLog && console.error(message);
if (withLog) {
console.error(message);
}
}
};

View file

@ -32,7 +32,7 @@ export function WorkspaceQueryHook(
options.type = WorkspaceQueryHookType.PRE_HOOK;
}
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
return (target: Function) => {
SetMetadata(SCOPE_OPTIONS_METADATA, options)(target);
SetMetadata(WORKSPACE_QUERY_HOOK_METADATA, options)(target);

View file

@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
import { Injectable, type Type } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
import { WORKSPACE_QUERY_HOOK_METADATA } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/workspace-query-hook.constants';
import { type WorkspaceQueryHookOptions } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator';
import { WORKSPACE_QUERY_HOOK_METADATA } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/workspace-query-hook.constants';
@Injectable()
export class WorkspaceQueryHookMetadataAccessor {

View file

@ -37,7 +37,7 @@ export function Processor(
? queueNameOrOptions
: { queueName: queueNameOrOptions };
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
return (target: Function) => {
SetMetadata(SCOPE_OPTIONS_METADATA, options)(target);
SetMetadata(PROCESSOR_METADATA, options)(target);

View file

@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
import { Injectable, type Type } from '@nestjs/common';
import { Reflector } from '@nestjs/core';

View file

@ -243,7 +243,7 @@ describe('WorkspaceService', () => {
await service.deleteWorkspace(mockWorkspace.id, true);
expect(billingSubscriptionService.deleteSubscriptions).toHaveBeenCalled;
expect(billingSubscriptionService.deleteSubscriptions).toHaveBeenCalled();
expect(workspaceRepository.softDelete).toHaveBeenCalledWith({
id: mockWorkspace.id,

View file

@ -250,7 +250,7 @@ export class FieldMetadataServiceV2 {
flatFieldMetadata: flatFieldMetadataToCreate,
flatObjectMetadataMaps: optimisticFlatObjectMetadataMaps,
});
} catch (e) {
} catch {
throw new FieldMetadataException(
'Optimistic cache manipulation failed, should never occur',
FieldMetadataExceptionCode.INTERNAL_SERVER_ERROR,

View file

@ -9,7 +9,7 @@ export const addFlatFieldMetadataInFlatObjectMetadataMaps = (
): FlatObjectMetadataMaps | undefined => {
try {
return addFlatFieldMetadataInFlatObjectMetadataMapsOrThrow(arg);
} catch (e) {
} catch {
return undefined;
}
};

View file

@ -1,7 +1,8 @@
import { type FactoryProvider, type ModuleMetadata } from '@nestjs/common';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface TwentyORMOptions {}
export interface TwentyORMOptions {
[key: string]: unknown;
}
export type TwentyORMModuleAsyncOptions = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any

View file

@ -44,7 +44,7 @@ export interface WorkspaceDynamicRelationMetadataArgs {
/**
* Class to which relation is applied.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
readonly target: Function;
/**

View file

@ -13,7 +13,7 @@ export interface WorkspaceEntityMetadataArgs {
* Function target is a table defined in the class.
* String target is a table defined in a json schema.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
readonly target: Function;
/**

View file

@ -6,7 +6,7 @@ export interface WorkspaceExtendedEntityMetadataArgs {
* Function target is a table defined in the class.
* String target is a table defined in a json schema.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
readonly target: Function;
/**

View file

@ -16,7 +16,7 @@ export interface WorkspaceFieldMetadataArgs {
/**
* Class to which field is applied.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
readonly target: Function;
/**

View file

@ -6,7 +6,7 @@ export interface WorkspaceIndexMetadataArgs {
/**
* Class to which index is applied.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
readonly target: Function;
/*

View file

@ -2,7 +2,7 @@ export interface WorkspaceJoinColumnsMetadataArgs {
/**
* Class to which relation is applied.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
readonly target: Function;
/**

View file

@ -15,7 +15,7 @@ export interface WorkspaceRelationMetadataArgs {
/**
* Class to which relation is applied.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
readonly target: Function;
/**

View file

@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
import { type WorkspaceDynamicRelationMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-dynamic-relation-metadata-args.interface';
import { type WorkspaceEntityMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-entity-metadata-args.interface';

View file

@ -31,9 +31,7 @@ export const companiesAllView = (
fieldMetadataId:
companyObjectMetadata.fields.find(
(field) => field.standardId === COMPANY_STANDARD_FIELD_IDS.name,
)?.id ??
'' ??
'',
)?.id ?? '',
position: 0,
isVisible: true,
size: 180,
@ -43,9 +41,7 @@ export const companiesAllView = (
companyObjectMetadata.fields.find(
(field) =>
field.standardId === COMPANY_STANDARD_FIELD_IDS.domainName,
)?.id ??
'' ??
'',
)?.id ?? '',
position: 1,
isVisible: true,
size: 100,

View file

@ -462,9 +462,11 @@ describe('SearchResolver', () => {
const edges = search.edges;
const pageInfo = search.pageInfo;
context.eval.orderedRecordIds.length > 0
? expect(edges).not.toHaveLength(0)
: expect(edges).toHaveLength(0);
if (context.eval.orderedRecordIds.length > 0) {
expect(edges).not.toHaveLength(0);
} else {
expect(edges).toHaveLength(0);
}
expect(
edges.map((edge: SearchResultEdgeDTO) => edge.node.recordId),

View file

@ -43,7 +43,7 @@ class TestClass {
name!: string;
}
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
// eslint-disable-next-line unused-imports/no-unused-vars
type BasicTests = [
Expect<Equal<string, string>>,
Expect<Equal<number, number>>,

View file

@ -1,5 +1,6 @@
import { type ThemeType } from './theme';
declare module '@emotion/react' {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface Theme extends ThemeType {}
}

View file

@ -6,7 +6,7 @@
"dev": "npx next dev",
"build": "npx next build",
"start": "npx next start",
"lint": "npx next lint",
"lint": "ESLINT_USE_FLAT_CONFIG=false npx next lint",
"github:sync": "npx tsx src/github/github-sync.ts",
"github:init": "npx tsx src/github/github-sync.ts --isFullSync",
"database:migrate": "npx tsx src/database/migrate-database.ts",

View file

@ -1,4 +1,4 @@
import { ESLintUtils, TSESTree } from '@typescript-eslint/experimental-utils';
import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
import ts from 'typescript';
export const RULE_NAME = 'explicit-boolean-predicates-in-if';
@ -14,7 +14,6 @@ export const rule = ESLintUtils.RuleCreator(() => __filename)({
type: 'suggestion',
docs: {
description: 'Enforce explicit boolean predicates in if statements',
recommended: 'warn',
},
fixable: 'code',
schema: [],
@ -25,12 +24,12 @@ export const rule = ESLintUtils.RuleCreator(() => __filename)({
},
defaultOptions: [],
create: (context) => {
const parserServices = ESLintUtils.getParserServices(context);
const typeChecker = parserServices.program.getTypeChecker();
const services = ESLintUtils.getParserServices(context);
const typeChecker = services.program.getTypeChecker();
return {
IfStatement: (node: TSESTree.IfStatement) => {
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node.test);
const tsNode = services.esTreeNodeToTSNodeMap.get(node.test);
const type = typeChecker.getTypeAtLocation(tsNode);
if (!isBooleanType(type)) {

1492
yarn.lock

File diff suppressed because it is too large Load diff