Skip to content

Commit

Permalink
Update create-ava-rule.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus authored Apr 30, 2019
1 parent 5fdfcd5 commit 6e38a7d
Showing 1 changed file with 152 additions and 139 deletions.
291 changes: 152 additions & 139 deletions create-ava-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,166 +4,179 @@ const enhance = require('enhance-visitors');
const deepStrictEqual = require('deep-strict-equal');
const util = require('./util');

const avaImportDeclarationAsts = [{
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportDefaultSpecifier',
local: {
type: 'Identifier',
name: 'test'
const avaImportDeclarationAsts = [
{
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportDefaultSpecifier',
local: {
type: 'Identifier',
name: 'test'
}
}
],
source: {
type: 'Literal',
value: 'ava'
}
],
source: {
type: 'Literal',
value: 'ava'
}
}, {
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportSpecifier',
imported: {
type: 'Identifier',
name: 'serial'
},
local: {
type: 'Identifier',
name: 'test'
},
{
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportSpecifier',
imported: {
type: 'Identifier',
name: 'serial'
},
local: {
type: 'Identifier',
name: 'test'
}
}
],
source: {
type: 'Literal',
value: 'ava'
}
],
source: {
type: 'Literal',
value: 'ava'
}
}, {
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportSpecifier',
imported: {
type: 'Identifier',
name: 'serial'
},
local: {
type: 'Identifier',
name: 'test'
},
{
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportSpecifier',
imported: {
type: 'Identifier',
name: 'serial'
},
local: {
type: 'Identifier',
name: 'test'
}
}
],
source: {
type: 'Literal',
value: 'ava'
}
],
source: {
type: 'Literal',
value: 'ava'
}
}, {
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportSpecifier',
imported: {
type: 'Identifier',
name: 'serial'
},
local: {
type: 'Identifier',
name: 'serial'
},
{
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportSpecifier',
imported: {
type: 'Identifier',
name: 'serial'
},
local: {
type: 'Identifier',
name: 'serial'
}
}
],
source: {
type: 'Literal',
value: 'ava'
}
],
source: {
type: 'Literal',
value: 'ava'
}
}];
];

const avaVariableDeclaratorAsts = [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'test'
},
init: {
type: 'CallExpression',
callee: {
const avaVariableDeclaratorAsts = [
{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'require'
name: 'test'
},
arguments: [
{
type: 'Literal',
value: 'ava'
}
]
}
}, {
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'serial'
},
value: {
init: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'serial'
name: 'require'
},
kind: 'init',
method: false,
shorthand: true,
computed: false
}]
arguments: [
{
type: 'Literal',
value: 'ava'
}
]
}
},
init: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [
{
type: 'Property',
key: {
type: 'Identifier',
name: 'serial'
},
value: {
type: 'Identifier',
name: 'serial'
},
kind: 'init',
method: false,
shorthand: true,
computed: false
}
]
},
arguments: [
{
type: 'Literal',
value: 'ava'
}
]
}
}, {
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'serial'
},
value: {
init: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'test'
name: 'require'
},
kind: 'init',
method: false,
shorthand: false,
computed: false
}]
arguments: [
{
type: 'Literal',
value: 'ava'
}
]
}
},
init: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [
{
type: 'Property',
key: {
type: 'Identifier',
name: 'serial'
},
value: {
type: 'Identifier',
name: 'test'
},
kind: 'init',
method: false,
shorthand: false,
computed: false
}
]
},
arguments: [
{
type: 'Literal',
value: 'ava'
}
]
init: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
},
arguments: [
{
type: 'Literal',
value: 'ava'
}
]
}
}
}];
];

function isTestFunctionCall(node) {
if (node.type === 'Identifier') {
Expand Down

0 comments on commit 6e38a7d

Please sign in to comment.