@silvermine/eslint-plugin-silvermine
Advanced tools
Comparing version 2.0.0-preview.1 to 2.0.0
@@ -5,3 +5,11 @@ { | ||
}, | ||
"extends": "@silvermine/eslint-config/node" | ||
"extends": "@silvermine/eslint-config/node", | ||
"rules": { | ||
"prefer-template": "off", | ||
"padding-line-between-statements": [ | ||
"error", | ||
{ "blankLine": "any", "prev": [ "*" ], "next": "return" } | ||
] | ||
} | ||
} |
{ | ||
"name": "@silvermine/eslint-plugin-silvermine", | ||
"version": "2.0.0-preview.1", | ||
"version": "2.0.0", | ||
"description": "eslint plugins to support our JS Code Standards. See @silvermine/eslint-config-silvermine", | ||
@@ -26,3 +26,3 @@ "scripts": { | ||
"dependencies": { | ||
"@silvermine/eslint-config": "1.5.0", | ||
"@silvermine/eslint-config": "2.0.0-preview.2", | ||
"class.extend": "0.9.2", | ||
@@ -37,3 +37,3 @@ "lodash.assign": "4.2.0", | ||
"coveralls": "3.0.2", | ||
"eslint": "4.19.1", | ||
"eslint": "5.10.0", | ||
"grunt": "1.0.3", | ||
@@ -40,0 +40,0 @@ "grunt-cli": "1.2.0", |
@@ -12,6 +12,6 @@ /** | ||
formatCode = require('../../code-helper'), | ||
RuleTester = require('eslint').RuleTester, | ||
ruleTester = new RuleTester(), | ||
validExample, switchTest, constExample, | ||
invalidExample, invalidExample2, invalidExample3, constInvalid; | ||
ruleTester = require('../../ruleTesters').es6(), | ||
validExample, varOnlyExample, switchTest, constExample, flatTernaryValid, | ||
invalidExample, invalidExample2, invalidExample3, constInvalid, | ||
classInvalid; | ||
@@ -38,2 +38,3 @@ validExample = formatCode( | ||
'', | ||
' // This comment should be indented with the if statement', | ||
' if (noInit) {', | ||
@@ -43,5 +44,60 @@ ' var a = 1,', | ||
' }', | ||
'}' | ||
'}', | ||
'', | ||
'class MyClass {', | ||
' /**', | ||
' * This should be indented with the function.', | ||
' *', | ||
' * @param {number} num base number to add', | ||
' */', | ||
' constructor(num) {', | ||
' this.a = num;', | ||
' }', | ||
'', | ||
' add(b) {', | ||
' return this.a + b;', | ||
' }', | ||
'}', | ||
'', | ||
'const myClass = new MyClass();', | ||
'', | ||
'for (let i = 1; i < 10; i++) {', | ||
' console.log(i);', | ||
'}', | ||
'', | ||
'myFunc().then((var1) => {', | ||
' return doSomething(var1);', | ||
'});', | ||
'', | ||
'myFunc(', | ||
' myClass,', | ||
' a,', | ||
' b,', | ||
' c', | ||
');', | ||
'', | ||
'try {', | ||
' myFunc();', | ||
'} catch (err) {', | ||
' console.error(err);', | ||
'}', | ||
'', | ||
'(function() {', | ||
' doSomethingNow();', | ||
'})();' | ||
); | ||
varOnlyExample = formatCode( | ||
'var a = 1,', | ||
' b = 2,', | ||
' c = 3;' | ||
); | ||
flatTernaryValid = formatCode( | ||
'var a =', | ||
' foo > 0 ? bar :', | ||
' foo < 0 ? baz :', | ||
' qiz;' | ||
); | ||
invalidExample = formatCode( | ||
@@ -53,3 +109,13 @@ 'function test() {', | ||
' return a + b;', | ||
'}' | ||
'}', | ||
'', | ||
'myFunc(', | ||
'myClass,', | ||
'a', | ||
');', | ||
'', | ||
'var foo = {', | ||
' bar: 1,', | ||
' baz: 2,', | ||
'};' | ||
); | ||
@@ -83,3 +149,10 @@ | ||
'const A = 1,', | ||
' B = 2;' | ||
' B = 2;', | ||
'', | ||
'const myArr = [', | ||
' {', | ||
' a: 1,', | ||
' b: 2,', | ||
' },', | ||
'];' | ||
); | ||
@@ -95,2 +168,14 @@ | ||
classInvalid = formatCode( | ||
'class MyClass {', | ||
'constructor(num) {', | ||
' this.a = num;', | ||
'}', | ||
'', | ||
'add(b) {', | ||
' return this.a + b;', | ||
'}', | ||
'}' | ||
); | ||
// ------------------------------------------------------------------------------ | ||
@@ -115,2 +200,10 @@ // Tests | ||
}, | ||
{ | ||
code: varOnlyExample, | ||
options: [ 3, { 'VariableDeclaratorOffset': 1 } ], | ||
}, | ||
{ | ||
code: flatTernaryValid, | ||
options: [ 3, { 'flatTernaryExpressions': true } ], | ||
}, | ||
], | ||
@@ -123,5 +216,17 @@ | ||
{ | ||
message: 'Expected indentation of 7 space characters but found 6.', | ||
type: 'VariableDeclarator', | ||
message: 'Expected indentation of 7 spaces but found 6.', | ||
type: 'Identifier', | ||
}, | ||
{ | ||
message: 'Expected indentation of 3 spaces but found 0.', | ||
type: 'Identifier', | ||
}, | ||
{ | ||
message: 'Expected indentation of 3 spaces but found 0.', | ||
type: 'Identifier', | ||
}, | ||
{ | ||
message: 'Expected indentation of 3 spaces but found 2.', | ||
type: 'Identifier', | ||
}, | ||
], | ||
@@ -134,4 +239,4 @@ options: [ 3, { 'VariableDeclaratorOffset': { 'var': 1, 'let': 1, 'const': 3 }, 'SwitchCase': 1 } ], | ||
{ | ||
message: 'Expected indentation of 3 space characters but found 2.', | ||
type: 'ExpressionStatement', | ||
message: 'Expected indentation of 3 spaces but found 2.', | ||
type: 'Identifier', | ||
}, | ||
@@ -145,4 +250,4 @@ ], | ||
{ | ||
message: 'Expected indentation of 3 space characters but found 0.', | ||
type: 'ExpressionStatement', | ||
message: 'Expected indentation of 3 spaces but found 0.', | ||
type: 'Identifier', | ||
}, | ||
@@ -156,16 +261,16 @@ ], | ||
{ | ||
message: 'Expected indentation of 0 space characters but found 3.', | ||
type: 'SwitchCase', | ||
message: 'Expected indentation of 0 spaces but found 3.', | ||
type: 'Keyword', | ||
}, | ||
{ | ||
message: 'Expected indentation of 3 space characters but found 6.', | ||
type: 'BreakStatement', | ||
message: 'Expected indentation of 3 spaces but found 6.', | ||
type: 'Keyword', | ||
}, | ||
{ | ||
message: 'Expected indentation of 0 space characters but found 3.', | ||
type: 'SwitchCase', | ||
message: 'Expected indentation of 0 spaces but found 3.', | ||
type: 'Keyword', | ||
}, | ||
{ | ||
message: 'Expected indentation of 3 space characters but found 6.', | ||
type: 'ExpressionStatement', | ||
message: 'Expected indentation of 3 spaces but found 6.', | ||
type: 'Identifier', | ||
}, | ||
@@ -179,8 +284,8 @@ ], | ||
{ | ||
message: 'Expected indentation of 6 space characters but found 3.', | ||
type: 'VariableDeclarator', | ||
message: 'Expected indentation of 6 spaces but found 3.', | ||
type: 'Identifier', | ||
}, | ||
{ | ||
message: 'Expected indentation of 6 space characters but found 4.', | ||
type: 'VariableDeclarator', | ||
message: 'Expected indentation of 6 spaces but found 4.', | ||
type: 'Identifier', | ||
}, | ||
@@ -191,3 +296,34 @@ ], | ||
}, | ||
{ | ||
code: classInvalid, | ||
errors: [ | ||
{ | ||
message: 'Expected indentation of 3 spaces but found 0.', | ||
type: 'Identifier', | ||
}, | ||
{ | ||
message: 'Expected indentation of 6 spaces but found 3.', | ||
type: 'Keyword', | ||
}, | ||
{ | ||
message: 'Expected indentation of 3 spaces but found 0.', | ||
type: 'Punctuator', | ||
}, | ||
{ | ||
message: 'Expected indentation of 3 spaces but found 0.', | ||
type: 'Identifier', | ||
}, | ||
{ | ||
message: 'Expected indentation of 6 spaces but found 3.', | ||
type: 'Keyword', | ||
}, | ||
{ | ||
message: 'Expected indentation of 3 spaces but found 0.', | ||
type: 'Punctuator', | ||
}, | ||
], | ||
options: [ 3, { 'VariableDeclaratorOffset': { 'var': 1, 'let': 1, 'const': 3 }, 'SwitchCase': 1 } ], | ||
parserOptions: { ecmaVersion: 6 }, | ||
}, | ||
], | ||
}); |
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
148968
3958
0
0
+ Added@silvermine/eslint-config@2.0.0-preview.2(transitive)
+ Addedeslint-plugin-typescript@0.14.0(transitive)
+ Addedlodash.unescape@4.0.1(transitive)
+ Addedrequireindex@1.1.0(transitive)
+ Addedsemver@5.5.0(transitive)
+ Addedtypescript@3.0.3(transitive)
+ Addedtypescript-eslint-parser@17.0.1(transitive)
- Removed@silvermine/eslint-config@1.5.0(transitive)
- Removed@silvermine/eslint-plugin-silvermine@1.2.1(transitive)