@silvermine/eslint-plugin-silvermine
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -10,3 +10,3 @@ 'use strict'; | ||
eslint: { | ||
target: [ 'lib/**/*.js', 'tests/**/*.js', '!**/*.valid.js', '!**/*.invalid.js' ], | ||
target: [ '*.js', 'lib/**/*.js', 'tests/**/*.js', '!**/*.valid.js', '!**/*.invalid.js' ], | ||
}, | ||
@@ -13,0 +13,0 @@ |
@@ -13,2 +13,6 @@ /** | ||
'SwitchCase': function(node) { | ||
if (node.consequent.length === 0) { | ||
return; | ||
} | ||
if (node.consequent[0].type !== 'BlockStatement') { | ||
@@ -15,0 +19,0 @@ context.report({ |
{ | ||
"name": "@silvermine/eslint-plugin-silvermine", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "eslint plugins to support our JS Code Standards. See @silvermine/eslint-config-silvermine", | ||
@@ -35,4 +35,7 @@ "scripts": { | ||
"devDependencies": { | ||
"@silvermine/eslint-config": "2.0.0-preview.2", | ||
"@commitlint/cli": "7.5.2", | ||
"@commitlint/travis-cli": "7.5.2", | ||
"@silvermine/eslint-config": "2.2.0", | ||
"coveralls": "3.0.2", | ||
"cz-conventional-changelog": "2.1.0", | ||
"eslint": "5.11.1", | ||
@@ -44,5 +47,11 @@ "grunt": "1.0.3", | ||
"mocha": "5.2.0", | ||
"standard-version": "git+https://github.com/jthomerson/standard-version.git#fix-305-header-repeat", | ||
"typescript": "3.0.3", | ||
"typescript-eslint-parser": "21.0.1" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
} | ||
} |
@@ -1,3 +0,5 @@ | ||
# Silvermine ESLint plugin | ||
# Silvermine ESLint Plugin | ||
[![NPM Version](https://img.shields.io/npm/v/@silvermine/eslint-plugin-silvermine.svg)](https://www.npmjs.com/package/@silvermine/eslint-plugin-silvermine) | ||
[![License](https://img.shields.io/github/license/silvermine/eslint-plugin-silvermine.svg)](./LICENSE) | ||
[![Build Status](https://travis-ci.org/silvermine/eslint-plugin-silvermine.svg?branch=master)](https://travis-ci.org/silvermine/eslint-plugin-silvermine) | ||
@@ -7,3 +9,5 @@ [![Coverage Status](https://coveralls.io/repos/github/silvermine/eslint-plugin-silvermine/badge.svg?branch=master)](https://coveralls.io/github/silvermine/eslint-plugin-silvermine?branch=master) | ||
[![Dev Dependency Status](https://david-dm.org/silvermine/eslint-plugin-silvermine/dev-status.svg)](https://david-dm.org/silvermine/eslint-plugin-silvermine#info=devDependencies&view=table) | ||
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) | ||
## What? | ||
@@ -10,0 +14,0 @@ |
@@ -10,6 +10,6 @@ /** | ||
ruleTester = new RuleTester(), | ||
invalidExample1, invalidExample2, validExample; | ||
invalidExample1, invalidExample2, invalidExample3, validExample1, validExample2; | ||
validExample = formatCode( | ||
validExample1 = formatCode( | ||
'switch (x) {', | ||
@@ -26,2 +26,15 @@ ' case 2: {', | ||
validExample2 = formatCode( | ||
'switch (x) {', | ||
' case 1:', | ||
' case 2: {', | ||
' doSomethingWith2(x);', | ||
' break;', | ||
' }', | ||
' default: {', | ||
' doSomethingWithEverythingElse(x);', | ||
' }', | ||
'}' | ||
); | ||
invalidExample1 = formatCode( | ||
@@ -48,6 +61,18 @@ 'switch (x) {', | ||
invalidExample3 = formatCode( | ||
'switch (x) {', | ||
' case 1:', | ||
' case 2: ', | ||
' doSomethingWith2(x);', | ||
' break;', | ||
' default: {', | ||
' doSomethingWithEverythingElse(x);', | ||
' }', | ||
'}' | ||
); | ||
ruleTester.run('block-scope-case', rule, { | ||
valid: [ | ||
validExample, | ||
validExample1, | ||
validExample2, | ||
], | ||
@@ -78,3 +103,12 @@ | ||
}, | ||
{ | ||
code: invalidExample3, | ||
errors: [ | ||
{ | ||
message: 'Case statements must be block scoped.', | ||
type: 'SwitchCase', | ||
}, | ||
], | ||
}, | ||
], | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
174588
48
4566
91
14