diff --git a/apps/oxlint/conformance/snapshot.md b/apps/oxlint/conformance/snapshot.md index 45349e0dc41c7..eeefde1ca890a 100644 --- a/apps/oxlint/conformance/snapshot.md +++ b/apps/oxlint/conformance/snapshot.md @@ -7,8 +7,8 @@ | Status | Count | % | | ----------------- | ----- | ------ | | Total rules | 277 | 100.0% | -| Fully passing | 220 | 79.4% | -| Partially passing | 57 | 20.6% | +| Fully passing | 221 | 79.8% | +| Partially passing | 56 | 20.2% | | Fully failing | 0 | 0.0% | | Load errors | 0 | 0.0% | | No tests run | 0 | 0.0% | @@ -18,8 +18,8 @@ | Status | Count | % | | ----------- | ----- | ------ | | Total tests | 29765 | 100.0% | -| Passing | 28686 | 96.4% | -| Failing | 972 | 3.3% | +| Passing | 28946 | 97.2% | +| Failing | 712 | 2.4% | | Skipped | 107 | 0.4% | ## Fully Passing Rules @@ -210,6 +210,7 @@ - `operator-assignment` (119 tests) - `operator-linebreak` (104 tests) - `padded-blocks` (133 tests) +- `padding-line-between-statements` (624 tests) - `prefer-arrow-callback` (107 tests) - `prefer-destructuring` (103 tests) - `prefer-numeric-literals` (87 tests) @@ -290,7 +291,6 @@ - `no-unused-vars` - 340 / 436 (78.0%) - `no-use-before-define` - 323 / 347 (93.1%) - `no-useless-backreference` - 188 / 190 (98.9%) -- `padding-line-between-statements` - 364 / 624 (58.3%) - `prefer-const` - 136 / 138 (98.6%) - `prefer-exponentiation-operator` - 164 / 167 (98.2%) - `prefer-named-capture-group` - 54 / 57 (94.7%) @@ -96759,10327 +96759,6 @@ AssertionError [ERR_ASSERTION]: Should have no errors but had 1: [ at apps/oxlint/dist/index.js -### `padding-line-between-statements` - -Pass: 364 / 624 (58.3%) -Fail: 260 / 624 (41.7%) -Skip: 0 / 624 (0.0%) - -#### padding-line-between-statements > invalid - -```js -foo(); - -foo(); -``` - -```json -{ - "output": "foo();\nfoo();", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -foo(); - -//comment -foo(); -``` - -```json -{ - "output": "foo();\n//comment\nfoo();", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js - foo(); - - //comment - foo(); -``` - -```json -{ - "output": " foo();\n //comment\n foo();", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if (a) {} - -for (;;) {} -``` - -```json -{ - "output": "if (a) {}\nfor (;;) {}", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -foo(); -foo(); -``` - -```json -{ - "output": "foo();\n\nfoo();", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js - function a() {} - do {} while (a) -``` - -```json -{ - "output": " function a() {}\n\n do {} while (a)", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -foo();//trailing-comment -//comment -//comment -foo(); -``` - -```json -{ - "output": "foo();//trailing-comment\n\n//comment\n//comment\nfoo();", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -{} - -foo() -``` - -```json -{ - "output": "{}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -{} -foo() -``` - -```json -{ - "output": "{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a){} -foo() -``` - -```json -{ - "output": "if(a){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a){}else{} -foo() -``` - -```json -{ - "output": "if(a){}else{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a){}else if(b){} -foo() -``` - -```json -{ - "output": "if(a){}else if(b){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a){}else if(b){}else{} -foo() -``` - -```json -{ - "output": "if(a){}else if(b){}else{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -switch(a){} -foo() -``` - -```json -{ - "output": "switch(a){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -switch(a){case 0:} -foo() -``` - -```json -{ - "output": "switch(a){case 0:}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}catch(e){} -foo() -``` - -```json -{ - "output": "try{}catch(e){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}finally{} -foo() -``` - -```json -{ - "output": "try{}finally{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}catch(e){}finally{} -foo() -``` - -```json -{ - "output": "try{}catch(e){}finally{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -while(a){} -foo() -``` - -```json -{ - "output": "while(a){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -do{}while(a) -foo() -``` - -```json -{ - "output": "do{}while(a)\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(;;){} -foo() -``` - -```json -{ - "output": "for(;;){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(a in b){} -foo() -``` - -```json -{ - "output": "for(a in b){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(a of b){} -foo() -``` - -```json -{ - "output": "for(a of b){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -a=function(){} -foo() -``` - -```json -{ - "output": "a=function(){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -a=()=>{} -foo() -``` - -```json -{ - "output": "a=()=>{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a(){} -foo() -``` - -```json -{ - "output": "function a(){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a=function(){} -foo() -``` - -```json -{ - "output": "let a=function(){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -module.exports=1 - -foo() -``` - -```json -{ - "output": "module.exports=1\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "cjs-export", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -module.exports=1 -foo() -``` - -```json -{ - "output": "module.exports=1\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "cjs-export", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -module.exports.foo=1 -foo() -``` - -```json -{ - "output": "module.exports.foo=1\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "cjs-export", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -module.exports[foo]=1 -foo() -``` - -```json -{ - "output": "module.exports[foo]=1\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "cjs-export", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -exports.foo=1 -foo() -``` - -```json -{ - "output": "exports.foo=1\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "cjs-export", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -exports[foo]=1 -foo() -``` - -```json -{ - "output": "exports[foo]=1\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "cjs-export", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const foo=require("foo") - -foo() -``` - -```json -{ - "output": "const foo=require(\"foo\")\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "cjs-import", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const foo=require("foo") -foo() -``` - -```json -{ - "output": "const foo=require(\"foo\")\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "cjs-import", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const foo=require("foo").Foo -foo() -``` - -```json -{ - "output": "const foo=require(\"foo\").Foo\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "cjs-import", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const foo=require("foo")[a] -foo() -``` - -```json -{ - "output": "const foo=require(\"foo\")[a]\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "cjs-import", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -"use strict" - -foo() -``` - -```json -{ - "output": "\"use strict\"\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "directive", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -"use strict" -foo() -``` - -```json -{ - "output": "\"use strict\"\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "directive", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -'use strict' -foo() -``` - -```json -{ - "output": "'use strict'\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "directive", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -'use asm' -foo() -``` - -```json -{ - "output": "'use asm'\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "directive", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -{ -} - -foo() -``` - -```json -{ - "output": "{\n}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -{ -} -foo() -``` - -```json -{ - "output": "{\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a){ -} -foo() -``` - -```json -{ - "output": "if(a){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a){ -}else{ -} -foo() -``` - -```json -{ - "output": "if(a){\n}else{\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a){ -}else if(b){ -} -foo() -``` - -```json -{ - "output": "if(a){\n}else if(b){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a){ -}else if(b){ -}else{ -} -foo() -``` - -```json -{ - "output": "if(a){\n}else if(b){\n}else{\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -switch(a){ -} -foo() -``` - -```json -{ - "output": "switch(a){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{ -}catch(e){ -} -foo() -``` - -```json -{ - "output": "try{\n}catch(e){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{ -}finally{ -} -foo() -``` - -```json -{ - "output": "try{\n}finally{\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{ -}catch(e){ -}finally{ -} -foo() -``` - -```json -{ - "output": "try{\n}catch(e){\n}finally{\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -while(a){ -} -foo() -``` - -```json -{ - "output": "while(a){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -do{ -}while(a) -foo() -``` - -```json -{ - "output": "do{\n}while(a)\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(;;){ -} -foo() -``` - -```json -{ - "output": "for(;;){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(a in b){ -} -foo() -``` - -```json -{ - "output": "for(a in b){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(a of b){ -} -foo() -``` - -```json -{ - "output": "for(a of b){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -a=function(){ -} -foo() -``` - -```json -{ - "output": "a=function(){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -a=()=>{ -} -foo() -``` - -```json -{ - "output": "a=()=>{\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a(){ -} -foo() -``` - -```json -{ - "output": "function a(){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a=function(){ -} -foo() -``` - -```json -{ - "output": "let a=function(){\n}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -{} - -foo() -``` - -```json -{ - "output": "{}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "block", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -{} -foo() -``` - -```json -{ - "output": "{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "block", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -; - -foo() -``` - -```json -{ - "output": ";\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "empty", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -; -foo() -``` - -```json -{ - "output": ";\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "empty", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -foo() - -foo() -``` - -```json -{ - "output": "foo()\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "expression", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -foo() -foo() -``` - -```json -{ - "output": "foo()\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "expression", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -foo() - -foo( - x, - y -) -``` - -```json -{ - "output": "foo()\nfoo(\n\tx,\n\ty\n)", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "multiline-expression" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -foo() -foo( - x, - y -) -``` - -```json -{ - "output": "foo()\n\nfoo(\n\tx,\n\ty\n)", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "multiline-expression" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -() => { - someArray.forEach( - x => doSomething(x) - ); - return theThing; -} -``` - -```json -{ - "output": "() => {\n\tsomeArray.forEach(\n\t\tx => doSomething(x)\n\t);\n\n\treturn theThing;\n}", - "options": [ - { - "blankLine": "always", - "prev": "multiline-expression", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -while(a){break - -foo()} -``` - -```json -{ - "output": "while(a){break\nfoo()}", - "options": [ - { - "blankLine": "never", - "prev": "break", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -switch(a){case 0:break - -foo()} -``` - -```json -{ - "output": "switch(a){case 0:break\nfoo()}", - "options": [ - { - "blankLine": "never", - "prev": "break", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -while(a){break -foo()} -``` - -```json -{ - "output": "while(a){break\n\nfoo()}", - "options": [ - { - "blankLine": "always", - "prev": "break", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -switch(a){case 0:break -foo()} -``` - -```json -{ - "output": "switch(a){case 0:break\n\nfoo()}", - "options": [ - { - "blankLine": "always", - "prev": "break", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class A{} - -foo() -``` - -```json -{ - "output": "class A{}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "class", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class A{} -foo() -``` - -```json -{ - "output": "class A{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "class", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a=1 - -foo() -``` - -```json -{ - "output": "const a=1\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "const", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a=1 -foo() -``` - -```json -{ - "output": "const a=1\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "const", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -while(a){continue - -foo()} -``` - -```json -{ - "output": "while(a){continue\nfoo()}", - "options": [ - { - "blankLine": "never", - "prev": "continue", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -while(a){continue -foo()} -``` - -```json -{ - "output": "while(a){continue\n\nfoo()}", - "options": [ - { - "blankLine": "always", - "prev": "continue", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -debugger - -foo() -``` - -```json -{ - "output": "debugger\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "debugger", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -debugger -foo() -``` - -```json -{ - "output": "debugger\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "debugger", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -do;while(a) - -foo() -``` - -```json -{ - "output": "do;while(a)\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "do", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -do;while(a) -foo() -``` - -```json -{ - "output": "do;while(a)\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "do", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -export default 1 - -foo() -``` - -```json -{ - "output": "export default 1\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "export", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -export let a=1 - -foo() -``` - -```json -{ - "output": "export let a=1\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "export", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a = 0;export {a} - -foo() -``` - -```json -{ - "output": "var a = 0;export {a}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "export", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -export default 1 -foo() -``` - -```json -{ - "output": "export default 1\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "export", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -export let a=1 -foo() -``` - -```json -{ - "output": "export let a=1\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "export", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a = 0;export {a} -foo() -``` - -```json -{ - "output": "var a = 0;export {a}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "export", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(;;); - -foo() -``` - -```json -{ - "output": "for(;;);\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "for", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(a in b); - -foo() -``` - -```json -{ - "output": "for(a in b);\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "for", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(a of b); - -foo() -``` - -```json -{ - "output": "for(a of b);\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "for", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(;;); -foo() -``` - -```json -{ - "output": "for(;;);\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "for", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(a in b); -foo() -``` - -```json -{ - "output": "for(a in b);\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "for", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -for(a of b); -foo() -``` - -```json -{ - "output": "for(a of b);\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "for", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function foo(){} - -foo() -``` - -```json -{ - "output": "function foo(){}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "function", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function foo(){} -foo() -``` - -```json -{ - "output": "function foo(){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "function", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -async function foo(){} -foo() -``` - -```json -{ - "output": "async function foo(){}\n\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "*" - }, - { - "blankLine": "always", - "prev": "function", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a); - -foo() -``` - -```json -{ - "output": "if(a);\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "if", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a);else; - -foo() -``` - -```json -{ - "output": "if(a);else;\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "if", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a); -foo() -``` - -```json -{ - "output": "if(a);\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "if", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(a);else; -foo() -``` - -```json -{ - "output": "if(a);else;\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "if", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -(function(){ -})() - -var a = 2; -``` - -```json -{ - "output": "(function(){\n})()\nvar a = 2;", - "options": [ - { - "blankLine": "never", - "prev": "iife", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -+(function(){ -})() - -var a = 2; -``` - -```json -{ - "output": "+(function(){\n})()\nvar a = 2;", - "options": [ - { - "blankLine": "never", - "prev": "iife", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -(function(){ -})() -var a = 2; -``` - -```json -{ - "output": "(function(){\n})()\n\nvar a = 2;", - "options": [ - { - "blankLine": "always", - "prev": "iife", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -+(function(){ -})() -var a = 2; -``` - -```json -{ - "output": "+(function(){\n})()\n\nvar a = 2;", - "options": [ - { - "blankLine": "always", - "prev": "iife", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -(function(){ -})?.() -var a = 2; -``` - -```json -{ - "output": "(function(){\n})?.()\n\nvar a = 2;", - "options": [ - { - "blankLine": "always", - "prev": "iife", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 2020 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -void (function(){ -})?.() -var a = 2; -``` - -```json -{ - "output": "void (function(){\n})?.()\n\nvar a = 2;", - "options": [ - { - "blankLine": "always", - "prev": "iife", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 2020 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -import a from 'a' - -foo() -``` - -```json -{ - "output": "import a from 'a'\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "import", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -import * as a from 'a' - -foo() -``` - -```json -{ - "output": "import * as a from 'a'\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "import", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -import {a} from 'a' - -foo() -``` - -```json -{ - "output": "import {a} from 'a'\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "import", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -import a from 'a' -foo() -``` - -```json -{ - "output": "import a from 'a'\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "import", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -import * as a from 'a' -foo() -``` - -```json -{ - "output": "import * as a from 'a'\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "import", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -import {a} from 'a' -foo() -``` - -```json -{ - "output": "import {a} from 'a'\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "import", - "next": "*" - } - ], - "languageOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a - -foo() -``` - -```json -{ - "output": "let a\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "let", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a -foo() -``` - -```json -{ - "output": "let a\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "let", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function foo(){return - -foo()} -``` - -```json -{ - "output": "function foo(){return\nfoo()}", - "options": [ - { - "blankLine": "never", - "prev": "return", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function foo(){return -foo()} -``` - -```json -{ - "output": "function foo(){return\n\nfoo()}", - "options": [ - { - "blankLine": "always", - "prev": "return", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -switch(a){} - -foo() -``` - -```json -{ - "output": "switch(a){}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "switch", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -switch(a){} -foo() -``` - -```json -{ - "output": "switch(a){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "switch", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -throw a - -foo() -``` - -```json -{ - "output": "throw a\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "throw", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -throw a -foo() -``` - -```json -{ - "output": "throw a\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "throw", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}catch(e){} - -foo() -``` - -```json -{ - "output": "try{}catch(e){}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "try", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}finally{} - -foo() -``` - -```json -{ - "output": "try{}finally{}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "try", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}catch(e){}finally{} - -foo() -``` - -```json -{ - "output": "try{}catch(e){}finally{}\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "try", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}catch(e){} -foo() -``` - -```json -{ - "output": "try{}catch(e){}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "try", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}finally{} -foo() -``` - -```json -{ - "output": "try{}finally{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "try", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -try{}catch(e){}finally{} -foo() -``` - -```json -{ - "output": "try{}catch(e){}finally{}\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "try", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a - -foo() -``` - -```json -{ - "output": "var a\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "var", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a -foo() -``` - -```json -{ - "output": "var a\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "var", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -while(a); - -foo() -``` - -```json -{ - "output": "while(a);\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "while", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -while(a); -foo() -``` - -```json -{ - "output": "while(a);\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "while", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -with(a); - -foo() -``` - -```json -{ - "output": "with(a);\nfoo()", - "options": [ - { - "blankLine": "never", - "prev": "with", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -with(a); -foo() -``` - -```json -{ - "output": "with(a);\n\nfoo()", - "options": [ - { - "blankLine": "always", - "prev": "with", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a={ -b:1, -c:2 -} - -const d=3 -``` - -```json -{ - "output": "const a={\nb:1,\nc:2\n}\nconst d=3", - "options": [ - { - "blankLine": "never", - "prev": "multiline-const", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a={ -b:1, -c:2 -} -const d=3 -``` - -```json -{ - "output": "const a={\nb:1,\nc:2\n}\n\nconst d=3", - "options": [ - { - "blankLine": "always", - "prev": "multiline-const", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a=1 - -const b={ -c:2, -d:3 -} -``` - -```json -{ - "output": "const a=1\nconst b={\nc:2,\nd:3\n}", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "multiline-const" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a=1 -const b={ -c:2, -d:3 -} -``` - -```json -{ - "output": "const a=1\n\nconst b={\nc:2,\nd:3\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "multiline-const" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a={ -b:1, -c:2 -} - -let d=3 -``` - -```json -{ - "output": "let a={\nb:1,\nc:2\n}\nlet d=3", - "options": [ - { - "blankLine": "never", - "prev": "multiline-let", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a={ -b:1, -c:2 -} -let d=3 -``` - -```json -{ - "output": "let a={\nb:1,\nc:2\n}\n\nlet d=3", - "options": [ - { - "blankLine": "always", - "prev": "multiline-let", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a=1 - -let b={ -c:2, -d:3 -} -``` - -```json -{ - "output": "let a=1\nlet b={\nc:2,\nd:3\n}", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "multiline-let" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a=1 -let b={ -c:2, -d:3 -} -``` - -```json -{ - "output": "let a=1\n\nlet b={\nc:2,\nd:3\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "multiline-let" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a={ -b:1, -c:2 -} - -var d=3 -``` - -```json -{ - "output": "var a={\nb:1,\nc:2\n}\nvar d=3", - "options": [ - { - "blankLine": "never", - "prev": "multiline-var", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a={ -b:1, -c:2 -} -var d=3 -``` - -```json -{ - "output": "var a={\nb:1,\nc:2\n}\n\nvar d=3", - "options": [ - { - "blankLine": "always", - "prev": "multiline-var", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a=1 - -var b={ -c:2, -d:3 -} -``` - -```json -{ - "output": "var a=1\nvar b={\nc:2,\nd:3\n}", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "multiline-var" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a=1 -var b={ -c:2, -d:3 -} -``` - -```json -{ - "output": "var a=1\n\nvar b={\nc:2,\nd:3\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "multiline-var" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a=1 - -const b=2 -``` - -```json -{ - "output": "const a=1\nconst b=2", - "options": [ - { - "blankLine": "never", - "prev": "singleline-const", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a=1 -const b=2 -``` - -```json -{ - "output": "const a=1\n\nconst b=2", - "options": [ - { - "blankLine": "always", - "prev": "singleline-const", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a=1 - -const b=2 -``` - -```json -{ - "output": "const a=1\nconst b=2", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "singleline-const" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const a=1 -const b=2 -``` - -```json -{ - "output": "const a=1\n\nconst b=2", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "singleline-const" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a=1 - -let b=2 -``` - -```json -{ - "output": "let a=1\nlet b=2", - "options": [ - { - "blankLine": "never", - "prev": "singleline-let", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a=1 -let b=2 -``` - -```json -{ - "output": "let a=1\n\nlet b=2", - "options": [ - { - "blankLine": "always", - "prev": "singleline-let", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a=1 - -let b=2 -``` - -```json -{ - "output": "let a=1\nlet b=2", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "singleline-let" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let a=1 -let b=2 -``` - -```json -{ - "output": "let a=1\n\nlet b=2", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "singleline-let" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a=1 - -var b=2 -``` - -```json -{ - "output": "var a=1\nvar b=2", - "options": [ - { - "blankLine": "never", - "prev": "singleline-var", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a=1 -var b=2 -``` - -```json -{ - "output": "var a=1\n\nvar b=2", - "options": [ - { - "blankLine": "always", - "prev": "singleline-var", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a=1 - -var b=2 -``` - -```json -{ - "output": "var a=1\nvar b=2", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "singleline-var" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a=1 -var b=2 -``` - -```json -{ - "output": "var a=1\n\nvar b=2", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "singleline-var" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello';console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\n\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello';var name = 'world';console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello';var name = 'world';\n\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello', name = 'world';console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello', name = 'world';\n\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\n\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\n \nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; // inline comment -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello'; // inline comment\n\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; -var name = 'world'; -console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello';\nvar name = 'world';\n\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello', name = 'world'; -console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello', name = 'world';\n\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello', -name = 'world'; -console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello',\nname = 'world';\n\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let greet = 'hello'; -console.log(greet); -``` - -```json -{ - "output": "let greet = 'hello';\n\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const greet = 'hello'; -console.log(greet); -``` - -```json -{ - "output": "const greet = 'hello';\n\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function example() { -var greet = 'hello'; -console.log(greet); -} -``` - -```json -{ - "output": "function example() {\nvar greet = 'hello';\n\nconsole.log(greet);\n}", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var f = function() { -var greet = 'hello'; -console.log(greet); -}; -``` - -```json -{ - "output": "var f = function() {\nvar greet = 'hello';\n\nconsole.log(greet);\n};", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -() => { -var greet = 'hello'; -console.log(greet); -} -``` - -```json -{ - "output": "() => {\nvar greet = 'hello';\n\nconsole.log(greet);\n}", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; - -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\nconsole.log(greet);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; - - -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\nconsole.log(greet);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; - - - -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\nconsole.log(greet);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; - -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello'; \nconsole.log(greet);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; // inline comment - -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello'; // inline comment\nconsole.log(greet);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; -var name = 'world'; - -console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello';\nvar name = 'world';\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello', name = 'world'; - -console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello', name = 'world';\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello', -name = 'world'; - -console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello',\nname = 'world';\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello', // inline comment -name = 'world'; // inline comment - -console.log(greet, name); -``` - -```json -{ - "output": "var greet = 'hello', // inline comment\nname = 'world'; // inline comment\nconsole.log(greet, name);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -let greet = 'hello'; - -console.log(greet); -``` - -```json -{ - "output": "let greet = 'hello';\nconsole.log(greet);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -const greet = 'hello'; - -console.log(greet); -``` - -```json -{ - "output": "const greet = 'hello';\nconsole.log(greet);", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; -// next-line comment -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\n\n// next-line comment\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; -/* block comment -block comment */ -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\n\n/* block comment\nblock comment */\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello', -name = 'world'; -// next-line comment -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello',\nname = 'world';\n\n// next-line comment\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello', -name = 'world'; -/* block comment -block comment */ -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello',\nname = 'world';\n\n/* block comment\nblock comment */\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; -// next-line comment -// second-line comment -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\n\n// next-line comment\n// second-line comment\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var greet = 'hello'; -// next-line comment -/* block comment -block comment */ -console.log(greet); -``` - -```json -{ - "output": "var greet = 'hello';\n\n// next-line comment\n/* block comment\nblock comment */\nconsole.log(greet);", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js - - var a = 1 - ;(b || c).doSomething() - -``` - -```json -{ - "output": "\n var a = 1\n\n ;(b || c).doSomething()\n ", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js - - var a = 1 - - ;(b || c).doSomething() - -``` - -```json -{ - "output": "\n var a = 1\n ;(b || c).doSomething()\n ", - "options": [ - { - "blankLine": "never", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; return; -} -``` - -```json -{ - "output": "function a() {\nvar b;\n\n return;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; -return; -} -``` - -```json -{ - "output": "function a() {\nvar b;\n\nreturn;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -if (b) return b; -else if (c) return c; -else { -e(); -return d; -} -} -``` - -```json -{ - "output": "function a() {\nif (b) return b;\nelse if (c) return c;\nelse {\ne();\n\nreturn d;\n}\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -if (b) return b; -else if (c) return c; -else { -e(); return d; -} -} -``` - -```json -{ - "output": "function a() {\nif (b) return b;\nelse if (c) return c;\nelse {\ne();\n\n return d;\n}\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { - while (b) { -c(); -return; -} -} -``` - -```json -{ - "output": "function a() {\n while (b) {\nc();\n\nreturn;\n}\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -do { -c(); -return; -} while (b); -} -``` - -```json -{ - "output": "function a() {\ndo {\nc();\n\nreturn;\n} while (b);\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -for (var b; b < c; b++) { -c(); -return; -} -} -``` - -```json -{ - "output": "function a() {\nfor (var b; b < c; b++) {\nc();\n\nreturn;\n}\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -for (b in c) { -d(); -return; -} -} -``` - -```json -{ - "output": "function a() {\nfor (b in c) {\nd();\n\nreturn;\n}\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -for (b of c) { -d(); -return; -} -} -``` - -```json -{ - "output": "function a() {\nfor (b of c) {\nd();\n\nreturn;\n}\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -if (b) { -c(); -} -//comment -return b; -} -``` - -```json -{ - "output": "function a() {\nif (b) {\nc();\n}\n\n//comment\nreturn b;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -/*comment -comment*/ -if (b) { -c(); -return b; -} else { -//comment - -return d; -} -/*multi-line -comment*/ -return e; -} -``` - -```json -{ - "output": "function a() {\n/*comment\ncomment*/\nif (b) {\nc();\n\nreturn b;\n} else {\n//comment\n\nreturn d;\n}\n\n/*multi-line\ncomment*/\nreturn e;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - }, - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 2 errors but had 0: [] - -0 !== 2 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -if (b) { return; } //comment -return c; -} -``` - -```json -{ - "output": "function a() {\nif (b) { return; } //comment\n\nreturn c;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -if (b) { return; } /*multi-line -comment*/ -return c; -} -``` - -```json -{ - "output": "function a() {\nif (b) { return; } /*multi-line\ncomment*/\n\nreturn c;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -if (b) { return; } -/*multi-line -comment*/ return c; -} -``` - -```json -{ - "output": "function a() {\nif (b) { return; }\n\n/*multi-line\ncomment*/ return c;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -if (b) { return; } /*multi-line -comment*/ return c; -} -``` - -```json -{ - "output": "function a() {\nif (b) { return; } /*multi-line\ncomment*/\n\n return c;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a; -return; -``` - -```json -{ - "output": "var a;\n\nreturn;", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "languageOptions": { - "parserOptions": { - "ecmaFeatures": { - "globalReturn": true - } - } - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a; return; -``` - -```json -{ - "output": "var a;\n\n return;", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "languageOptions": { - "parserOptions": { - "ecmaFeatures": { - "globalReturn": true - } - } - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -{ -//comment -} -return -} -``` - -```json -{ - "output": "function a() {\n{\n//comment\n}\n\nreturn\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -{ -//comment -} return -} -``` - -```json -{ - "output": "function a() {\n{\n//comment\n}\n\n return\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var c; -while (b) { - c = d; //comment -} -return c; -} -``` - -```json -{ - "output": "function a() {\nvar c;\nwhile (b) {\n c = d; //comment\n}\n\nreturn c;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -for (var b; b < c; b++) { -if (d) { -break; //comment -} -return; -} -} -``` - -```json -{ - "output": "function a() {\nfor (var b; b < c; b++) {\nif (d) {\nbreak; //comment\n}\n\nreturn;\n}\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; /*multi-line -comment*/ -return c; -} -``` - -```json -{ - "output": "function a() {\nvar b; /*multi-line\ncomment*/\n\nreturn c;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; -/*multi-line -comment*/ return c; -} -``` - -```json -{ - "output": "function a() {\nvar b;\n\n/*multi-line\ncomment*/ return c;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; /*multi-line -comment*/ return c; -} -``` - -```json -{ - "output": "function a() {\nvar b; /*multi-line\ncomment*/\n\n return c;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; -//comment -return; -} -``` - -```json -{ - "output": "function a() {\nvar b;\n\n//comment\nreturn;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; //comment -return; -} -``` - -```json -{ - "output": "function a() {\nvar b; //comment\n\nreturn;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; -/* comment */ return; -} -``` - -```json -{ - "output": "function a() {\nvar b;\n\n/* comment */ return;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; -//comment -/* comment */ return; -} -``` - -```json -{ - "output": "function a() {\nvar b;\n\n//comment\n/* comment */ return;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; /* comment */ return; -} -``` - -```json -{ - "output": "function a() {\nvar b; /* comment */\n\n return;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; /* comment */ -return; -} -``` - -```json -{ - "output": "function a() {\nvar b; /* comment */\n\nreturn;\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; -return; //comment -} -``` - -```json -{ - "output": "function a() {\nvar b;\n\nreturn; //comment\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function a() { -var b; return; //comment -} -``` - -```json -{ - "output": "function a() {\nvar b;\n\n return; //comment\n}", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "return" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(true){} - -var a = 2; -``` - -```json -{ - "output": "if(true){}\nvar a = 2;", - "options": [ - { - "blankLine": "never", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(true){ -if(true) {} - -var a = 2;} -``` - -```json -{ - "output": "if(true){\nif(true) {}\nvar a = 2;}", - "options": [ - { - "blankLine": "never", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -(function(){ -})() - -var a = 2; -``` - -```json -{ - "output": "(function(){\n})()\nvar a = 2;", - "options": [ - { - "blankLine": "never", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -+(function(){ -})() - -var a = 2; -``` - -```json -{ - "output": "+(function(){\n})()\nvar a = 2;", - "options": [ - { - "blankLine": "never", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a = function() {}; - -var b = 2; -``` - -```json -{ - "output": "var a = function() {};\nvar b = 2;", - "options": [ - { - "blankLine": "never", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a = 2; - -module.exports = a; -``` - -```json -{ - "output": "var a = 2;\nmodule.exports = a;", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": "cjs-export" - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() { var a; - -return; } -``` - -```json -{ - "output": "function x() { var a;\nreturn; }", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() { var a = true; - -if (a) { a = !a; }; } -``` - -```json -{ - "output": "function x() { var a = true;\nif (a) { a = !a; }; }", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() { var a = true; - -for (var i = 0; i < 10; i++) { a = !a; }; } -``` - -```json -{ - "output": "function x() { var a = true;\nfor (var i = 0; i < 10; i++) { a = !a; }; }", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() { var y = true; - -switch ("Oranges") { case "Oranges": y = !y; - -break; - -case "Apples": y = !y; - -break; default: y = !y; } } -``` - -```json -{ - "output": "function x() { var y = true;\nswitch (\"Oranges\") { case \"Oranges\": y = !y;\nbreak;\ncase \"Apples\": y = !y;\nbreak; default: y = !y; } }", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - }, - { - "messageId": "unexpectedBlankLine" - }, - { - "messageId": "unexpectedBlankLine" - }, - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 4 errors but had 1: [ - { - ruleId: 'rule-to-test/padding-line-between-statements', - message: 'Unexpected blank line before this statement.', - messageId: 'unexpectedBlankLine', - severity: 1, - nodeType: 'SwitchCase', - line: 7, - column: 0, - endLine: 9, - endColumn: 6, - suggestions: null - } -] - -1 !== 4 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() {try { var a; - -throw 0; } catch (e) { var b = 0; - -throw e; } } -``` - -```json -{ - "output": "function x() {try { var a;\nthrow 0; } catch (e) { var b = 0;\nthrow e; } }", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - }, - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 2 errors but had 0: [] - -0 !== 2 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x(a) { var b = 0; - -if (!a) { return false; }; - -for (var i = 0; i < b; i++) { if (!a[i]) return false; } - -return true; } -``` - -```json -{ - "output": "function x(a) { var b = 0;\nif (!a) { return false; };\nfor (var i = 0; i < b; i++) { if (!a[i]) return false; }\nreturn true; }", - "options": [ - { - "blankLine": "never", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw" - ] - } - ], - "errors": [ - { - "messageId": "unexpectedBlankLine" - }, - { - "messageId": "unexpectedBlankLine" - }, - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 3 errors but had 0: [] - -0 !== 3 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(true){} -var a = 2; -``` - -```json -{ - "output": "if(true){}\n\nvar a = 2;", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a = function() { -}; -var b = 2; -``` - -```json -{ - "output": "var a = function() {\n};\n\nvar b = 2;", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -if(true){ -if(true) {} -var a = 2;} -``` - -```json -{ - "output": "if(true){\nif(true) {}\n\nvar a = 2;}", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -(function(){ -})() -var a = 2; -``` - -```json -{ - "output": "(function(){\n})()\n\nvar a = 2;", - "options": [ - { - "blankLine": "always", - "prev": "block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a = function() { -}; -var b = 2; -``` - -```json -{ - "output": "var a = function() {\n};\n\nvar b = 2;", - "options": [ - { - "blankLine": "always", - "prev": "multiline-block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -(function(){ -})() -var a = 2; -``` - -```json -{ - "output": "(function(){\n})()\n\nvar a = 2;", - "options": [ - { - "blankLine": "always", - "prev": "multiline-block-like", - "next": "*" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -var a = 2; -module.exports = a; -``` - -```json -{ - "output": "var a = 2;\n\nmodule.exports = a;", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": "cjs-export" - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() { var a; return; } -``` - -```json -{ - "output": "function x() { var a;\n\n return; }", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw", - "while", - "default" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() { var a = true; for (var i = 0; i < 10; i++) { a = !a; }; } -``` - -```json -{ - "output": "function x() { var a = true;\n\n for (var i = 0; i < 10; i++) { a = !a; }; }", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw", - "while", - "default" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() { var y = true; switch ("Oranges") { case "Oranges": y = !y; break; case "Apples": y = !y; break; default: y = !y; } } -``` - -```json -{ - "output": "function x() { var y = true;\n\n switch (\"Oranges\") { case \"Oranges\": y = !y;\n\n break;\n\n case \"Apples\": y = !y;\n\n break;\n\n default: y = !y; } }", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw", - "while", - "default" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - }, - { - "messageId": "expectedBlankLine" - }, - { - "messageId": "expectedBlankLine" - }, - { - "messageId": "expectedBlankLine" - }, - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 5 errors but had 2: [ - { - ruleId: 'rule-to-test/padding-line-between-statements', - message: 'Expected blank line before this statement.', - messageId: 'expectedBlankLine', - severity: 1, - nodeType: 'SwitchCase', - line: 1, - column: 81, - endLine: 1, - endColumn: 110, - suggestions: null - }, - { - ruleId: 'rule-to-test/padding-line-between-statements', - message: 'Expected blank line before this statement.', - messageId: 'expectedBlankLine', - severity: 1, - nodeType: 'SwitchCase', - line: 1, - column: 111, - endLine: 1, - endColumn: 127, - suggestions: null - } -] - -2 !== 5 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() { var a = true; while (!a) { a = !a; }; } -``` - -```json -{ - "output": "function x() { var a = true;\n\n while (!a) { a = !a; }; }", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw", - "while", - "default" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x() {try { var a; throw 0; } catch (e) { var b = 0; throw e; } } -``` - -```json -{ - "output": "function x() {try { var a;\n\n throw 0; } catch (e) { var b = 0;\n\n throw e; } }", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw", - "while", - "default" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - }, - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 2 errors but had 0: [] - -0 !== 2 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -function x(a) { var b = 0; if (!a) { return false; }; for (var i = 0; i < b; i++) { if (!a[i]) return false; } return true; } -``` - -```json -{ - "output": "function x(a) { var b = 0;\n\n if (!a) { return false; };\n\n for (var i = 0; i < b; i++) { if (!a[i]) return false; }\n\n return true; }", - "options": [ - { - "blankLine": "always", - "prev": "*", - "next": [ - "if", - "for", - "return", - "switch", - "case", - "break", - "throw", - "while", - "default" - ] - } - ], - "errors": [ - { - "messageId": "expectedBlankLine" - }, - { - "messageId": "expectedBlankLine" - }, - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 3 errors but had 0: [] - -0 !== 3 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { - static { - let x; - foo(); - } - } -``` - -```json -{ - "output": "class C {\n static {\n let x;\n\n foo();\n }\n }", - "options": [ - { - "blankLine": "always", - "prev": "let", - "next": "expression" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { - static { - let x; - - foo(); - } - } -``` - -```json -{ - "output": "class C {\n static {\n let x;\n foo();\n }\n }", - "options": [ - { - "blankLine": "never", - "prev": "let", - "next": "expression" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { - static { - let x; - foo(); - const y = 1; - } - } -``` - -```json -{ - "output": "class C {\n static {\n let x;\n foo();\n\n const y = 1;\n }\n }", - "options": [ - { - "blankLine": "always", - "prev": "expression", - "next": "const" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { - static { - let x; - foo(); - - const y = 1; - } - } -``` - -```json -{ - "output": "class C {\n static {\n let x;\n foo();\n const y = 1;\n }\n }", - "options": [ - { - "blankLine": "never", - "prev": "expression", - "next": "const" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { - static { - let x; - foo(); - const y = 1; - const z = 1; - } - } -``` - -```json -{ - "output": "class C {\n static {\n let x;\n foo();\n\n const y = 1;\n const z = 1;\n }\n }", - "options": [ - { - "blankLine": "always", - "prev": "expression", - "next": "const" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { - static { - let x; - foo(); - - const y = 1; - const z = 1; - } - } -``` - -```json -{ - "output": "class C {\n static {\n let x;\n foo();\n const y = 1;\n const z = 1;\n }\n }", - "options": [ - { - "blankLine": "never", - "prev": "expression", - "next": "const" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "unexpectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { - static { - let a = 0; - bar(); - } - } -``` - -```json -{ - "output": "class C {\n static {\n let a = 0;\n\n bar();\n }\n }", - "options": [ - { - "blankLine": "always", - "prev": [ - "const", - "let", - "var" - ], - "next": "*" - }, - { - "blankLine": "any", - "prev": [ - "const", - "let", - "var" - ], - "next": [ - "const", - "let", - "var" - ] - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { static { let x; { let y; let z; } let q; } } -``` - -```json -{ - "output": "class C { static { let x; { let y;\n\n let z; } let q; } }", - "options": [ - { - "blankLine": "always", - "prev": "let", - "next": "let" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { static { { let x; } let y; let z; } } -``` - -```json -{ - "output": "class C { static { { let x; } let y;\n\n let z; } }", - "options": [ - { - "blankLine": "always", - "prev": "let", - "next": "let" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { static { foo(); if (bar) {} } } -``` - -```json -{ - "output": "class C { static { foo();\n\n if (bar) {} } }", - "options": [ - { - "blankLine": "always", - "prev": "expression", - "next": "block-like" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { static { let x; } } let y; -``` - -```json -{ - "output": "class C { static { let x; } }\n\n let y;", - "options": [ - { - "blankLine": "always", - "prev": "class", - "next": "let" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - -#### padding-line-between-statements > invalid - -```js -class C { static { 'use strict'; let x; } } -``` - -```json -{ - "output": "class C { static { 'use strict';\n\n let x; } }", - "options": [ - { - "blankLine": "always", - "prev": "expression", - "next": "let" - } - ], - "languageOptions": { - "ecmaVersion": 2022 - }, - "errors": [ - { - "messageId": "expectedBlankLine" - } - ] -} -``` - -AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: [] - -0 !== 1 - - at assertErrorCountIsCorrect (apps/oxlint/dist/index.js) - at assertInvalidTestCasePasses (apps/oxlint/dist/index.js) - at runInvalidTestCase (apps/oxlint/dist/index.js) - at apps/oxlint/dist/index.js - - ### `prefer-const` Pass: 134 / 138 (97.1%) diff --git a/apps/oxlint/src-js/generated/type_ids.ts b/apps/oxlint/src-js/generated/type_ids.ts index 42c1333fb18cd..0fa46b5f8fcf1 100644 --- a/apps/oxlint/src-js/generated/type_ids.ts +++ b/apps/oxlint/src-js/generated/type_ids.ts @@ -176,5 +176,34 @@ export const NODE_TYPES_COUNT = 165; /** Count of leaf node types */ export const LEAF_NODE_TYPES_COUNT = 27; +/** Type IDs which match `:statement` selector class */ +export const STATEMENT_NODE_TYPE_IDS = [ + 0, 1, 35, 36, 41, 44, 46, 47, 48, 49, 51, 52, 53, 54, 55, 58, 60, 65, 78, 83, 86, 87, 91, 93, 94, + 111, 114, 119, 124, 131, 140, 142, 153, 159, +]; + +/** Type IDs which match `:declaration` selector class */ +export const DECLARATION_NODE_TYPE_IDS = [ + 41, 47, 48, 49, 55, 60, 91, 111, 114, 119, 124, 131, 140, 142, 153, 159, +]; + +/** + * Type IDs which may match `:pattern` selector class. + * Only *may* match because `Identifier` nodes only match this class if their parent is not a `MetaProperty`. + */ +export const PATTERN_NODE_TYPE_IDS = [ + 2, 6, 8, 28, 29, 30, 31, 32, 33, 34, 37, 39, 42, 43, 56, 57, 62, 66, 67, 68, 70, 71, 72, 73, 79, + 84, 85, 88, 89, 90, 95, 101, 110, 117, 129, 143, 150, 156, +]; + +/** + * Type IDs which may match `:expression` selector class. + * Only *may* match because `Identifier` nodes only match this class if their parent is not a `MetaProperty`. + */ +export const EXPRESSION_NODE_TYPE_IDS = [ + 2, 6, 8, 28, 30, 31, 33, 34, 37, 39, 42, 43, 56, 57, 62, 66, 67, 68, 70, 71, 73, 79, 84, 85, 88, + 89, 90, 95, 101, 110, 117, 129, 143, 150, 156, +]; + /** Type IDs which match `:function` selector class */ export const FUNCTION_NODE_TYPE_IDS = [30, 55, 56]; diff --git a/apps/oxlint/src-js/plugins/selector.ts b/apps/oxlint/src-js/plugins/selector.ts index 4e1de27361f44..630de5bfccde2 100644 --- a/apps/oxlint/src-js/plugins/selector.ts +++ b/apps/oxlint/src-js/plugins/selector.ts @@ -1,18 +1,36 @@ import esquery from "esquery"; import visitorKeys from "../generated/keys.ts"; -import { FUNCTION_NODE_TYPE_IDS, NODE_TYPE_IDS_MAP } from "../generated/type_ids.ts"; +import { + STATEMENT_NODE_TYPE_IDS, + DECLARATION_NODE_TYPE_IDS, + PATTERN_NODE_TYPE_IDS, + EXPRESSION_NODE_TYPE_IDS, + FUNCTION_NODE_TYPE_IDS, + NODE_TYPE_IDS_MAP, +} from "../generated/type_ids.ts"; import { ancestors } from "../generated/walk.js"; -import { debugAssert } from "../utils/asserts.ts"; +import { debugAssert, typeAssertIs } from "../utils/asserts.ts"; import type { ESQueryOptions, Selector as EsquerySelector } from "esquery"; import type { Node as EsqueryNode } from "estree"; import type { Node } from "./types.ts"; import type { VisitFn } from "./visitor.ts"; +import type { Node as ESTreeNode } from "../generated/types.d.ts"; const { matches: esqueryMatches, parse: esqueryParse } = esquery; type NodeTypeId = number; +// These arrays should never be mutated. +// If they are, then `analyzeSelector` has a bug. +if (DEBUG) { + Object.freeze(STATEMENT_NODE_TYPE_IDS); + Object.freeze(DECLARATION_NODE_TYPE_IDS); + Object.freeze(PATTERN_NODE_TYPE_IDS); + Object.freeze(EXPRESSION_NODE_TYPE_IDS); + Object.freeze(FUNCTION_NODE_TYPE_IDS); +} + // Options to call `esquery.matches` with. const ESQUERY_OPTIONS: ESQueryOptions = { nodeTypeKey: "type", @@ -24,6 +42,21 @@ const ESQUERY_OPTIONS: ESQueryOptions = { matchClass: matchesSelectorClass, }; +// This function is copied from ESLint. +// Implementation here is functionally identical to ESLint's, except for a couple of perf optimizations noted below. +// +// TODO: Does TS-ESLint alter this function in any way to handle TS nodes? +// +// IMPORTANT: This function must be kept in sync with `class` case in `analyzeSelector` below, +// which means that it must be kept in sync with `SelectorClassNodeIds::add` +// in `tasks/ast_tools/src/generators/estree_visit.rs`, which generates `STATEMENT_NODE_TYPE_IDS` etc. +// +// ESLint notes that its implementation is copied from ESQuery, and contains ESQuery's license inline. +// ESLint's implementation is identical to ESQuery's original, except for formatting differences. +// ESLint code: https://github.com/eslint/eslint/blob/eafd727a060131f7fc79b2eb5698d8d27683c3a2/lib/languages/js/index.js#L155-L229 +// ESLint license (MIT): https://github.com/eslint/eslint/blob/eafd727a060131f7fc79b2eb5698d8d27683c3a2/LICENSE +// ESQuery code: https://github.com/estools/esquery/blob/6c4f10370606c5a08adfcb5becc8248fb1edad43/esquery.js#L308-L344 +// ESQuery license: https://github.com/estools/esquery/blob/6c4f10370606c5a08adfcb5becc8248fb1edad43/license.txt /** * Check if an AST node matches a selector class. * @param className - Class name parsed from selector @@ -36,15 +69,46 @@ function matchesSelectorClass( node: EsqueryNode, _ancestors: EsqueryNode[], ): boolean { - if (className.toLowerCase() === "function") { - const { type } = node; - return ( - type === "FunctionDeclaration" || - type === "FunctionExpression" || - type === "ArrowFunctionExpression" - ); + // Types don't match exactly. + // All AST nodes have `parent` property (which `EsqueryNode` doesn't). + typeAssertIs(node); + + const { type } = node; + + switch (className.toLowerCase()) { + case "statement": + if (type.endsWith("Statement")) return true; + // fallthrough: interface Declaration <: Statement { } + + case "declaration": + return type.endsWith("Declaration"); + + case "pattern": + if (type.endsWith("Pattern")) return true; + // fallthrough: interface Expression <: Node, Pattern { } + + case "expression": + return ( + type.endsWith("Expression") || + type.endsWith("Literal") || + // ESLint / ESQuery uses `ancestors[0].type` instead of `node.parent.type`. + // `node.parent.type` is faster, but functionally equivalent. + (type === "Identifier" && node.parent.type !== "MetaProperty") || + type === "MetaProperty" + ); + + case "function": + return ( + type === "FunctionDeclaration" || + type === "FunctionExpression" || + type === "ArrowFunctionExpression" + ); + + default: + // Should have been caught already when compiling the selector in `analyzeSelector` + debugAssert(false, `Unknown selector class not caught in \`analyzeSelector\`: ${className}`); + return false; } - return false; } // Specificity is a combination of: @@ -252,12 +316,24 @@ function analyzeSelector( return analyzeSelector(esquerySelector.right, selector); case "class": - // TODO: Should TS function types be included in `FUNCTION_NODE_TYPE_IDS`? - // This TODO comment is from ESLint's implementation. Not sure what it means! - // TODO: Abstract into JSLanguage somehow. - if (esquerySelector.name.toLowerCase() === "function") return FUNCTION_NODE_TYPE_IDS; - selector.isComplex = true; - return null; + switch (esquerySelector.name.toLowerCase()) { + case "statement": + return STATEMENT_NODE_TYPE_IDS; + case "declaration": + return DECLARATION_NODE_TYPE_IDS; + case "pattern": + // Complex because `Identifier` nodes don't match this class if their parent is a `MetaProperty` + selector.isComplex = true; + return PATTERN_NODE_TYPE_IDS; + case "expression": + // Complex because `Identifier` nodes don't match this class if their parent is a `MetaProperty` + selector.isComplex = true; + return EXPRESSION_NODE_TYPE_IDS; + case "function": + return FUNCTION_NODE_TYPE_IDS; + default: + throw new Error(`Invalid class in selector: \`:${esquerySelector.name}\``); + } case "wildcard": return null; diff --git a/apps/oxlint/test/compile_visitor.test.ts b/apps/oxlint/test/compile_visitor.test.ts index f3f7932f7915c..699563812dcad 100644 --- a/apps/oxlint/test/compile_visitor.test.ts +++ b/apps/oxlint/test/compile_visitor.test.ts @@ -9,6 +9,7 @@ import { initCompiledVisitor, } from "../src-js/plugins/visitor.ts"; +import type { Mock } from "vitest"; import type { Node } from "../src-js/plugins/types.ts"; import type { EnterExit, VisitFn } from "../src-js/plugins/visitor.ts"; @@ -567,6 +568,191 @@ describe("compile visitor", () => { expect(exit).toHaveBeenCalledWith(ident); }); + it("class adds visitor function only for node types in those classes", () => { + type ClassName = "statement" | "declaration" | "pattern" | "expression" | "function"; + + const enterStatement = vi.fn(() => {}); + const exitStatement = vi.fn(() => {}); + const enterDeclaration = vi.fn(() => {}); + const exitDeclaration = vi.fn(() => {}); + const enterPattern = vi.fn(() => {}); + const exitPattern = vi.fn(() => {}); + const enterExpression = vi.fn(() => {}); + const exitExpression = vi.fn(() => {}); + const enterFunction = vi.fn(() => {}); + const exitFunction = vi.fn(() => {}); + + // `:pattern` and `:expression` are "complex" selectors. + // Visit fns are wrapped for them. The rest of classes are simple. + const classes = new Map< + ClassName, + { enter: Mock; exit: Mock; isComplex: boolean } + >([ + ["statement", { enter: enterStatement, exit: exitStatement, isComplex: false }], + ["declaration", { enter: enterDeclaration, exit: exitDeclaration, isComplex: false }], + ["pattern", { enter: enterPattern, exit: exitPattern, isComplex: true }], + ["expression", { enter: enterExpression, exit: exitExpression, isComplex: true }], + ["function", { enter: enterFunction, exit: exitFunction, isComplex: false }], + ]); + + function resetSpies() { + for (const { enter, exit } of classes.values()) { + enter.mockClear(); + exit.mockClear(); + } + } + + addVisitorToCompiled({ + ":statement": enterStatement, + ":statement:exit": exitStatement, + ":declaration": enterDeclaration, + ":declaration:exit": exitDeclaration, + ":pattern": enterPattern, + ":pattern:exit": exitPattern, + ":expression": enterExpression, + ":expression:exit": exitExpression, + ":function": enterFunction, + ":function:exit": exitFunction, + }); + + expect(finalizeCompiledVisitor()).toBe(true); + + for (const [typeName, typeId] of NODE_TYPE_IDS_MAP.entries()) { + // Check that compiled visitor is set up correctly + + // Get classes that this node type matches + const classNames: ClassName[] = []; + + if (typeName.endsWith("Statement")) { + classNames.push("statement"); + } else if (typeName.endsWith("Declaration")) { + // Declarations are also statements + classNames.push("declaration", "statement"); + } else if (typeName.endsWith("Pattern")) { + classNames.push("pattern"); + } else if ( + typeName.endsWith("Expression") || + typeName.endsWith("Literal") || + typeName === "Identifier" || + typeName === "MetaProperty" + ) { + // Expressions are also patterns + classNames.push("expression", "pattern"); + } + + if ( + ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"].includes( + typeName, + ) + ) { + classNames.push("function"); + } + + const visit = compiledVisitor[typeId]; + + // If no classes match this node type, then visitor should be `null` + if (classNames.length === 0) { + expect(visit).toBeNull(); + continue; + } + + // Check the compiler visitor for this type is what it should be. + // Check that visit fns have/have not been wrapped/merged, depending on the class. + if ( + classNames.length === 1 && // Type is only matched by 1 class + typeId >= LEAF_NODE_TYPES_COUNT && // Non leaf node + !classes.get(classNames[0])!.isComplex // Class is not complex + ) { + const enterExit = visit as EnterExit; + const { enter, exit } = classes.get(classNames[0])!; + expect(enterExit.enter).toBe(enter); + expect(enterExit.exit).toBe(exit); + } else { + expect(visit).not.toBeNull(); + + // Check visit fn has been wrapped/merged + if (typeId < LEAF_NODE_TYPES_COUNT) { + // Leaf node + expect(typeof visit).toBe("function"); + + for (const { enter, exit } of classes.values()) { + expect(visit).not.toBe(enter); + expect(visit).not.toBe(exit); + } + } else { + // Non-leaf node + expect(typeof visit).toBe("object"); + + const enterExit = visit as EnterExit; + expect(typeof enterExit.enter).toBe("function"); + expect(typeof enterExit.exit).toBe("function"); + + for (const { enter, exit } of classes.values()) { + expect(enterExit.enter).not.toBe(enter); + expect(enterExit.enter).not.toBe(exit); + expect(enterExit.exit).not.toBe(enter); + expect(enterExit.exit).not.toBe(exit); + } + } + } + + // Check that correct functions are called when visiting a node of this type + const node = { + type: typeName, + parent: { type: "Program", ...SPAN }, + ...SPAN, + }; + + if (typeId < LEAF_NODE_TYPES_COUNT) { + // Leaf node + (visit as VisitFn)(node); + + for (const [className, { enter, exit }] of classes.entries()) { + if (classNames.includes(className)) { + expect(enter).toHaveBeenCalledWith(node); + expect(exit).toHaveBeenCalledWith(node); + } else { + expect(enter).not.toHaveBeenCalled(); + expect(exit).not.toHaveBeenCalled(); + } + } + + resetSpies(); + } else { + // Non-leaf node + const enterExit = visit as EnterExit; + + // Test enter + enterExit.enter!(node); + + for (const [className, { enter, exit }] of classes.entries()) { + if (classNames.includes(className)) { + expect(enter).toHaveBeenCalledWith(node); + } else { + expect(enter).not.toHaveBeenCalled(); + } + expect(exit).not.toHaveBeenCalled(); + } + + resetSpies(); + + // Test exit + enterExit.exit!(node); + + for (const [className, { enter, exit }] of classes.entries()) { + expect(enter).not.toHaveBeenCalled(); + if (classNames.includes(className)) { + expect(exit).toHaveBeenCalledWith(node); + } else { + expect(exit).not.toHaveBeenCalled(); + } + } + + resetSpies(); + } + } + }); + it("combined", () => { const enter1 = vi.fn(() => {}); const exit1 = vi.fn(() => {}); diff --git a/apps/oxlint/test/fixtures/selector/files/index.js b/apps/oxlint/test/fixtures/selector/files/index.js index 04a40909fec39..84a1bc2208595 100644 --- a/apps/oxlint/test/fixtures/selector/files/index.js +++ b/apps/oxlint/test/fixtures/selector/files/index.js @@ -3,4 +3,6 @@ const obj = { a: [b, c], ...d }; function foo() {} function bar() {} -() => {}; +({ e: f }) => {}; + +import.meta; diff --git a/apps/oxlint/test/fixtures/selector/output.snap.md b/apps/oxlint/test/fixtures/selector/output.snap.md index 0af53996de188..e1733835fa322 100644 --- a/apps/oxlint/test/fixtures/selector/output.snap.md +++ b/apps/oxlint/test/fixtures/selector/output.snap.md @@ -7,18 +7,26 @@ | *: Program | :not(Identifier): Program | *: VariableDeclaration + | :Declaration: VariableDeclaration + | :statement: VariableDeclaration | :not(Identifier): VariableDeclaration | *: VariableDeclarator | :not(Identifier): VariableDeclarator | *: Identifier(obj) + | :expression: Identifier(obj) + | :paTTern: Identifier(obj) | Identifier: Identifier(obj) | :matches(Identifier, FunctionDeclaration): Identifier(obj) | *:exit: Identifier(obj) | *: ObjectExpression + | :expression: ObjectExpression + | :paTTern: ObjectExpression | :not(Identifier): ObjectExpression | *: Property | :not(Identifier): Property | *: Identifier(a) + | :expression: Identifier(a) + | :paTTern: Identifier(a) | Identifier: Identifier(a) | :matches(Identifier, FunctionDeclaration): Identifier(a) | ObjectExpression Identifier: Identifier(a) @@ -29,9 +37,13 @@ | :matches(Identifier[name=a], FunctionDeclaration[id.name=foo]): Identifier(a) | *:exit: Identifier(a) | *: ArrayExpression + | :expression: ArrayExpression + | :paTTern: ArrayExpression | :not(Identifier): ArrayExpression | ObjectExpression ArrayExpression: ArrayExpression | *: Identifier(b) + | :expression: Identifier(b) + | :paTTern: Identifier(b) | Identifier: Identifier(b) | :matches(Identifier, FunctionDeclaration): Identifier(b) | ArrayExpression > Identifier: Identifier(b) @@ -41,6 +53,8 @@ | ArrayExpression Identifier[name=b]: Identifier(b) | *:exit: Identifier(b) | *: Identifier(c) + | :expression: Identifier(c) + | :paTTern: Identifier(c) | Identifier: Identifier(c) | :matches(Identifier, FunctionDeclaration): Identifier(c) | ArrayExpression > Identifier: Identifier(c) @@ -58,6 +72,8 @@ | Property ~ [type]: SpreadElement | :matches(ObjectExpression > SpreadElement, FunctionDeclaration[id.name=bar]): SpreadElement | *: Identifier(d) + | :expression: Identifier(d) + | :paTTern: Identifier(d) | Identifier: Identifier(d) | :matches(Identifier, FunctionDeclaration): Identifier(d) | ObjectExpression Identifier: Identifier(d) @@ -68,7 +84,9 @@ | *:exit: VariableDeclarator | *:exit: VariableDeclaration | *: FunctionDeclaration(foo) + | :Declaration: FunctionDeclaration(foo) | :FUNCTION: FunctionDeclaration(foo) + | :statement: FunctionDeclaration(foo) | :not(Identifier): FunctionDeclaration(foo) | :matches(Identifier, FunctionDeclaration): FunctionDeclaration(foo) | Program > FunctionDeclaration: FunctionDeclaration(foo) @@ -77,16 +95,21 @@ | :matches(ObjectExpression > SpreadElement, FunctionDeclaration): FunctionDeclaration(foo) | :matches(Identifier[name=a], FunctionDeclaration[id.name=foo]): FunctionDeclaration(foo) | *: Identifier(foo) + | :expression: Identifier(foo) + | :paTTern: Identifier(foo) | :function > Identifier: Identifier(foo) | Identifier: Identifier(foo) | :matches(Identifier, FunctionDeclaration): Identifier(foo) | *:exit: Identifier(foo) | *: BlockStatement + | :statement: BlockStatement | :not(Identifier): BlockStatement | *:exit: BlockStatement | *:exit: FunctionDeclaration(foo) | *: FunctionDeclaration(bar) + | :Declaration: FunctionDeclaration(bar) | :FUNCTION: FunctionDeclaration(bar) + | :statement: FunctionDeclaration(bar) | :not(Identifier): FunctionDeclaration(bar) | :matches(Identifier, FunctionDeclaration): FunctionDeclaration(bar) | Program > FunctionDeclaration: FunctionDeclaration(bar) @@ -94,24 +117,69 @@ | :matches(ObjectExpression > SpreadElement, FunctionDeclaration): FunctionDeclaration(bar) | :matches(ObjectExpression > SpreadElement, FunctionDeclaration[id.name=bar]): FunctionDeclaration(bar) | *: Identifier(bar) + | :expression: Identifier(bar) + | :paTTern: Identifier(bar) | :function > Identifier: Identifier(bar) | Identifier: Identifier(bar) | :matches(Identifier, FunctionDeclaration): Identifier(bar) | *:exit: Identifier(bar) | *: BlockStatement + | :statement: BlockStatement | :not(Identifier): BlockStatement | *:exit: BlockStatement | *:exit: FunctionDeclaration(bar) | *: ExpressionStatement + | :statement: ExpressionStatement | :not(Identifier): ExpressionStatement | *: ArrowFunctionExpression | :FUNCTION: ArrowFunctionExpression + | :expression: ArrowFunctionExpression + | :paTTern: ArrowFunctionExpression | :not(Identifier): ArrowFunctionExpression + | *: ObjectPattern + | :paTTern: ObjectPattern + | :not(Identifier): ObjectPattern + | *: Property + | :not(Identifier): Property + | *: Identifier(e) + | :expression: Identifier(e) + | :paTTern: Identifier(e) + | Identifier: Identifier(e) + | :matches(Identifier, FunctionDeclaration): Identifier(e) + | Property > Identifier: Identifier(e) + | *:exit: Identifier(e) + | *: Identifier(f) + | :expression: Identifier(f) + | :paTTern: Identifier(f) + | Identifier: Identifier(f) + | :matches(Identifier, FunctionDeclaration): Identifier(f) + | Property > Identifier: Identifier(f) + | *:exit: Identifier(f) + | *:exit: Property + | *:exit: ObjectPattern | *: BlockStatement + | :statement: BlockStatement | :not(Identifier): BlockStatement | *:exit: BlockStatement | *:exit: ArrowFunctionExpression | *:exit: ExpressionStatement + | *: ExpressionStatement + | :statement: ExpressionStatement + | :not(Identifier): ExpressionStatement + | *: MetaProperty + | :expression: MetaProperty + | :paTTern: MetaProperty + | :not(Identifier): MetaProperty + | *: Identifier(import) + | Identifier: Identifier(import) + | :matches(Identifier, FunctionDeclaration): Identifier(import) + | *:exit: Identifier(import) + | *: Identifier(meta) + | Identifier: Identifier(meta) + | :matches(Identifier, FunctionDeclaration): Identifier(meta) + | *:exit: Identifier(meta) + | *:exit: MetaProperty + | *:exit: ExpressionStatement | *:exit: Program ,-[files/index.js:1:1] 1 | ,-> const obj = { a: [b, c], ...d }; @@ -119,7 +187,9 @@ 3 | | function foo() {} 4 | | function bar() {} 5 | | - 6 | `-> () => {}; + 6 | | ({ e: f }) => {}; + 7 | | + 8 | `-> import.meta; `---- Found 0 warnings and 1 error. diff --git a/apps/oxlint/test/fixtures/selector/plugin.ts b/apps/oxlint/test/fixtures/selector/plugin.ts index 6745afe73f594..2b0af659ab1c8 100644 --- a/apps/oxlint/test/fixtures/selector/plugin.ts +++ b/apps/oxlint/test/fixtures/selector/plugin.ts @@ -21,6 +21,10 @@ const plugin: Plugin = { // :not ":not(Identifier)", // class + ":statement", + ":Declaration", + ":paTTern", + ":expression", ":FUNCTION", ":function > Identifier", // Child diff --git a/tasks/ast_tools/src/generators/estree_visit.rs b/tasks/ast_tools/src/generators/estree_visit.rs index 626d15ec0ce16..7b14ae60825e2 100644 --- a/tasks/ast_tools/src/generators/estree_visit.rs +++ b/tasks/ast_tools/src/generators/estree_visit.rs @@ -33,10 +33,6 @@ impl Display for NodeId { } } -/// Names of ESTree function types. -const FUNCTION_TYPE_NAMES: &[&str] = - &["ArrowFunctionExpression", "FunctionDeclaration", "FunctionExpression"]; - pub struct ESTreeVisitGenerator; define_generator!(ESTreeVisitGenerator); @@ -254,7 +250,9 @@ fn generate(codegen: &Codegen) -> Codes { let mut visitor_type = string!(""); let mut leaf_nodes_count = None; - let mut function_node_ids = vec![]; + + let mut selector_classes = SelectorClasses::new(); + for (node_id, node) in nodes.iter_enumerated() { let is_leaf = node.keys.is_empty(); if leaf_nodes_count.is_none() && !is_leaf { @@ -325,9 +323,7 @@ fn generate(codegen: &Codegen) -> Codes { write_it!(type_ids_map, "[\"{node_name}\", {node_id}],\n"); - if FUNCTION_TYPE_NAMES.contains(&node_name) { - function_node_ids.push(node_id); - } + selector_classes.add(node_name, node_id); // Convert ESTree type name to Oxc type names where they diverge let type_names: Option<&[&str]> = match node_name { @@ -431,7 +427,14 @@ fn generate(codegen: &Codegen) -> Codes { "); let nodes_count = nodes.len(); - function_node_ids.sort_unstable(); + + let ( + statement_node_ids, + declaration_node_ids, + pattern_node_ids, + expression_node_ids, + function_node_ids, + ) = selector_classes.into_vecs(); #[rustfmt::skip] write_it!(type_ids_map, " @@ -445,6 +448,24 @@ fn generate(codegen: &Codegen) -> Codes { /* IF LINTER */ + /** Type IDs which match `:statement` selector class */ + export const STATEMENT_NODE_TYPE_IDS = {statement_node_ids:?}; + + /** Type IDs which match `:declaration` selector class */ + export const DECLARATION_NODE_TYPE_IDS = {declaration_node_ids:?}; + + /** + * Type IDs which may match `:pattern` selector class. + * Only *may* match because `Identifier` nodes only match this class if their parent is not a `MetaProperty`. + */ + export const PATTERN_NODE_TYPE_IDS = {pattern_node_ids:?}; + + /** + * Type IDs which may match `:expression` selector class. + * Only *may* match because `Identifier` nodes only match this class if their parent is not a `MetaProperty`. + */ + export const EXPRESSION_NODE_TYPE_IDS = {expression_node_ids:?}; + /** Type IDs which match `:function` selector class */ export const FUNCTION_NODE_TYPE_IDS = {function_node_ids:?}; @@ -521,3 +542,75 @@ fn generate(codegen: &Codegen) -> Codes { visitor_type_oxlint, } } + +/// Node IDs which are matched by selector classes. +/// e.g. `FunctionDeclaration` is matched by `:function` selector class. +struct SelectorClasses { + statement: Vec, + declaration: Vec, + pattern: Vec, + expression: Vec, + function: Vec, +} + +impl SelectorClasses { + fn new() -> Self { + Self { + statement: vec![], + declaration: vec![], + pattern: vec![], + expression: vec![], + function: vec![], + } + } + + /// If AST node name matches 1 or more selector classes, add its node type ID to lists for those classes. + /// + /// The method replicates the logic in `matchesSelectorClass` in `apps/oxlint/src-js/plugins/selector.ts`. + /// Must be kept in sync. + fn add(&mut self, node_name: &str, node_id: NodeId) { + // Function types are also declarations / expressions / patterns + if matches!( + node_name, + "FunctionDeclaration" | "FunctionExpression" | "ArrowFunctionExpression" + ) { + self.function.push(node_id); + } + + match node_name { + _ if node_name.ends_with("Statement") => self.statement.push(node_id), + _ if node_name.ends_with("Declaration") => { + self.declaration.push(node_id); + // Declarations are also statements + self.statement.push(node_id); + } + _ if node_name.ends_with("Pattern") => self.pattern.push(node_id), + _ if node_name.ends_with("Expression") + || node_name.ends_with("Literal") + || node_name == "Identifier" + || node_name == "MetaProperty" => + { + // `Identifier` nodes are only members of these classes if their `parent` is not a `MetaProperty`. + // That is handled in `analyzeSelector` in `apps/oxlint/src-js/plugins/selector.ts`. + self.expression.push(node_id); + // Expressions are also patterns + self.pattern.push(node_id); + } + _ => {} + } + } + + fn sort(&mut self) { + self.statement.sort_unstable(); + self.declaration.sort_unstable(); + self.pattern.sort_unstable(); + self.expression.sort_unstable(); + self.function.sort_unstable(); + } + + #[expect(clippy::type_complexity)] + fn into_vecs(mut self) -> (Vec, Vec, Vec, Vec, Vec) { + self.sort(); + (self.statement, self.declaration, self.pattern, self.expression, self.function) + } +}