This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #974 from Pajn/extend-semicolon-rule
Extend semicolon rule with a never option
- Loading branch information
Showing
10 changed files
with
221 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"semicolon": [true, "always"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
var x = 3 | ||
~nil [missing semicolon] | ||
a += b | ||
~nil [missing semicolon] | ||
|
||
c = () => { | ||
} | ||
~nil [missing semicolon] | ||
|
||
d = function() { } | ||
~nil [missing semicolon] | ||
|
||
console.log("i am adam, am i?") | ||
~nil [missing semicolon] | ||
|
||
function xyz() { | ||
return | ||
~nil [missing semicolon] | ||
} | ||
|
||
switch(xyz) { | ||
case 1: | ||
break | ||
~nil [missing semicolon] | ||
case 2: | ||
continue | ||
~nil [missing semicolon] | ||
} | ||
|
||
throw new Error("some error") | ||
~nil [missing semicolon] | ||
|
||
do { | ||
var a = 4 | ||
~nil [missing semicolon] | ||
} while(x == 3) | ||
~nil [missing semicolon] | ||
|
||
debugger | ||
~nil [missing semicolon] | ||
|
||
import v = require("i") | ||
~nil [missing semicolon] | ||
module M { | ||
export var x | ||
~nil [missing semicolon] | ||
} | ||
|
||
function useStrictMissingSemicolon() { | ||
"use strict" | ||
~nil [missing semicolon] | ||
return null; | ||
} | ||
|
||
class MyClass { | ||
public name : string | ||
~nil [missing semicolon] | ||
private index : number | ||
~nil [missing semicolon] | ||
private email : string; | ||
} | ||
|
||
interface ITest { | ||
foo?: string | ||
~nil [missing semicolon] | ||
bar: number | ||
~nil [missing semicolon] | ||
baz: boolean; | ||
} | ||
|
||
import {Router} from 'aurelia-router'; | ||
|
||
import {Controller} from 'my-lib' | ||
~nil [missing semicolon] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
var x = 3; | ||
~ [unnecessary semicolon] | ||
a += b; | ||
~ [unnecessary semicolon] | ||
|
||
c = () => { | ||
}; | ||
~ [unnecessary semicolon] | ||
|
||
d = function() { }; | ||
~ [unnecessary semicolon] | ||
|
||
console.log("i am adam, am i?"); | ||
~ [unnecessary semicolon] | ||
|
||
function xyz() { | ||
return; | ||
~ [unnecessary semicolon] | ||
} | ||
|
||
switch(xyz) { | ||
case 1: | ||
break; | ||
~ [unnecessary semicolon] | ||
case 2: | ||
continue; | ||
~ [unnecessary semicolon] | ||
} | ||
|
||
throw new Error("some error"); | ||
~ [unnecessary semicolon] | ||
|
||
do { | ||
var a = 4; | ||
~ [unnecessary semicolon] | ||
} while(x == 3); | ||
~ [unnecessary semicolon] | ||
|
||
debugger; | ||
~ [unnecessary semicolon] | ||
|
||
import v = require("i"); | ||
~ [unnecessary semicolon] | ||
module M { | ||
export var x; | ||
~ [unnecessary semicolon] | ||
} | ||
|
||
function useStrictUnnecessarySemicolon() { | ||
"use strict"; | ||
~ [unnecessary semicolon] | ||
return null | ||
} | ||
|
||
class MyClass { | ||
public name : string; | ||
~ [unnecessary semicolon] | ||
private index : number; | ||
~ [unnecessary semicolon] | ||
private email : string | ||
} | ||
|
||
interface ITest { | ||
foo?: string; | ||
~ [unnecessary semicolon] | ||
bar: number; | ||
~ [unnecessary semicolon] | ||
baz: boolean | ||
} | ||
|
||
import {Router} from 'aurelia-router' | ||
|
||
import {Controller} from 'my-lib'; | ||
~ [unnecessary semicolon] | ||
|
||
// Edge cases when not omitting semicolon needs to be supported | ||
|
||
var a = 1; | ||
("1" + "2").length | ||
|
||
var a = 1; | ||
[].length | ||
|
||
var a = 1; | ||
+"a" | ||
|
||
var a = 1; | ||
-1 | ||
|
||
var a = 1 | ||
;("1" + "2").length | ||
|
||
var a = 1 | ||
;[].length | ||
|
||
var a = 1 | ||
;+"a" | ||
|
||
var a = 1 | ||
;-1 | ||
|
||
// For loops uses semicolons as well so make sure we aren't breaking those | ||
|
||
for (var i = 0; i < 10; ++i) { | ||
// do something | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"semicolon": [true, "never"] | ||
} | ||
} |