Skip to content

Commit

Permalink
feat(unicorn-test): add test for toggling import-index to off
Browse files Browse the repository at this point in the history
  • Loading branch information
availity-bot committed Jan 29, 2019
1 parent 58c511e commit ddcbadc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions base.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
parser: 'babel-eslint',

extends: ['airbnb-base', 'plugin:promise/recommended', 'plugin:jest/recommended', 'prettier','plugin:unicorn/recommended'],
extends: ['airbnb-base', 'plugin:promise/recommended', 'plugin:jest/recommended', 'plugin:unicorn/recommended', 'prettier'],

plugins: ['promise', 'jest'],
plugins: ['promise', 'jest','unicorn'],

parserOptions: {
sourceType: 'script',
Expand All @@ -20,6 +20,7 @@ module.exports = {
'no-param-reassign': 0,
'arrow-parens': ['error', 'as-needed'],
'class-methods-use-this': 0,
"unicorn/import-index":"off",
'import/no-extraneous-dependencies': 0,
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-underscore-dangle': 0,
Expand Down
5 changes: 2 additions & 3 deletions browser.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const base = require('./base');

module.exports = {
extends: ['airbnb', 'plugin:promise/recommended', 'plugin:jest/recommended', 'prettier', 'prettier/react'],

plugins: ['promise', 'jest', 'promise'],
extends: ['airbnb', 'plugin:promise/recommended', 'plugin:jest/recommended', 'prettier', 'prettier/react','plugin:unicorn/recommended'],

plugins: ['promise', 'jest', 'promise','unicorn'],
parser: 'babel-eslint',

parserOptions: {
Expand Down
6 changes: 6 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function runEslint(str, configuration) {
return linter.executeOnText(str).results[0].messages;
}


describe('rules', () => {
test('base', () => {
expect(isPlainObj(conf)).toBeTruthy();
Expand All @@ -26,12 +27,16 @@ var foo = function foo() {};
foo()
// no-unused-vars
const arr = [
1,
2
];
// unicorn/import-index
const conf = require('./');
// no-param-reassign
function foo(bar) {
bar = 13;
Expand Down Expand Up @@ -72,6 +77,7 @@ const fn = () => {
// Enabled
expect(find(errors, { ruleId: 'no-var' })).toBeDefined();
expect(find(errors, { ruleId: 'no-unused-vars' })).toBeDefined();
expect(find(errors, { ruleId: 'unicorn/import-index'})).toBeUndefined();

// Disabled
expect(find(errors, { ruleId: 'no-param-reassign/sort-comp' })).toBeUndefined();
Expand Down

0 comments on commit ddcbadc

Please sign in to comment.