mohseenrm / lit-it

Lazy JSDoc Builder, Add character to your JS code
https://marketplace.visualstudio.com/items?itemName=mohseenrm.lit-it
MIT License
3 stars 3 forks source link

tslint rules #9

Open kylelamse opened 7 years ago

kylelamse commented 7 years ago

Let's go line by line and decide on a coding style we agree on. I just merged my changes from my forked version of this repo so I could get rid of it. In the future we will make branches for each feature/bugfix I would say.

mohseenrm commented 7 years ago

Yup, that sounds kosher. Great Job @kylelamse! :smile:

kylelamse commented 7 years ago

I am in-lining the json config and commenting on each rule. Ignore the red. It's because // comments aren't valid in json.

{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended",
        "tslint-eslint-rules"
    ],
    "rules": {
        // This is just what I default to.  Am flexible if you don't like this
        "ter-indent": [
            true,
            4
        ],
        // Allows for less writing, and looks nicer. I don't think we care about the 'this' binding in most of our callbacks
        "only-arrow-functions": [
            true,
            "allow-named-functions"
        ],
        // One less key to type quotes
        "quotemark": [
            true,
            "single"
        ],
        // I always thought this looked ugly
        "trailing-comma": [
            false
        ],
        // This is a PITA to enforce
        "object-literal-sort-keys": [
            false
        ],
        // This is also a PITA to enforce
        "ordered-imports": [
            false
        ],
        // This is good practice to only use let if a variable changes
        "prefer-const": [
            true
        ],
        // You added this in here and I agree. It's a lot less confusing and less error-prone
        "no-default-export": false,
        // Also agree. If we are using TS there is no reason to not use import for everything
        "no-require-imports": true,
        // I like this as well.  What does aligning members and elements do?  We might want this too. Couldn't find an example on tslint
        "align": [
            true, 
            "parameters", 
            "statements"
        ],
        // Great
        "no-irregular-whitespace": true,
        // Also great
        "no-trailing-whitespace": true,
        // I think this makes more readable code
        "semicolon": [
            true, 
            "always"
        ],
        // Also agree
        "space-before-function-paren": [
            true, 
            "always"
        ],
        // Ok with me
        "whitespace": [
            true, 
            "check-branch", 
            "check-operator", 
            "check-typecast",
            "check-decl",
            "check-module",
            "check-preblock",
            "check-separator"
        ],
        // It's great to have debugging with log statements
        "no-console": [
            false
        ],
        // Super annoying at times
        "max-line-length": [
            false
        ],
        // This is great so we are forced to use TS type annotations to get full advantage of TS
        "typedef": [
            true,
            "call-signature",
            "parameter",
            "member-variable-declaration",
            "arrow-parameter",
            "property-declaration",
            "variable-declaration"
        ]
    }
}
kylelamse commented 7 years ago

Also made a PR with proposed additions (#10)

mohseenrm commented 7 years ago

PR #10 is good :ok_hand:

mohseenrm commented 7 years ago

Ah! I did not know tslint-eslint-rules existed! Love the JS community :heart:

I personally prefer these: http://eslint.org/docs/rules/space-in-parens http://eslint.org/docs/rules/object-curly-spacing http://eslint.org/docs/rules/func-call-spacing http://eslint.org/docs/rules/array-bracket-spacing

I am away from a computer right now. I'll make a PR once I get back.

mohseenrm commented 7 years ago

@kylelamse review PR #13 for rules. Sorry, had to skip review because of publishing the bug fix

kylelamse commented 7 years ago

@mohseenrm I will get back to you when I get home from work. Been busy these past few days!

mohseenrm commented 7 years ago

@kylelamse no worries. Just join the slack for easier communication. Got another dev to help out with bugs and features :grin: