Skip to content

Commit

Permalink
fix: relax rules. closes #249
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob McGuinness committed Jul 29, 2021
1 parent d1a38c9 commit 3cf3e93
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions base.js
Expand Up @@ -64,6 +64,8 @@ module.exports = {
'unicorn/import-index': 'off',
'unicorn/filename-case': 'off',
'unicorn/empty-brace-spaces': 0,
'unicorn/prefer-node-protocol': 0,
'unicorn/numeric-separators-style': ['error', { onlyIfContainsSeparator: true }],
'unicorn/no-nested-ternary': 0,
'unicorn/prefer-math-trunc': 0,
'unicorn/no-null': 0,
Expand All @@ -76,6 +78,7 @@ module.exports = {
'unicorn/no-array-reduce': 0,
'import/no-extraneous-dependencies': 0,
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
'no-underscore-dangle': 0,
'promise/avoid-new': 0,
'prefer-destructuring': [
Expand Down
10 changes: 5 additions & 5 deletions tests/base.js
Expand Up @@ -3,12 +3,12 @@ module.exports = () => `
var foo = function foo() {};
foo()
const number = 100000; // Pass, this number does not contains separators
// no-unused-vars
const arr = [
1,
2
];
// no-unused-vars ignore siblings
const { ignoredAttribute , ...other } = {};
console.log(other);
// unicorn/import-index
const conf = require('./');
Expand Down
6 changes: 6 additions & 0 deletions tests/test.js
Expand Up @@ -25,12 +25,17 @@ describe('rules', () => {

const errors = runEslint(baseString(), baseConf);

const foundSibling = errors.some(
(element) => element.ruleId === 'no-unused-vars' && element.message.includes('ignoredAttribute')
);

// 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(foundSibling).toBe(false);
expect(find(errors, { ruleId: 'no-param-reassign/sort-comp' })).toBeUndefined();
expect(find(errors, { ruleId: 'prefer-destructuring' })).toBeUndefined();
expect(find(errors, { ruleId: 'class-methods-use-this' })).toBeUndefined();
Expand All @@ -40,6 +45,7 @@ describe('rules', () => {
expect(find(errors, { ruleId: 'unicorn/prefer-includes' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-dom-node-remove' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-dom-node-append' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/numeric-separators-style' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-math-trunc' })).toBeUndefined();
expect(find(errors, { ruleId: 'no-restricted-syntax' })).toBeUndefined();
expect(find(errors, { ruleId: 'global-require' })).toBeUndefined();
Expand Down

0 comments on commit 3cf3e93

Please sign in to comment.