dx-platform icon indicating copy to clipboard operation
dx-platform copied to clipboard

add some tslint rules

Open scink opened this issue 6 years ago • 8 comments

i suggest to add next rules:

  1. adjacent-overload-signatures - Enforces function overloads to be consecutive.
  2. arrow-return-shorthand - Suggests to convert () => { return x; } to () => x.
  3. ban-comma-operator - Disallows the comma operator to be used. Read more about the comma operator here.
  4. binary-expression-operand-order - In a binary expression, a literal should always be on the right-hand side if possible. For example, prefer ‘x + 1’ over ‘1 + x’.
  5. eofline - Ensures the file ends with a newline.
  6. file-name-casing - Enforces a consistent file naming convention.
  7. indent - Enforces indentation with tabs or spaces.
  8. max-classes-per-file - A file may not contain more than the specified number of classes.
  9. member-access - Requires explicit visibility declarations for class members.
  10. no-any - Disallows usages of any as a type declaration.
  11. no-boolean-literal-compare - Warns on comparison to a boolean literal, as in x === true.
  12. ~~no-construct - Disallows access to the constructors of String, Number, and Boolean.~~
  13. no-console - Bans the use of specified console methods.
  14. ~~no-debugger - Disallows debugger statements.~~
  15. no-default-export - Disallows default exports in ES6-style modules.
  16. no-duplicate-super - Warns if super() appears twice in a constructor.
  17. ~~no-duplicate-switch-case - Prevents duplicate cases in switch statements.~~
  18. ~~no-duplicate-variable - Disallows duplicate variable declarations in the same block scope.~~
  19. no-empty - Disallows empty blocks.
  20. no-empty-interface - Forbids empty interfaces.
  21. no-for-in-array - Disallows iterating over an array with a for-in loop.
  22. no-magic-numbers - Disallows the use constant number values outside of variable assignments. When no list of allowed values is specified, -1, 0 and 1 are allowed by default.
  23. ~~no-namespace - Disallows use of internal modules and namespaces.~~
  24. no-non-null-assertion - Disallows non-null assertions using the ! postfix operator.
  25. ~~no-require-imports - Disallows invocation of require().~~
  26. no-shadowed-variable - Disallows shadowing variable declarations.
  27. no-use-before-declare - Disallows usage of variables before their declaration.
  28. ~~no-var-keyword - Disallows usage of the var keyword.~~
  29. ~~object-literal-shorthand - Enforces/disallows use of ES6 object literal shorthand.~~
  30. ~~prefer-const - Requires that variable declarations use const instead of let and var if possible.~~
  31. prefer-switch - Prefer a switch statement to an if statement with simple === comparisons.
  32. ~~radix - Requires the radix parameter to be specified when calling parseInt.~~
  33. restrict-plus-operands - When adding two variables, operands must both be of type number or of type string.
  34. ~~triple-equals - Requires === and !== in place of == and !=.~~

scink avatar Aug 08 '18 11:08 scink

adjacent-overload-signatures Enforces function overloads to be consecutive - in which way?

max-classes-per-file A file may not contain more than the specified number of classes. - which one?

member-access Requires explicit visibility declarations for class members. - only with no-public

no-empty-interface Forbids empty interfaces. - does it allow empty inheritance (like Monad)?

raveclassic avatar Aug 13 '18 15:08 raveclassic

add tslint-immutable

scink avatar Aug 14 '18 08:08 scink

also add a rule similar to tsconfig no-unused-locals

raveclassic avatar Oct 17 '18 14:10 raveclassic

@raveclassic I believe there is no such rule anymore

sutarmin avatar Oct 17 '18 14:10 sutarmin

@sutarmin we can always include its source in the lint package

raveclassic avatar Oct 17 '18 14:10 raveclassic

we can always include its source

Valid point. I found custom rule no-unused but it's doing a bit more than just no-unused-locals, details here. I think we might give it a try. I'm not sure if it's a good idea to copy-paste source to our repo but it's the easiest approach. What do you think, guys?

sutarmin avatar Oct 23 '18 07:10 sutarmin

I am suggest to add this code to our repo.

mankdev avatar Oct 24 '18 07:10 mankdev

Add jsx-boolean-value

morozovamv avatar Sep 05 '19 16:09 morozovamv