Skip to content
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

☂️ typescript-eslint #2180

Open
Tracked by #20279
Boshen opened this issue Jan 26, 2024 · 15 comments
Open
Tracked by #20279

☂️ typescript-eslint #2180

Boshen opened this issue Jan 26, 2024 · 15 comments

Comments

@Boshen
Copy link
Member

Boshen commented Jan 26, 2024

Warning

This comment is maintained by CI. Do not edit this comment directly.
To update comment template, see https://github.com/oxc-project/oxc/tree/main/tasks/lint_rules

This is tracking issue for @typescript-eslint/eslint-plugin.

There are 66(+ 6 deprecated) rules.

  • 4/40 recommended rules are remaining as TODO
  • 14/26 not recommended rules are remaining as TODO

To get started, run the following command:

just new-typescript-rule <RULE_NAME>

Then register the rule in crates/oxc_linter/src/rules.rs and also declare_all_lint_rules at the bottom.

Recommended rules

✨: 36, 🚫: 0 / total: 40
Status Name Docs
typescript/adjacent-overload-signatures https://typescript-eslint.io/rules/adjacent-overload-signatures
typescript/array-type https://typescript-eslint.io/rules/array-type
typescript/ban-tslint-comment https://typescript-eslint.io/rules/ban-tslint-comment
typescript/class-literal-property-style https://typescript-eslint.io/rules/class-literal-property-style
typescript/consistent-generic-constructors https://typescript-eslint.io/rules/consistent-generic-constructors
typescript/consistent-indexed-object-style https://typescript-eslint.io/rules/consistent-indexed-object-style
typescript/consistent-type-assertions https://typescript-eslint.io/rules/consistent-type-assertions
typescript/consistent-type-definitions https://typescript-eslint.io/rules/consistent-type-definitions
typescript/no-array-constructor https://typescript-eslint.io/rules/no-array-constructor
typescript/no-confusing-non-null-assertion https://typescript-eslint.io/rules/no-confusing-non-null-assertion
typescript/no-duplicate-enum-values https://typescript-eslint.io/rules/no-duplicate-enum-values
typescript/no-dynamic-delete https://typescript-eslint.io/rules/no-dynamic-delete
typescript/no-empty-function https://typescript-eslint.io/rules/no-empty-function
typescript/no-empty-object-type https://typescript-eslint.io/rules/no-empty-object-type
typescript/no-explicit-any https://typescript-eslint.io/rules/no-explicit-any
typescript/no-extra-non-null-assertion https://typescript-eslint.io/rules/no-extra-non-null-assertion
typescript/no-extraneous-class https://typescript-eslint.io/rules/no-extraneous-class
typescript/no-inferrable-types https://typescript-eslint.io/rules/no-inferrable-types
typescript/no-invalid-void-type https://typescript-eslint.io/rules/no-invalid-void-type
typescript/no-misused-new https://typescript-eslint.io/rules/no-misused-new
typescript/no-namespace https://typescript-eslint.io/rules/no-namespace
typescript/no-non-null-asserted-nullish-coalescing https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing
typescript/no-non-null-asserted-optional-chain https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
typescript/no-non-null-assertion https://typescript-eslint.io/rules/no-non-null-assertion
typescript/no-require-imports https://typescript-eslint.io/rules/no-require-imports
typescript/no-this-alias https://typescript-eslint.io/rules/no-this-alias
typescript/no-unnecessary-type-constraint https://typescript-eslint.io/rules/no-unnecessary-type-constraint
typescript/no-unsafe-declaration-merging https://typescript-eslint.io/rules/no-unsafe-declaration-merging
typescript/no-unsafe-function-type https://typescript-eslint.io/rules/no-unsafe-function-type
typescript/no-unused-expressions https://typescript-eslint.io/rules/no-unused-expressions
typescript/no-unused-vars https://typescript-eslint.io/rules/no-unused-vars
typescript/no-useless-constructor https://typescript-eslint.io/rules/no-useless-constructor
typescript/no-wrapper-object-types https://typescript-eslint.io/rules/no-wrapper-object-types
typescript/prefer-as-const https://typescript-eslint.io/rules/prefer-as-const
typescript/prefer-for-of https://typescript-eslint.io/rules/prefer-for-of
typescript/prefer-function-type https://typescript-eslint.io/rules/prefer-function-type
typescript/prefer-literal-enum-member https://typescript-eslint.io/rules/prefer-literal-enum-member
typescript/prefer-namespace-keyword https://typescript-eslint.io/rules/prefer-namespace-keyword
typescript/triple-slash-reference https://typescript-eslint.io/rules/triple-slash-reference
typescript/unified-signatures https://typescript-eslint.io/rules/unified-signatures

✨ = Implemented, 🚫 = No need to implement

Not recommended rules

✨: 12, 🚫: 0 / total: 26
Status Name Docs
typescript/ban-ts-comment https://typescript-eslint.io/rules/ban-ts-comment
typescript/class-methods-use-this https://typescript-eslint.io/rules/class-methods-use-this
typescript/consistent-type-imports https://typescript-eslint.io/rules/consistent-type-imports
typescript/default-param-last https://typescript-eslint.io/rules/default-param-last
typescript/explicit-function-return-type https://typescript-eslint.io/rules/explicit-function-return-type
typescript/explicit-member-accessibility https://typescript-eslint.io/rules/explicit-member-accessibility
typescript/explicit-module-boundary-types https://typescript-eslint.io/rules/explicit-module-boundary-types
typescript/init-declarations https://typescript-eslint.io/rules/init-declarations
typescript/max-params https://typescript-eslint.io/rules/max-params
typescript/member-ordering https://typescript-eslint.io/rules/member-ordering
typescript/method-signature-style https://typescript-eslint.io/rules/method-signature-style
typescript/no-dupe-class-members https://typescript-eslint.io/rules/no-dupe-class-members
typescript/no-import-type-side-effects https://typescript-eslint.io/rules/no-import-type-side-effects
typescript/no-invalid-this https://typescript-eslint.io/rules/no-invalid-this
typescript/no-loop-func https://typescript-eslint.io/rules/no-loop-func
typescript/no-magic-numbers https://typescript-eslint.io/rules/no-magic-numbers
typescript/no-redeclare https://typescript-eslint.io/rules/no-redeclare
typescript/no-restricted-imports https://typescript-eslint.io/rules/no-restricted-imports
typescript/no-restricted-types https://typescript-eslint.io/rules/no-restricted-types
typescript/no-shadow https://typescript-eslint.io/rules/no-shadow
typescript/no-unnecessary-parameter-property-assignment https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment
typescript/no-use-before-define https://typescript-eslint.io/rules/no-use-before-define
typescript/no-useless-empty-export https://typescript-eslint.io/rules/no-useless-empty-export
typescript/parameter-properties https://typescript-eslint.io/rules/parameter-properties
typescript/prefer-enum-initializers https://typescript-eslint.io/rules/prefer-enum-initializers
typescript/typedef https://typescript-eslint.io/rules/typedef

✨ = Implemented, 🚫 = No need to implement

Deprecated rules

✨: 4, 🚫: 0 / total: 6
Status Name Docs
typescript/no-empty-interface https://typescript-eslint.io/rules/no-empty-interface
typescript/no-loss-of-precision https://typescript-eslint.io/rules/no-loss-of-precision
typescript/no-type-alias https://typescript-eslint.io/rules/no-type-alias
typescript/no-var-requires https://typescript-eslint.io/rules/no-var-requires
typescript/prefer-ts-expect-error https://typescript-eslint.io/rules/prefer-ts-expect-error
typescript/sort-type-constituents https://typescript-eslint.io/rules/sort-type-constituents

✨ = Implemented, 🚫 = No need to implement

@alfaproject
Copy link

Will type checking rules be considered for implementation at any point in time?

@alxpsr
Copy link

alxpsr commented Jan 27, 2024

Have checked typescript/member-ordering: not working yet. Just for status

Version: 0.2.6

@happy-turtle
Copy link

happy-turtle commented Feb 8, 2024

I looked into typescript/no-confusing-non-null-assertion, but I am not able to run the test. The test code does not seem to be valid JavaScript? Is oxc maybe validating the test's JS code while typescript-eslint is not?

  × Cannot assign to this expression
   ╭─[no_confusing_non_null_assertion.tsx:1:2]
 1 │ (a + b!) = c;
   ·  ──────
   ╰────

@Boshen
Copy link
Member Author

Boshen commented Feb 8, 2024

I looked into typescript/no-confusing-non-null-assertion, but I am not able to run the test. The test code does not seem to be valid JavaScript? Is oxc maybe validating the test's JS code while typescript-eslint is not?

  × Cannot assign to this expression
   ╭─[no_confusing_non_null_assertion.tsx:1:2]
 1 │ (a + b!) = c;
   ·  ──────
   ╰────

Just comment out the tests that raise an error.

@todor-a
Copy link
Contributor

todor-a commented Feb 28, 2024

Am I missing something or is the await-thenable rule missing from the list?

@Boshen
Copy link
Member Author

Boshen commented Feb 28, 2024

Am I missing something or is the await-thenable rule missing form the list?

It seems like we excluded all type checking rules from the recommended-type-checked list.

@dsmyda-ab
Copy link

@Boshen Are there plans to eventually support type checking rules?

DonIsaac pushed a commit that referenced this issue Jun 24, 2024
Related issue: #2180

original implementation

- code:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/no-non-null-assertion.ts
- test:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts
- doc: https://typescript-eslint.io/rules/no-non-null-assertion/


typescript-eslint has a feature that is manually fixable by editor
suggestions on this rule, but oxc does not have one as far as I know, so
the implementation is simple compared to typescript-eslint
@armano2

This comment was marked as resolved.

@TheJDen
Copy link
Contributor

TheJDen commented Jul 18, 2024

Warning

This comment is maintained by CI. Do not edit this comment directly. To update comment template, see https://github.com/oxc-project/oxc/tree/main/tasks/lint_rules

This is tracking issue for @typescript-eslint/eslint-plugin.

There are 67(+ 24 deprecated) rules.

  • 9/39 recommended rules are remaining as TODO
  • 18/28 not recommended rules are remaining as TODO

To get started, run the following command:

just new-typescript-rule <RULE_NAME>

Then register the rule in crates/oxc_linter/src/rules.rs and also declare_all_lint_rules at the bottom.

Recommended rules

✨: 30, 🚫: 0 / total: 39
Status Name Docs
✨ typescript/adjacent-overload-signatures https://typescript-eslint.io/rules/adjacent-overload-signatures
✨ typescript/array-type https://typescript-eslint.io/rules/array-type
✨ typescript/ban-tslint-comment https://typescript-eslint.io/rules/ban-tslint-comment
✨ typescript/ban-types https://typescript-eslint.io/rules/ban-types
typescript/class-literal-property-style https://typescript-eslint.io/rules/class-literal-property-style
typescript/consistent-generic-constructors https://typescript-eslint.io/rules/consistent-generic-constructors
✨ typescript/consistent-indexed-object-style https://typescript-eslint.io/rules/consistent-indexed-object-style
typescript/consistent-type-assertions https://typescript-eslint.io/rules/consistent-type-assertions
✨ typescript/consistent-type-definitions https://typescript-eslint.io/rules/consistent-type-definitions
✨ typescript/no-array-constructor https://typescript-eslint.io/rules/no-array-constructor
✨ typescript/no-confusing-non-null-assertion https://typescript-eslint.io/rules/no-confusing-non-null-assertion
✨ typescript/no-duplicate-enum-values https://typescript-eslint.io/rules/no-duplicate-enum-values
✨ typescript/no-dynamic-delete https://typescript-eslint.io/rules/no-dynamic-delete
✨ typescript/no-empty-function https://typescript-eslint.io/rules/no-empty-function
✨ typescript/no-empty-interface https://typescript-eslint.io/rules/no-empty-interface
✨ typescript/no-explicit-any https://typescript-eslint.io/rules/no-explicit-any
✨ typescript/no-extra-non-null-assertion https://typescript-eslint.io/rules/no-extra-non-null-assertion
typescript/no-extraneous-class https://typescript-eslint.io/rules/no-extraneous-class
typescript/no-inferrable-types https://typescript-eslint.io/rules/no-inferrable-types
typescript/no-invalid-void-type https://typescript-eslint.io/rules/no-invalid-void-type
✨ typescript/no-loss-of-precision https://typescript-eslint.io/rules/no-loss-of-precision
✨ typescript/no-misused-new https://typescript-eslint.io/rules/no-misused-new
✨ typescript/no-namespace https://typescript-eslint.io/rules/no-namespace
✨ typescript/no-non-null-asserted-nullish-coalescing https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing
✨ typescript/no-non-null-asserted-optional-chain https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
✨ typescript/no-non-null-assertion https://typescript-eslint.io/rules/no-non-null-assertion
✨ typescript/no-this-alias https://typescript-eslint.io/rules/no-this-alias
✨ typescript/no-unnecessary-type-constraint https://typescript-eslint.io/rules/no-unnecessary-type-constraint
✨ typescript/no-unsafe-declaration-merging https://typescript-eslint.io/rules/no-unsafe-declaration-merging
typescript/no-unused-vars https://typescript-eslint.io/rules/no-unused-vars
✨ typescript/no-useless-constructor https://typescript-eslint.io/rules/no-useless-constructor
✨ typescript/no-var-requires https://typescript-eslint.io/rules/no-var-requires
✨ typescript/prefer-as-const https://typescript-eslint.io/rules/prefer-as-const
✨ typescript/prefer-for-of https://typescript-eslint.io/rules/prefer-for-of
✨ typescript/prefer-function-type https://typescript-eslint.io/rules/prefer-function-type
✨ typescript/prefer-literal-enum-member https://typescript-eslint.io/rules/prefer-literal-enum-member
typescript/prefer-namespace-keyword https://typescript-eslint.io/rules/prefer-namespace-keyword
✨ typescript/triple-slash-reference https://typescript-eslint.io/rules/triple-slash-reference
typescript/unified-signatures https://typescript-eslint.io/rules/unified-signatures
✨ = Implemented, 🚫 = Not supported

Not recommended rules

✨: 10, 🚫: 0 / total: 28
Status Name Docs
✨ typescript/ban-ts-comment https://typescript-eslint.io/rules/ban-ts-comment
typescript/class-methods-use-this https://typescript-eslint.io/rules/class-methods-use-this
✨ typescript/consistent-type-imports https://typescript-eslint.io/rules/consistent-type-imports
✨ typescript/default-param-last https://typescript-eslint.io/rules/default-param-last
✨ typescript/explicit-function-return-type https://typescript-eslint.io/rules/explicit-function-return-type
typescript/explicit-member-accessibility https://typescript-eslint.io/rules/explicit-member-accessibility
typescript/explicit-module-boundary-types https://typescript-eslint.io/rules/explicit-module-boundary-types
typescript/init-declarations https://typescript-eslint.io/rules/init-declarations
✨ typescript/max-params https://typescript-eslint.io/rules/max-params
typescript/member-ordering https://typescript-eslint.io/rules/member-ordering
typescript/method-signature-style https://typescript-eslint.io/rules/method-signature-style
✨ typescript/no-dupe-class-members https://typescript-eslint.io/rules/no-dupe-class-members
typescript/no-empty-object-type https://typescript-eslint.io/rules/no-empty-object-type
✨ typescript/no-import-type-side-effects https://typescript-eslint.io/rules/no-import-type-side-effects
typescript/no-invalid-this https://typescript-eslint.io/rules/no-invalid-this
typescript/no-loop-func https://typescript-eslint.io/rules/no-loop-func
typescript/no-magic-numbers https://typescript-eslint.io/rules/no-magic-numbers
✨ typescript/no-redeclare https://typescript-eslint.io/rules/no-redeclare
typescript/no-require-imports https://typescript-eslint.io/rules/no-require-imports
typescript/no-restricted-imports https://typescript-eslint.io/rules/no-restricted-imports
typescript/no-shadow https://typescript-eslint.io/rules/no-shadow
typescript/no-unnecessary-parameter-property-assignment https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment
typescript/no-unused-expressions https://typescript-eslint.io/rules/no-unused-expressions
typescript/no-use-before-define https://typescript-eslint.io/rules/no-use-before-define
✨ typescript/no-useless-empty-export https://typescript-eslint.io/rules/no-useless-empty-export
typescript/parameter-properties https://typescript-eslint.io/rules/parameter-properties
✨ typescript/prefer-enum-initializers https://typescript-eslint.io/rules/prefer-enum-initializers
typescript/typedef https://typescript-eslint.io/rules/typedef
✨ = Implemented, 🚫 = Not supported

Deprecated rules

✨: 1, 🚫: 0 / total: 24

Can we change command name here, it doesn't actually exist (it is ts instead of full typescript) @Boshen

DonIsaac added a commit that referenced this issue Aug 11, 2024
This is the command suggested to users on our `typescript-eslint` mega-issue #2180.
This should help reduce confusion.
DonIsaac added a commit that referenced this issue Aug 11, 2024
This is the command suggested to users on our `typescript-eslint` mega-issue #2180.
This should help reduce confusion.
Boshen pushed a commit that referenced this issue Aug 11, 2024
This is the command suggested to users on our `typescript-eslint` mega-issue #2180.
This should help reduce confusion.
@markEHVN
Copy link

markEHVN commented Nov 11, 2024

Hi team, I ran oxlint and I caught some issues:

! The following rules do not match the currently supported rules:
  | typescript/no-dupe-class-members
  | typescript/no-useless-constructor
  | typescript/no-loss-of-precision
  | typescript/no-array-constructor
  | typescript/no-redeclare
  | typescript/no-unused-vars

But, you can see all these rules have been implemented. I am using "oxlint": "^0.11.0",

@markEHVN
Copy link

I did not find @typescript-eslint/naming-convention - docs. Should we add it to Not recommended rules table?

@harrytran998
Copy link

Yes, the rule @typescript-eslint/naming-convention is really important for large projects, especially with projects that have multiple teams interacting. Hope this rule implement soon - Thanks oxc team

@camc314
Copy link
Contributor

camc314 commented Nov 23, 2024

@typescript-eslint/naming-convention requires type information unfortunatly.

I wonder whether it would be reasonable to introduce our own version of this which is slightly more limited.

something like:

https://rust-lang.github.io/api-guidelines/naming.html

For typescript it would be:

Item Convention
Classes UpperCamelCase
Interfaces UpperCamelCase, often prefixed with I (optional and project-specific, e.g., IUser)
Type Aliases UpperCamelCase
Enums UpperCamelCase
Enum Members UPPER_SNAKE_CASE
Functions camelCase
Methods camelCase
Variables camelCase
Constants SCREAMING_SNAKE_CASE
Parameters camelCase
Type Parameters UpperCamelCase
Generic Constraints UpperCamelCase
Literals Use direct values or const enums for clarity.
Properties camelCase for public/protected/private properties, #camelCase for private fields
Imports camelCase for functions/variables, UpperCamelCase for classes/types
Decorators @ camelCase
Namespaces UpperCamelCase

and i guess we could also allow customizing these conventions.

would this satisfy most of what @typescript-eslint/naming-convention does?

@protoEvangelion
Copy link

no-restricted-imports is blocker for me to adopt oxlint.

@markEHVN
Copy link

markEHVN commented Nov 26, 2024

would this satisfy most of what @typescript-eslint/naming-convention does?

Yes, It's satisfy most of cases. I never use type-checked with naming-convention rule. 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests