question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

padding-line-between-statements: Custom STATEMENT_TYPE

See original GitHub issue

What rule do you want to change? padding-line-between-statements

Does this change cause the rule to produce more or fewer warnings? Fewer warnings.

How will the change be implemented? (New option, new default behavior, etc.)? Allow specification of a custom STATEMENT_TYPE that allows a user to specify certain statements to require spacing, such as an it() statement in Mocha/Jest.

Please provide some example code that this change will affect: Before allowing custom STATEMENT_TYPE:

describe("Test Suite", () => {
    it("has a test", () => {
        expect(1).to.equal(1);
    });
    it("has another test", () => { // No way to enforce an error here
        expect(2).to.equal(2);
    });
});

After allowing a custom STATEMENT_TYPE that adds it as a statement requiring one or more newlines:

describe("Test Suite", () => {
    it("has a test", () => {
        expect(1).to.equal(1);
    });
    it("has another test", () => { // Error
        expect(2).to.equal(2);
    });
});

The code would be valid with the added option if it looked like this:

describe("Test Suite", () => {
    it("has a test", () => {
        expect(1).to.equal(1);
    });

    it("has another test", () => { // Valid
        expect(2).to.equal(2);
    });
});

What does the rule currently do for this code? Nothing.

What will the rule do after it’s changed? Enforce padding line between a custom STATEMENT_TYPE.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
platinumazurecommented, Jul 1, 2017

Can we support selectors here?

For example: { blankLine: "always", prev: "ExpressionStatement > CallExpression[callee.name='it']", next: "ExpressionStatement > CallExpression[callee.name='it']" }

…A bit verbose, though!

0reactions
not-an-aardvarkcommented, Jan 19, 2018

Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn’t get consensus from the team, so I’m closing it. We define consensus as having three 👍s from team members, as well as a team member willing to champion the proposal. This is a high bar by design – we can’t realistically accept and maintain every feature request in the long term, so we only accept feature requests which are useful enough that there is consensus among the team that they’re worth adding.

Since ESLint is pluggable and can load custom rules at runtime, the lack of consensus among the ESLint team doesn’t need to be a blocker for you using this in your project, if you’d find it useful. It just means that you would need to implement the rule yourself, rather than using a bundled rule that is packaged with ESLint.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint/eslint - Gitter
i have problem with using custom rules. i created a local submodule with yeoman and included it in the ... The module of...
Read more >
@typescript-eslint/parser | Yarn - Package Manager
owner typescript-eslint92.1mBSD-2-Clause5.47.0TS vulns 0 vulnerabilities. An ESLint custom parser which leverages TypeScript ESTree.
Read more >
PR Rejection Reasons -- Hexo and ESLint Case Studies
project pr_id user URL Sentiment Reas... eslint/eslint 13251 revelt https://github.com/eslint/eslint/pull/13251 Neutral Close... eslint/eslint 13213 aladdin‑add https://github.com/eslint/eslint/pull/13213 Positive PR c... eslint/eslint 13150 rajat1saxena https://github.com/eslint/eslint/pull/13150 Positive PR c......
Read more >
Renovate Bot Package Diff
... docs/rules/padding-line-between-statements.md +3 -1; docs/rules/prefer-as-const.md +16 -1 ... + else if (exportOrImportNodeTypes.has(statement.type)) {.
Read more >
@typescript-eslint/typescript-estree: Versions | Openbase
... eslint-plugin: [padding-line-between-statements] type StatementTypes ... typescript-estree: add support for custom module resolution (#3516) (d48429d) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found