Last active
September 1, 2016 06:41
-
-
Save jschaf/8ce46b7363510777f66b7a8eab730b43 to your computer and use it in GitHub Desktop.
test
This file contains hidden or 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
const ERROR = 2; | |
module.exports = { | |
extends: [], | |
parserOptions: { | |
ecmaVersion: 6, | |
sourceType: 'script', | |
}, | |
plugins: [ | |
'no-loops', | |
], | |
ecmaFeatures: { | |
arrowFunctions: true, | |
}, | |
rules: { | |
'no-irregular-whitespace': ERROR, | |
'no-tabs': ERROR, | |
'no-loops/no-loops': ERROR, | |
}, | |
} |
This file contains hidden or 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
{ | |
"name": "my-repo", | |
"version": "0.0.1", | |
"description": "repo test", | |
"main": "index.js", | |
"dependencies": { | |
"eslint-plugin-no-loops": "^0.3.0" | |
}, | |
"devDependencies": { | |
"eslint": "^3.3.1", | |
"mocha": "^3.0.2" | |
}, | |
"peerDependencies": {}, | |
"engines": { | |
"node": ">= 4" | |
}, | |
"scripts": { | |
"test": "mocha test.js" | |
} | |
} |
This file contains hidden or 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
/** | |
* @fileoverview Tests for whitespace characters. | |
*/ | |
const myConfig = require('./index.js'); | |
const emptyRule = { | |
meta: { | |
docs: { | |
description: 'Empty Rule to allow testing the entire config.', | |
category: 'Stylistic Issues', | |
}, | |
schema: [], | |
}, | |
create(context) { return {}; }, | |
}; | |
const RuleTester = require('eslint').RuleTester; | |
RuleTester.setDefaultConfig(myConfig); | |
const ruleTester = new RuleTester(); | |
ruleTester.run('whitespace-characters', emptyRule, { | |
valid: [ | |
'var foo = 2;', | |
'let foo = 2;', | |
'const bar = 3;', | |
], | |
invalid: [ | |
{ | |
code: '\t let foo = 2;', | |
errors: 1, | |
}, | |
], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment