Skip to content

Commit

Permalink
chore(no-duplicate-hooks): migrate to TS (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored and SimenB committed Jul 22, 2019
1 parent 384b788 commit 41ed53a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
@@ -1,7 +1,7 @@
import { RuleTester } from 'eslint';
import { TSESLint } from '@typescript-eslint/experimental-utils';
import rule from '../no-duplicate-hooks';

const ruleTester = new RuleTester({
const ruleTester = new TSESLint.RuleTester({
parserOptions: {
ecmaVersion: 6,
},
Expand Down
@@ -1,4 +1,4 @@
import { getDocsUrl, isDescribe, isHook } from './util';
import { createRule, isDescribe, isHook } from './tsUtils';

const newHookContext = () => ({
beforeAll: 0,
Expand All @@ -7,15 +7,21 @@ const newHookContext = () => ({
afterEach: 0,
});

export default {
export default createRule({
name: __filename,
meta: {
docs: {
url: getDocsUrl(__filename),
category: 'Best Practices',
description: 'Disallow duplicate setup and teardown hooks',
recommended: false,
},
messages: {
noDuplicateHook: 'Duplicate {{hook}} in describe block',
},
schema: [],
type: 'suggestion',
},
defaultOptions: [],
create(context) {
const hookContexts = [newHookContext()];
return {
Expand Down Expand Up @@ -43,4 +49,4 @@ export default {
},
};
},
};
});

0 comments on commit 41ed53a

Please sign in to comment.