Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

New rule option: 'check-rest-spread' for 'whitespace' rule #3089

Merged
merged 6 commits into from Aug 10, 2017
Merged

New rule option: 'check-rest-spread' for 'whitespace' rule #3089

merged 6 commits into from Aug 10, 2017

Conversation

ksvitkovsky
Copy link
Contributor

@ksvitkovsky ksvitkovsky commented Aug 1, 2017

PR checklist

CHANGELOG.md entry:

[new-rule-option] whitespace: Add check-rest-spread option (#2122)

@@ -27,6 +27,7 @@ const OPTION_DECL = "check-decl";
const OPTION_OPERATOR = "check-operator";
const OPTION_MODULE = "check-module";
const OPTION_SEPARATOR = "check-separator";
const OPTION_SPREAD = "check-spread";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer check-rest-spread which checks object and array spread as well as object and array rest and rest parameters

@@ -192,6 +196,13 @@ function walk(ctx: Lint.WalkContext<Options>) {
if (options.decl && initializer !== undefined) {
checkForTrailingWhitespace((type !== undefined ? type : name).getEnd());
}
break;

case ts.SyntaxKind.SpreadAssignment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also checks foo(...bar), which is correct if this option checks rest and spread.
It would also need to check BindingElement and Parameter where dotDotDotToken is not undefined and SpreadElement.

@ksvitkovsky
Copy link
Contributor Author

@ajafff thank you for the feedback! will get back to it soon

@adidahiya adidahiya changed the title 'check-spread' option for 'whitespace' rule New rule option: 'check-rest-spread' for 'whitespace' rule Aug 10, 2017
@adidahiya
Copy link
Contributor

thanks @ksvitkovsky

@adidahiya adidahiya merged commit 3b2d456 into palantir:master Aug 10, 2017
@ksvitkovsky
Copy link
Contributor Author

my pleasure 😊

@ksvitkovsky ksvitkovsky deleted the feature-2122 branch August 10, 2017 19:15
@yak80
Copy link

yak80 commented Sep 27, 2017

Last build cause error, looks like prob in this option:

ERROR: src/components/app/App.ts[42, 11]: missing whitespace
    /**
     * Vue component 'preFetch' hook, that is used in SSR to do required
     * things with given Vuex store before page rendering.
     *
42:  * @param store    Vuex store, to perform actions on.
     *
     * @return    Resolved promise with array of all users, that exist
     *            in the system.
     */

Looks like it has conflict with option check-operator.

Default whitespace configuration:

"whitespace": [true, "check-branch", "check-operator", "check-typecast"])

If remove check-operator from configuration then all fine and error fixed:

"whitespace": [true, "check-branch", "check-typecast"]

HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants