POC: chore: use Nx workspace lint rules (#3163)
* chore: use Nx workspace lint rules Closes #3162 * Fix lint * Fix lint on BE * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,16 +1,14 @@
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.stories.tsx', '*.test.ts'],
|
||||
rules: {
|
||||
'no-console': 'off',
|
||||
}
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
'./.eslintrc.cjs'
|
||||
],
|
||||
extends: ['./.eslintrc.cjs'],
|
||||
rules: {
|
||||
'no-console': 'error',
|
||||
}
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['.storybook/**/*', '**/*.stories.tsx', '**/*.test.ts'],
|
||||
rules: {
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@ -1,56 +1,26 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
root: true,
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
project: ['./tsconfig.json', './tsconfig.node.json'],
|
||||
tsconfigRootDir: __dirname,
|
||||
},
|
||||
extends: [
|
||||
'plugin:@nx/react',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:storybook/recommended',
|
||||
'../../.eslintrc.js',
|
||||
],
|
||||
plugins: ['react-hooks', 'react-refresh'],
|
||||
ignorePatterns: [
|
||||
'!**/*',
|
||||
'node_modules',
|
||||
'mockServiceWorker.js',
|
||||
'**/generated*/*',
|
||||
'*config.*',
|
||||
'**/*config.js',
|
||||
'codegen*',
|
||||
'tsup.ui.index.tsx',
|
||||
],
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'simple-import-sort/imports': 'error',
|
||||
'simple-import-sort/exports': 'error',
|
||||
'twenty/effect-components': 'error',
|
||||
'twenty/no-hardcoded-colors': 'error',
|
||||
'twenty/matching-state-variable': 'error',
|
||||
'twenty/component-props-naming': 'error',
|
||||
'twenty/sort-css-properties-alphabetically': 'error',
|
||||
'twenty/styled-components-prefixed-with-styled': 'error',
|
||||
'twenty/no-state-useref': 'error',
|
||||
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
||||
'no-unused-vars': 'off',
|
||||
'react/jsx-props-no-spreading': [
|
||||
'error',
|
||||
{
|
||||
explicitSpread: 'ignore',
|
||||
},
|
||||
],
|
||||
'react-hooks/exhaustive-deps': [
|
||||
'warn',
|
||||
{
|
||||
additionalHooks: 'useRecoilCallback',
|
||||
},
|
||||
],
|
||||
'unused-imports/no-unused-imports': 'warn',
|
||||
'unused-imports/no-unused-vars': [
|
||||
'warn',
|
||||
{
|
||||
vars: 'all',
|
||||
varsIgnorePattern: '^_',
|
||||
args: 'after-used',
|
||||
argsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
@ -67,87 +37,58 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/consistent-type-imports': [
|
||||
|
||||
'@nx/workspace-effect-components': 'error',
|
||||
'@nx/workspace-no-hardcoded-colors': 'error',
|
||||
'@nx/workspace-matching-state-variable': 'error',
|
||||
'@nx/workspace-sort-css-properties-alphabetically': 'error',
|
||||
'@nx/workspace-styled-components-prefixed-with-styled': 'error',
|
||||
'@nx/workspace-no-state-useref': 'error',
|
||||
'@nx/workspace-component-props-naming': 'error',
|
||||
|
||||
'react/no-unescaped-entities': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react/jsx-key': 'off',
|
||||
'react/display-name': 'off',
|
||||
'react/jsx-uses-react': 'off',
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/jsx-no-useless-fragment': 'off',
|
||||
'react/jsx-props-no-spreading': [
|
||||
'error',
|
||||
{ prefer: 'no-type-imports' },
|
||||
{
|
||||
explicitSpread: 'ignore',
|
||||
},
|
||||
],
|
||||
|
||||
'react-hooks/exhaustive-deps': [
|
||||
'warn',
|
||||
{
|
||||
additionalHooks: 'useRecoilCallback',
|
||||
},
|
||||
],
|
||||
'no-console': ['warn', { allow: ['group', 'groupCollapsed', 'groupEnd'] }],
|
||||
// 'react-refresh/only-export-components': [
|
||||
// 'warn',
|
||||
// { allowConstantExport: true },
|
||||
// ],
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
'plugin:storybook/recommended',
|
||||
],
|
||||
plugins: [
|
||||
'@typescript-eslint/eslint-plugin',
|
||||
'simple-import-sort',
|
||||
'unused-imports',
|
||||
'prefer-arrow',
|
||||
'twenty',
|
||||
'react-refresh',
|
||||
],
|
||||
ignorePatterns: [
|
||||
'mockServiceWorker.js',
|
||||
'**/generated*/*',
|
||||
'.eslintrc.cjs',
|
||||
'*.config.cjs',
|
||||
'*.config.ts',
|
||||
'*config.js',
|
||||
'codegen*',
|
||||
'tsup.ui.index.tsx'
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.stories.tsx', '*.test.ts'],
|
||||
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
||||
parserOptions: {
|
||||
project: ['packages/twenty-front/tsconfig.*?.json'],
|
||||
},
|
||||
rules: {},
|
||||
},
|
||||
{
|
||||
files: ['.storybook/main.@(js|cjs|mjs|ts)'],
|
||||
rules: {
|
||||
'storybook/no-uninstalled-addons': [
|
||||
'error',
|
||||
{ packageJsonLocation: path.resolve('../../package.json') },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['.storybook/**/*', '**/*.stories.tsx', '**/*.test.@(ts|tsx)'],
|
||||
rules: {
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
|
||||
rules: {
|
||||
'react/no-unescaped-entities': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react/jsx-key': 'off',
|
||||
'react/display-name': 'off',
|
||||
'react/jsx-uses-react': 'off',
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'no-control-regex': 0,
|
||||
'no-undef': 'off',
|
||||
'simple-import-sort/imports': [
|
||||
'error',
|
||||
{
|
||||
groups: [
|
||||
['^react', '^@?\\w'],
|
||||
['^(@|~)(/.*|$)'],
|
||||
['^\\u0000'],
|
||||
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
|
||||
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
|
||||
['^.+\\.?(css)$'],
|
||||
],
|
||||
},
|
||||
],
|
||||
'prefer-arrow/prefer-arrow-functions': [
|
||||
'error',
|
||||
{
|
||||
disallowPrototype: true,
|
||||
singleReturnOnly: false,
|
||||
classPropertiesAllowed: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
**/generated*/
|
||||
*.lock
|
||||
*.yaml
|
||||
@ -1,5 +0,0 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import type { StorybookConfig } from '@storybook/react-vite';
|
||||
import { StorybookConfig } from '@storybook/react-vite';
|
||||
|
||||
const computeStoriesGlob = () => {
|
||||
if (process.env.STORYBOOK_SCOPE === 'pages') {
|
||||
@ -6,19 +6,22 @@ const computeStoriesGlob = () => {
|
||||
'../src/pages/**/*.stories.@(js|jsx|ts|tsx)',
|
||||
'../src/__stories__/*.stories.@(js|jsx|ts|tsx)',
|
||||
'../src/pages/**/*.docs.mdx',
|
||||
'../src/__stories__/*.docs.mdx'
|
||||
]
|
||||
'../src/__stories__/*.docs.mdx',
|
||||
];
|
||||
}
|
||||
|
||||
if (process.env.STORYBOOK_SCOPE === 'modules') {
|
||||
return ['../src/modules/**/*.stories.@(js|jsx|ts|tsx)', '../src/modules/**/*.docs.mdx']
|
||||
return [
|
||||
'../src/modules/**/*.stories.@(js|jsx|ts|tsx)',
|
||||
'../src/modules/**/*.docs.mdx',
|
||||
];
|
||||
}
|
||||
|
||||
if (process.env.STORYBOOK_SCOPE === 'ui-docs') {
|
||||
return ['../src/modules/ui/**/*.docs.mdx'];
|
||||
return ['../src/modules/ui/**/*.docs.mdx'];
|
||||
}
|
||||
|
||||
return ['../src/**/*.docs.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)']
|
||||
return ['../src/**/*.docs.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'];
|
||||
};
|
||||
|
||||
const config: StorybookConfig = {
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
import { ThemeProvider } from '@emotion/react';
|
||||
import { withThemeFromJSXProvider } from '@storybook/addon-themes';
|
||||
import { Preview, ReactRenderer } from '@storybook/react';
|
||||
import { withThemeFromJSXProvider } from "@storybook/addon-themes";
|
||||
import { initialize, mswDecorator } from 'msw-storybook-addon';
|
||||
|
||||
import { darkTheme, lightTheme } from '../src/modules/ui/theme/constants/theme';
|
||||
import { RootDecorator } from '../src/testing/decorators/RootDecorator';
|
||||
import { mockedUserJWT } from '../src/testing/mock-data/jwt';
|
||||
|
||||
import { lightTheme, darkTheme } from '../src/modules/ui/theme/constants/theme';
|
||||
import 'react-loading-skeleton/dist/skeleton.css';
|
||||
|
||||
initialize({
|
||||
onUnhandledRequest: async (request: Request) => {
|
||||
const fileExtensionsToIgnore = /\.(ts|tsx|js|jsx|svg|css|png)(\?v=[a-zA-Z0-9]+)?/;
|
||||
const fileExtensionsToIgnore =
|
||||
/\.(ts|tsx|js|jsx|svg|css|png)(\?v=[a-zA-Z0-9]+)?/;
|
||||
|
||||
if (fileExtensionsToIgnore.test(request.url)) {
|
||||
return;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { getJestConfig } from "@storybook/test-runner";
|
||||
import { getJestConfig } from '@storybook/test-runner';
|
||||
|
||||
/**
|
||||
* @type {import('@jest/types').Config.InitialOptions}
|
||||
@ -10,4 +10,4 @@ export default {
|
||||
* @see https://jestjs.io/docs/configuration
|
||||
*/
|
||||
testTimeout: process.env.STORYBOOK_SCOPE === 'pages' ? 60000 : 15000,
|
||||
};
|
||||
};
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
"tsc": "tsc --watch",
|
||||
"tsc:ci": "tsc",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"lint:ci": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --config .eslintrc-ci.cjs",
|
||||
"lint": "eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs",
|
||||
"lint:ci": "yarn lint --config .eslintrc-ci.cjs",
|
||||
"fmt:fix": "prettier --cache --write \"src/**/*.ts\" \"src/**/*.tsx\"",
|
||||
"fmt": "prettier --check \"src/**/*.ts\" \"src/**/*.tsx\"",
|
||||
"test": "jest",
|
||||
@ -49,7 +49,6 @@
|
||||
"@hookform/resolvers": "^3.1.1",
|
||||
"@sentry/react": "^7.88.0",
|
||||
"@sniptt/guards": "^0.2.0",
|
||||
"@swc/core": "^1.3.100",
|
||||
"@swc/jest": "^0.2.29",
|
||||
"@tabler/icons-react": "^2.30.0",
|
||||
"afterframe": "^1.0.2",
|
||||
@ -69,7 +68,6 @@
|
||||
"lodash.kebabcase": "^4.1.1",
|
||||
"lodash.snakecase": "^4.1.1",
|
||||
"luxon": "^3.3.0",
|
||||
"nx": "17.2.3",
|
||||
"react": "^18.2.0",
|
||||
"react-data-grid": "7.0.0-beta.13",
|
||||
"react-datepicker": "^4.11.0",
|
||||
@ -96,72 +94,6 @@
|
||||
"xlsx-ugnis": "^0.19.3",
|
||||
"zod": "^3.22.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "^3.3.1",
|
||||
"@graphql-codegen/client-preset": "^4.1.0",
|
||||
"@graphql-codegen/typescript": "^3.0.4",
|
||||
"@graphql-codegen/typescript-operations": "^3.0.4",
|
||||
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
|
||||
"@storybook/addon-actions": "^7.6.3",
|
||||
"@storybook/addon-coverage": "^1.0.0",
|
||||
"@storybook/addon-essentials": "^7.6.3",
|
||||
"@storybook/addon-interactions": "^7.6.3",
|
||||
"@storybook/addon-links": "^7.6.3",
|
||||
"@storybook/addon-onboarding": "^1.0.9",
|
||||
"@storybook/addon-themes": "^7.6.3",
|
||||
"@storybook/blocks": "^7.6.3",
|
||||
"@storybook/react": "^7.6.3",
|
||||
"@storybook/react-vite": "^7.6.3",
|
||||
"@storybook/test": "^7.6.3",
|
||||
"@storybook/test-runner": "^0.16.0",
|
||||
"@testing-library/jest-dom": "^6.1.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@types/apollo-upload-client": "^17.0.2",
|
||||
"@types/deep-equal": "^1.0.1",
|
||||
"@types/jest": "^29.5.10",
|
||||
"@types/js-cookie": "^3.0.3",
|
||||
"@types/lodash.camelcase": "^4.3.7",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
"@types/lodash.kebabcase": "^4.1.7",
|
||||
"@types/lodash.snakecase": "^4.1.9",
|
||||
"@types/luxon": "^3.3.0",
|
||||
"@types/node": "^20.10.0",
|
||||
"@types/react": "^18.2.39",
|
||||
"@types/react-datepicker": "^4.11.2",
|
||||
"@types/react-dom": "^18.2.15",
|
||||
"@types/scroll-into-view": "^1.16.0",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
||||
"@typescript-eslint/parser": "^6.10.0",
|
||||
"@vitejs/plugin-react-swc": "^3.5.0",
|
||||
"chromatic": "^6.18.0",
|
||||
"concurrently": "^8.0.1",
|
||||
"cross-var": "^1.1.0",
|
||||
"dotenv-cli": "^7.2.1",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-prefer-arrow": "^1.2.3",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.4",
|
||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||
"eslint-plugin-storybook": "^0.6.15",
|
||||
"eslint-plugin-twenty": "file:../eslint-plugin-twenty/eslint-plugin-twenty.tgz",
|
||||
"eslint-plugin-unused-imports": "^3.0.0",
|
||||
"http-server": "^14.1.1",
|
||||
"jest": "29.7.0",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"msw": "^2.0.11",
|
||||
"msw-storybook-addon": "2.0.0--canary.122.b3ed3b1.0",
|
||||
"prettier": "^3.1.0",
|
||||
"storybook": "^7.6.3",
|
||||
"storybook-addon-cookie": "^3.1.0",
|
||||
"storybook-addon-pseudo-states": "^2.1.2",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.0.0",
|
||||
"vite-plugin-svgr": "^4.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.16.0",
|
||||
"npm": "please-use-yarn",
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
window._env_ = {
|
||||
// This file should stay empty. It will be overwritten by the build process.
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useRef } from 'react';
|
||||
|
||||
export const useFirstMountState = (): boolean => {
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const isFirst = useRef(true);
|
||||
|
||||
if (isFirst.current) {
|
||||
|
||||
@ -55,7 +55,7 @@ export const ActivityBodyEditor = ({
|
||||
const imagesActivated = useIsFeatureEnabled('IS_NOTE_CREATE_IMAGES_ENABLED');
|
||||
|
||||
if (!imagesActivated) {
|
||||
slashMenuItems = slashMenuItems.filter((x) => x.name != 'Image');
|
||||
slashMenuItems = slashMenuItems.filter((x) => x.name !== 'Image');
|
||||
}
|
||||
|
||||
const [uploadFile] = useUploadFileMutation();
|
||||
|
||||
@ -102,8 +102,8 @@ export const Attachments = ({
|
||||
fullPath: attachmentUrl,
|
||||
type: getFileType(file.name),
|
||||
companyId:
|
||||
targetableEntity.type == 'Company' ? targetableEntity.id : null,
|
||||
personId: targetableEntity.type == 'Person' ? targetableEntity.id : null,
|
||||
targetableEntity.type === 'Company' ? targetableEntity.id : null,
|
||||
personId: targetableEntity.type === 'Person' ? targetableEntity.id : null,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ export const useHandleCheckableActivityTargetChange = ({
|
||||
.map(([id, _]) => id);
|
||||
|
||||
if (idsToAdd.length) {
|
||||
idsToAdd.map((id) => {
|
||||
idsToAdd.forEach((id) => {
|
||||
const entityFromToSelect = entitiesToSelect.filter(
|
||||
(entity: any) => entity.id === id,
|
||||
).length
|
||||
@ -65,7 +65,7 @@ export const useHandleCheckableActivityTargetChange = ({
|
||||
}
|
||||
|
||||
if (idsToDelete.length) {
|
||||
idsToDelete.map((id) => {
|
||||
idsToDelete.forEach((id) => {
|
||||
const currentActivityTargetId = currentActivityTargets.filter(
|
||||
({ companyId, personId }) => companyId === id || personId === id,
|
||||
)[0].id;
|
||||
|
||||
@ -62,7 +62,7 @@ export const NoteList = ({ title, notes, button }: NoteListProps) => (
|
||||
<NoteCard
|
||||
key={note.id}
|
||||
note={note}
|
||||
isSingleNote={notes.length == 1}
|
||||
isSingleNote={notes.length === 1}
|
||||
/>
|
||||
))}
|
||||
</StyledNoteContainer>
|
||||
|
||||
@ -13,7 +13,7 @@ import { useUpdateEffect } from '~/hooks/useUpdateEffect';
|
||||
import { ApolloFactory } from '../services/apollo.factory';
|
||||
|
||||
export const useApolloFactory = () => {
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const apolloRef = useRef<ApolloFactory<NormalizedCacheObject> | null>(null);
|
||||
const [isDebugMode] = useRecoilState(isDebugModeState);
|
||||
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import { OperationType } from '../types/operation-type';
|
||||
|
||||
const operationTypeColors = {
|
||||
// eslint-disable-next-line twenty/no-hardcoded-colors
|
||||
// eslint-disable-next-line @nx/workspace-no-hardcoded-colors
|
||||
query: '#03A9F4',
|
||||
// eslint-disable-next-line twenty/no-hardcoded-colors
|
||||
// eslint-disable-next-line @nx/workspace-no-hardcoded-colors
|
||||
mutation: '#61A600',
|
||||
// eslint-disable-next-line twenty/no-hardcoded-colors
|
||||
// eslint-disable-next-line @nx/workspace-no-hardcoded-colors
|
||||
subscription: '#61A600',
|
||||
// eslint-disable-next-line twenty/no-hardcoded-colors
|
||||
// eslint-disable-next-line @nx/workspace-no-hardcoded-colors
|
||||
error: '#F51818',
|
||||
// eslint-disable-next-line twenty/no-hardcoded-colors
|
||||
// eslint-disable-next-line @nx/workspace-no-hardcoded-colors
|
||||
default: '#61A600',
|
||||
};
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ export const loggerLink = (getSchemaName: (operation: Operation) => string) =>
|
||||
errors.forEach((err: any) => {
|
||||
logDebug(
|
||||
`%c${err.message}`,
|
||||
// eslint-disable-next-line twenty/no-hardcoded-colors
|
||||
// eslint-disable-next-line @nx/workspace-no-hardcoded-colors
|
||||
'color: #F51818; font-weight: lighter',
|
||||
);
|
||||
});
|
||||
|
||||
@ -157,6 +157,7 @@ export const useAuth = () => {
|
||||
set(supportChatState, supportChat);
|
||||
set(telemetryState, telemetry);
|
||||
set(isDebugModeState, isDebugMode);
|
||||
return undefined;
|
||||
});
|
||||
|
||||
goToRecoilSnapshot(initialSnapshot);
|
||||
|
||||
@ -44,7 +44,7 @@ export const ObjectMetadataNavItems = () => {
|
||||
key={objectMetadataItem.id}
|
||||
label={objectMetadataItem.labelPlural}
|
||||
to={`/objects/${objectMetadataItem.namePlural}`}
|
||||
active={currentPath == `/objects/${objectMetadataItem.namePlural}`}
|
||||
active={currentPath === `/objects/${objectMetadataItem.namePlural}`}
|
||||
Icon={getIcon(objectMetadataItem.icon)}
|
||||
onClick={() => {
|
||||
navigate(`/objects/${objectMetadataItem.namePlural}`);
|
||||
|
||||
@ -36,7 +36,7 @@ const StyledIconTableCell = styled(TableCell)`
|
||||
|
||||
export const SettingsObjectFieldItemTableRow = ({
|
||||
ActionIcon,
|
||||
fieldMetadataItem: fieldMetadataItem,
|
||||
fieldMetadataItem,
|
||||
}: SettingsObjectFieldItemTableRowProps) => {
|
||||
const theme = useTheme();
|
||||
const { getIcon } = useIcons();
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { ModalWrapper } from '@/spreadsheet-import/components/ModalWrapper';
|
||||
import { Providers } from '@/spreadsheet-import/components/Providers';
|
||||
import { Steps } from '@/spreadsheet-import/steps/components/Steps';
|
||||
import { SpreadsheetOptions } from '@/spreadsheet-import/types';
|
||||
import { SpreadsheetOptions as SpreadsheetImportProps } from '@/spreadsheet-import/types';
|
||||
|
||||
export const defaultSpreadsheetImportProps: Partial<SpreadsheetOptions<any>> = {
|
||||
export const defaultSpreadsheetImportProps: Partial<
|
||||
SpreadsheetImportProps<any>
|
||||
> = {
|
||||
autoMapHeaders: true,
|
||||
allowInvalidSubmit: true,
|
||||
autoMapDistance: 2,
|
||||
@ -17,8 +19,7 @@ export const defaultSpreadsheetImportProps: Partial<SpreadsheetOptions<any>> = {
|
||||
} as const;
|
||||
|
||||
export const SpreadsheetImport = <T extends string>(
|
||||
// eslint-disable-next-line twenty/component-props-naming
|
||||
props: SpreadsheetOptions<T>,
|
||||
props: SpreadsheetImportProps<T>,
|
||||
) => {
|
||||
return (
|
||||
<Providers values={props}>
|
||||
|
||||
@ -56,9 +56,9 @@ export const ProgressBar = forwardRef<ProgressBarControls, ProgressBarProps>(
|
||||
const theme = useTheme();
|
||||
|
||||
const controls = useAnimation();
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const startTimestamp = useRef<number>(0);
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const remainingTime = useRef<number>(duration);
|
||||
|
||||
const start = useCallback(async () => {
|
||||
|
||||
@ -118,7 +118,7 @@ export const SnackBar = ({
|
||||
}: SnackBarProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const progressBarRef = useRef<ProgressBarControls | null>(null);
|
||||
|
||||
const closeSnackbar = useCallback(() => {
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
|
||||
export const usePausableTimeout = (callback: () => void, delay: number) => {
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const savedCallback = useRef<() => void>(callback);
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const remainingTime = useRef<number>(delay);
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const startTime = useRef<number>(Date.now());
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const timeoutId = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const tick = () => {
|
||||
|
||||
@ -131,7 +131,7 @@ const TextInputComponent = (
|
||||
tabIndex,
|
||||
RightIcon,
|
||||
}: TextInputComponentProps,
|
||||
// eslint-disable-next-line twenty/component-props-naming
|
||||
// eslint-disable-next-line @nx/workspace-component-props-naming
|
||||
ref: ForwardedRef<HTMLInputElement>,
|
||||
): JSX.Element => {
|
||||
const theme = useTheme();
|
||||
|
||||
@ -23,7 +23,7 @@ const StyledEditor = styled.div`
|
||||
|
||||
export const BlockEditor = ({ editor }: BlockEditorProps) => {
|
||||
const theme = useTheme();
|
||||
const blockNoteTheme = theme.name == 'light' ? 'light' : 'dark';
|
||||
const blockNoteTheme = theme.name === 'light' ? 'light' : 'dark';
|
||||
return (
|
||||
<StyledEditor>
|
||||
<BlockNoteView editor={editor} theme={blockNoteTheme} />
|
||||
|
||||
@ -30,7 +30,7 @@ export const ShowPageMoreButton = ({
|
||||
const navigationMemorizedUrl = useRecoilValue(navigationMemorizedUrlState);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { deleteOneRecord: deleteOneRecord } = useDeleteOneRecord({
|
||||
const { deleteOneRecord } = useDeleteOneRecord({
|
||||
objectNameSingular,
|
||||
});
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* eslint-disable twenty/no-hardcoded-colors */
|
||||
/* eslint-disable @nx/workspace-no-hardcoded-colors */
|
||||
import DarkNoise from '../assets/dark-noise.jpg';
|
||||
import LightNoise from '../assets/light-noise.png';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* eslint-disable twenty/no-hardcoded-colors */
|
||||
/* eslint-disable @nx/workspace-no-hardcoded-colors */
|
||||
import hexRgb from 'hex-rgb';
|
||||
|
||||
export const grayScale = {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* eslint-disable twenty/no-hardcoded-colors */
|
||||
/* eslint-disable @nx/workspace-no-hardcoded-colors */
|
||||
import { accentDark, accentLight } from './accent';
|
||||
import { animation } from './animation';
|
||||
import { backgroundDark, backgroundLight } from './background';
|
||||
|
||||
@ -18,7 +18,7 @@ export const RecoilScope = ({
|
||||
scopeId?: string;
|
||||
CustomRecoilScopeContext?: RecoilScopeContextType;
|
||||
}) => {
|
||||
// eslint-disable-next-line twenty/no-state-useref
|
||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||
const currentScopeId = useRef(scopeId ?? v4());
|
||||
|
||||
return CustomRecoilScopeContext ? (
|
||||
|
||||
@ -28,8 +28,8 @@ export const getViewScopedStatesFromSnapshot = ({
|
||||
availableFieldDefinitionsState,
|
||||
availableFilterDefinitionsState,
|
||||
availableSortDefinitionsState,
|
||||
canPersistFiltersSelector: canPersistFiltersSelector,
|
||||
canPersistSortsSelector: canPersistSortsSelector,
|
||||
canPersistFiltersSelector,
|
||||
canPersistSortsSelector,
|
||||
currentViewFieldsState,
|
||||
currentViewFiltersState,
|
||||
currentViewIdState,
|
||||
@ -41,11 +41,11 @@ export const getViewScopedStatesFromSnapshot = ({
|
||||
onViewFieldsChangeState,
|
||||
onViewFiltersChangeState,
|
||||
onViewSortsChangeState,
|
||||
savedViewFieldsByKeySelector: savedViewFieldsByKeySelector,
|
||||
savedViewFieldsByKeySelector,
|
||||
savedViewFieldsState,
|
||||
savedViewFiltersByKeySelector: savedViewFiltersByKeySelector,
|
||||
savedViewFiltersByKeySelector,
|
||||
savedViewFiltersState,
|
||||
savedViewSortsByKeySelector: savedViewSortsByKeySelector,
|
||||
savedViewSortsByKeySelector,
|
||||
savedViewSortsState,
|
||||
viewEditModeState,
|
||||
viewObjectMetadataIdState,
|
||||
|
||||
@ -87,7 +87,7 @@ export const SettingsObjectNewFieldStep1 = () => {
|
||||
metadataField.isActive ===
|
||||
activeObjectMetadataItem.fields[index].isActive
|
||||
) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return metadataField.isActive
|
||||
|
||||
14
packages/twenty-front/tsconfig.app.json
Normal file
14
packages/twenty-front/tsconfig.app.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc"
|
||||
},
|
||||
"exclude": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.test.ts",
|
||||
"**/*.spec.tsx",
|
||||
"**/*.test.tsx",
|
||||
"jest.config.ts"
|
||||
],
|
||||
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
||||
}
|
||||
@ -29,6 +29,17 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
16
packages/twenty-front/tsconfig.spec.json
Normal file
16
packages/twenty-front/tsconfig.spec.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": [
|
||||
"jest.config.ts",
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts",
|
||||
".storybook/**/*",
|
||||
"**/*.stories.tsx"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user