Skip to content

Commit

Permalink
feat: use jest plugin
Browse files Browse the repository at this point in the history
Closes: #6
  • Loading branch information
targos committed Dec 22, 2017
1 parent 199ba79 commit 0b517c1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
},
extends: 'eslint:recommended',
plugins: [
'no-only-tests'
'jest'
],
rules: {
// Possible Errors (http://eslint.org/docs/rules/#possible-errors)
Expand Down Expand Up @@ -181,6 +181,14 @@ module.exports = {
'space-infix-ops': ['error', {int32Hint: true}],
'space-unary-ops': 'error',

'no-only-tests/no-only-tests': 'error'
// Jest plugin (https://github.com/jest-community/eslint-plugin-jest)
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/no-large-snapshots': 'off',
'jest/prefer-to-have-length': 'error',
'jest/prefer-to-be-null': 'error',
'jest/prefer-to-be-undefined': 'error',
'jest/valid-expect': 'error'
}
};
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"homepage": "https://github.com/cheminfo/eslint-config#readme",
"peerDependencies": {
"eslint": ">=4.2.0",
"eslint-plugin-no-only-tests": ">=1.1.0"
"eslint-plugin-jest": ">=21.5.0"
},
"devDependencies": {
"eslint": "^4.12.1",
"eslint-plugin-no-only-tests": "^2.0.0"
"eslint-plugin-jest": "^21.5.0"
}
}
7 changes: 5 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ const util = require('util');
const linter = require('eslint').linter;

const config = require('../index');
delete config.plugins;
delete config.rules['no-only-tests/no-only-tests'];
for (const rule of Object.keys(config.rules)) {
if (rule.startsWith('jest/')) {
delete config.rules[rule];
}
}

const ok = fs.readFileSync(__dirname + '/ok.js', 'utf8');
const notOk = fs.readFileSync(__dirname + '/not-ok.js', 'utf8');
Expand Down

0 comments on commit 0b517c1

Please sign in to comment.