tslint-eslint-rules icon indicating copy to clipboard operation
tslint-eslint-rules copied to clipboard

[ter-indent] add new options for arrays and objects

Open jmlopez-rod opened this issue 8 years ago • 6 comments

Since the last time I updated the rule there have been new changes, see:

https://github.com/eslint/eslint/compare/0643bfeff68979044ca57a2b392d855d18be7d08...dec3ec6a1d1ded6f931a0b9e31c324e3fea50550

I'll try to get these in with a couple of other rules for next minor release.

jmlopez-rod avatar Dec 23 '16 22:12 jmlopez-rod

@jmlopez-rod Is this related to the issues I'm seeing in ter-indent when using it like:

.update(
  {},
  {
    returnChanges: 'always'
  }
)

blakeembrey avatar Jan 30 '17 23:01 blakeembrey

@blakeembrey What's the configuration and errors you are using with the code? It could be, I'm gonna say the rule is complaining on { returnChanges: 'always' } parameter?

jmlopez-rod avatar Jan 31 '17 00:01 jmlopez-rod

I'm gonna say the rule is complaining on { returnChanges: 'always' } parameter?

Yes, sorry - it is. The rule is https://github.com/blakeembrey/tslint-config-standard/blob/6d0d2f5a968e36f7b763188d32f1b019cee85c52/tslint.js#L63-L69.

blakeembrey avatar Jan 31 '17 01:01 blakeembrey

I saw https://github.com/eslint/eslint/commit/0ad4d33cdcbdd8f879dc60b56a697d727a619fc1 in the diff you pasted which looks relevant here.

blakeembrey avatar Jan 31 '17 01:01 blakeembrey

This was the enhancement request I was about to file. I could use the Array and Object indent rule options that eslint has. I wanted to use this rule in tslint.yml:

    ter-indent:
        severity: error
        options:
            - 4
            -
                SwitchCase: 1
                FunctionDeclaration:
                    parameters: first
                    body: 1
                FunctionExpression:
                    parameters: first
                    body: 1
                MemberExpression: off
                CallExpression:
                    arguments: first
                ArrayExpression: first
                ObjectExpression: first
                ImportDeclaration: first

so that this passes:

    return {
               name,
               text: `You have to do ${name}`
           };

mlippert avatar Jul 07 '18 17:07 mlippert

Any updates?

dmnrmr avatar Jul 11 '18 14:07 dmnrmr