Giter Site home page Giter Site logo

natemoo-re / tslint-stencil Goto Github PK

View Code? Open in Web Editor NEW
22.0 2.0 4.0 327 KB

Contributes some helpful tslint rules for Stencil projects

Home Page: https://projects.natemoo.re/tslint-stencil/

License: MIT License

TypeScript 73.87% JavaScript 26.13%
stencil tslint stencil-component

tslint-stencil's Introduction

tslint-stencil

Adds stylistic tslint rules for Stencil projects

Getting started

Add the following line to your tslint.json file to enable the default ruleset (which follows the Stencil Style Guide)

{
  "extends": ["tslint-stencil/default"]
}

Alternatively, you can extend the bare package and enable each rule on a individual basis

{
  "extends": ["tslint-stencil"],
  "rules": {
    "host-data-precedes-render": true
  }
}

Rules

Ensures that a Component's tag does not use any of the given prefixes.

Ensures that Component members are ordered consistently

Allows a maximum number of Components to be placed in a single file

Requires decorated class members to follow a consistent style (singleline or multiline)

Ensures that Component lifecycle methods are ordered consistently

Ensures that a Component's tag begins with the given prefix(es).

Contributing

Rules in the src/ directory must be camelCased and end in Rule. More information on developing custom tslint rules can be found on the tslint site

Before adding your custom rule, be sure to write a test for it. Then, you should be able to verify that it works by running:

npm run verify

tslint-stencil's People

Contributors

chrisweight avatar natemoo-re avatar patricksevat avatar tallyb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tslint-stencil's Issues

Add support to newline after decorator

Actually there is no way to force an empty line between decorator types. Example:

@Prop() user: IUser;
@State() client: IClient;
protected componentWillLoad(): void {
  ..
}

It should be cool to be:

@Prop() user: IUser;

@State() client: IClient;

protected componentWillLoad(): void {
  ..
}

Maybe a rule like new-line-after-component-member=true or new-line-after-decorated-member=true.
We could separate method new lines in other rule:
newline-after-method.

Thanks!

ESLint port

As TSLint is deprecated, it would be great to support an ESLint port of tslint-stencil

components-per-file error

Node.js : 8.12.0
npm : 6.5.0
Stencil project.

I just installed your rule, and got this error after running the default npm script provided by Stencil CLI :

"lint": "tslint -c tslint.json 'src/**/*.tsx' 'src/**/*.ts'"

Could not find implementations for the following rules specified in the configuration: components-per-file Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed. If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.