jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

Add the rule disallowPaddingNewLinesBeforeUseStrict #2176

Closed nikini closed 8 years ago

nikini commented 8 years ago

It's nice that we have the option dissallowPaddingNewLinesAfterUseStrict and requirePaddingNewLinesAfterUseStrict but it would be nice if we could have the same thing for the before the use strict,

The following rules could be added:

disallowPaddingNewLinesBeforeUseStrict

Valid:

(function () {
    'use strict';

    // Code goes here
}());

Invalid:

(function () {

    'use strict';

    // Code goes here
}());

requirePaddingNewLinesBeforeUseStrict

Valid:

(function () {

    'use strict';

    // Code goes here
}());

Invalid:

(function () {
    'use strict';

    // Code goes here
}());

Their values would be either true or false. (Keeping it simple)

markelog commented 8 years ago

Would you like to implement it?

nikini commented 8 years ago

Hmm, sure, but it would take a while since I'm going on vacation tomorrow for 10 days :)

markelog commented 8 years ago

Hey, happy vacation! :)

hzoo commented 8 years ago

We released 3.0 recently! We also wrote a post about how 3.0 will be our last major release (since we are deprecating the project) and that we are merging with ESLint!

Thus we won't be working on any new features moving forward which includes new rules/options. We will continue to fix bugs and work on CST/better autofixing for current rules in the upcoming months both to help JSCS users and to gain experience that we can hopefully use in ESLint. But otherwise we both teams will be working on getting ESLint feature parity with JSCS and just a nice transition for our users.

I'm putting an orphaned label to note this issue isn't planned to be worked on, but might be a good contribution as a custom rule (not in JSCS core itself).

I would encourage anyone who wants the rule to try writing it themselves: I would either write a custom rule or submit an issue to ESLint and if accepted a PR. Otherwise a custom rule that won't be in core repo itself.

JSCS rules are also very similar to ESLint rules: here are some resources to get started: