stencil-eslint icon indicating copy to clipboard operation
stencil-eslint copied to clipboard

TODO rules

Open manucorporat opened this issue 6 years ago • 5 comments

Pending rules:

  • [ ] public apis must be documented
  • [ ] order of properties/methods following the stencil’s style guide https://stenciljs.com/docs/style-guide
  • [ ] validation of the component’s tag
  • [ ] validation of the component’s class name
  • [ ] enforce tag-name prefix
  • [ ] ban certain tag-name prefixes (like stencil-, stncl-, sc-...) configurable
  • [ ] @Element() 's type must be HTML{tag-name}Element
  • [ ] mutation of Prop()
  • [ ] side mutation of objects and arrays in @State() and @Prop()
  • [ ] prefer <Host> vs returning array in render()
  • [ ] always prefer <Host>
  • [ ] reusage or JSX nodes (not possible in stencil's render)
  • [ ] @Watch decorators listens to existing prop or state

Naming:

  • Consistent naming of Props / Events and method

Code quality

  • Too many methods?

manucorporat avatar Jun 17 '19 13:06 manucorporat

Help wanted!

manucorporat avatar Jun 17 '19 13:06 manucorporat

For arrays, we can suggest using ReadonlyArray<T> instead of T[] and for objects we have the mapped type Readonly<T>. That way, the checker can be simplified.

Serabe avatar Jun 17 '19 13:06 Serabe

That's a great idea @Serabe ! and easy enough to implement

manucorporat avatar Jun 17 '19 14:06 manucorporat

@manucorporat would it be better to split these rules out to individual issues? I see some have been added but the list hasn't been updated.

chimon2000 avatar Aug 06 '19 16:08 chimon2000

I just created a pull request with some rules and tests https://github.com/ionic-team/stencil-eslint/pull/2

d0whc3r avatar Sep 14 '19 22:09 d0whc3r