Skip to content

Conversation

@gitstart-twenty
Copy link
Contributor

Fixes #1996

… elements

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
@sweep-ai-deprecated
Copy link
Contributor

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was quick! Left a comment :)

@@ -0,0 +1,39 @@
"use strict";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not commit dist file.
Let's actually add dist folder to gitignore

Copy link
Contributor Author

@gitstart-twenty gitstart-twenty Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charlesBochet dist in eslint-plugin-twenty is ignored, but eslint-plugin-twenty-ts was added and I figured, perhaps it serves a special purpose, hence the commits and updates

'plugin:prettier/recommended',
'plugin:storybook/recommended',
'react-app',
'plugin:react/recommended',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving to these plugins as the react-app config is not compatible with the newer eslint version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

{
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
rules: {
'react/no-unescaped-entities': 'off',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disabling these as the new plugin is stricter. I think it would be great to reactivate jsx-key one, others do not seem that useful (I'm not sure about prop-types)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

"chromatic": "dotenv cross-var npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN",
"install": "yarn eslint-plugin:setup"
},
"eslintConfig": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this section as we use .eslintrc


const noStateUseRef = createRule({
create: (context) => {
return {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gitstart-twenty we prefer this way of writing if condition that avoids making a complex conditions and enforce runtime typing properly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

],
},
{
code: "const ref = useRef<string>('');",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added this case that was not taken into account

return;
}

if (!node.typeArguments || !node.typeArguments.params?.length) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using typeArguments instead of typeParameters which is deprecated :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charlesBochet I saw this and made the necessary changes but then reverted them after I noticed the rule wasn't behaving as expected. This is because the AST generated by @typescript-eslint/parser uses typeParameters and not typeArguments

@charlesBochet
Copy link
Member

@gitstart-twenty I've left a few comments, please have a look for next times :)

@charlesBochet charlesBochet merged commit 0c79217 into main Oct 14, 2023
@charlesBochet charlesBochet deleted the TWNTY-1996 branch October 14, 2023 09:32
@gitstart-twenty
Copy link
Contributor Author

gitstart-twenty commented Oct 16, 2023

@gitstart-twenty I've left a few comments, please have a look for next times :)

Thanks for the update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an ESLint rule to prevent the usage of useRef other than for HTML elements.

3 participants