mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-18 00:52:21 +03:00
bb7d94a455
### Description Create ESLint rule to discourage usage of navigate() and prefer Link ### Refs #5468 ### Demo ![Capture-2024-05-29-112852](https://github.com/twentyhq/twenty/assets/140154534/28378c09-86bb-49d3-9e9a-49aa1c07ad11) ![Capture-2024-05-29-112843](https://github.com/twentyhq/twenty/assets/140154534/2c05ea92-e19b-49ae-acb9-07f6ec9182ab) Fixes #5468 --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
93 lines
2.9 KiB
TypeScript
93 lines
2.9 KiB
TypeScript
import {
|
|
rule as componentPropsNaming,
|
|
RULE_NAME as componentPropsNamingName,
|
|
} from './rules/component-props-naming';
|
|
import {
|
|
rule as effectComponents,
|
|
RULE_NAME as effectComponentsName,
|
|
} from './rules/effect-components';
|
|
import {
|
|
rule as explicitBooleanPredicatesInIf,
|
|
RULE_NAME as explicitBooleanPredicatesInIfName,
|
|
} from './rules/explicit-boolean-predicates-in-if';
|
|
import {
|
|
rule as matchingStateVariable,
|
|
RULE_NAME as matchingStateVariableName,
|
|
} from './rules/matching-state-variable';
|
|
import {
|
|
rule as maxConstsPerFile,
|
|
RULE_NAME as maxConstsPerFileName,
|
|
} from './rules/max-consts-per-file';
|
|
import {
|
|
rule as noHardcodedColors,
|
|
RULE_NAME as noHardcodedColorsName,
|
|
} from './rules/no-hardcoded-colors';
|
|
import {
|
|
rule as noNavigatePreferLink,
|
|
RULE_NAME as noNavigatePreferLinkName,
|
|
} from './rules/no-navigate-prefer-link';
|
|
import {
|
|
rule as noStateUseref,
|
|
RULE_NAME as noStateUserefName,
|
|
} from './rules/no-state-useref';
|
|
import {
|
|
rule as sortCssPropertiesAlphabetically,
|
|
RULE_NAME as sortCssPropertiesAlphabeticallyName,
|
|
} from './rules/sort-css-properties-alphabetically';
|
|
import {
|
|
rule as styledComponentsPrefixedWithStyled,
|
|
RULE_NAME as styledComponentsPrefixedWithStyledName,
|
|
} from './rules/styled-components-prefixed-with-styled';
|
|
import {
|
|
rule as useGetLoadableAndGetValueToGetAtoms,
|
|
RULE_NAME as useGetLoadableAndGetValueToGetAtomsName,
|
|
} from './rules/use-getLoadable-and-getValue-to-get-atoms';
|
|
import {
|
|
rule as useRecoilCallbackHasDependencyArray,
|
|
RULE_NAME as useRecoilCallbackHasDependencyArrayName,
|
|
} from './rules/useRecoilCallback-has-dependency-array';
|
|
|
|
/**
|
|
* Import your custom workspace rules at the top of this file.
|
|
*
|
|
* For example:
|
|
*
|
|
* import { RULE_NAME as myCustomRuleName, rule as myCustomRule } from './rules/my-custom-rule';
|
|
*
|
|
* In order to quickly get started with writing rules you can use the
|
|
* following generator command and provide your desired rule name:
|
|
*
|
|
* ```sh
|
|
* npx nx g @nx/eslint:workspace-rule {{ NEW_RULE_NAME }}
|
|
* ```
|
|
*/
|
|
|
|
module.exports = {
|
|
/**
|
|
* Apply the imported custom rules here.
|
|
*
|
|
* For example (using the example import above):
|
|
*
|
|
* rules: {
|
|
* [myCustomRuleName]: myCustomRule
|
|
* }
|
|
*/
|
|
rules: {
|
|
[componentPropsNamingName]: componentPropsNaming,
|
|
[effectComponentsName]: effectComponents,
|
|
[matchingStateVariableName]: matchingStateVariable,
|
|
[noHardcodedColorsName]: noHardcodedColors,
|
|
[noStateUserefName]: noStateUseref,
|
|
[sortCssPropertiesAlphabeticallyName]: sortCssPropertiesAlphabetically,
|
|
[styledComponentsPrefixedWithStyledName]:
|
|
styledComponentsPrefixedWithStyled,
|
|
[explicitBooleanPredicatesInIfName]: explicitBooleanPredicatesInIf,
|
|
[useGetLoadableAndGetValueToGetAtomsName]:
|
|
useGetLoadableAndGetValueToGetAtoms,
|
|
[maxConstsPerFileName]: maxConstsPerFile,
|
|
[useRecoilCallbackHasDependencyArrayName]:
|
|
useRecoilCallbackHasDependencyArray,
|
|
[noNavigatePreferLinkName]: noNavigatePreferLink,
|
|
},
|
|
};
|